Minimization linprog constraint no feasible solution

1 回表示 (過去 30 日間)
William
William 2024 年 9 月 17 日
コメント済み: William 2024 年 9 月 18 日

The problem lies in the equality constraints you set up in the code.
In the equality constraints (Aeq and Beq), there are conflicting conditions. Specifically, the last two constraints in Aeq are identical, but they are associated with different values in Beq. This creates a situation where the same set of variables is required to meet two contradictory conditions, making it impossible for linprog to find a feasible solution.
clear;
clc;
%objective cost coefficients
f = [40; 45; 50; 60; 55; 0; 0; 0];

[L1, L2, L3, L4] = deal(2.5, 2, 2, 2.3); %line constraints in per unit
%inequality constraints
Aineq = [0 0 0 0 0 10 -1 0;
0 0 0 0 0 -10 -1 0;
0 0 0 0 0 0 8 0;
0 0 0 0 0 0 -8 0;
0 0 0 0 0 0 0 5;
0 0 0 0 0 0 0 -5;
0 0 0 0 0 0 5 0;
0 0 0 0 0 0 -5 0];
Bineq = [L1; L1; L2; L2; L3; L3; L4; L4];
%equality constraints
Aeq = [1, 1, 1, 1, 1, 0, 0, 0;
0, 0, 0, 0, 0, 0, 10, 8;
0, 0, 0, 0, 0, 0, 15, -5;
0, 0, 0, 0, 0, 0, 0, 0]

Beq = [2.4 3 4 6.6];
%variable bounds
Lb = [0; 0; 0; 0; 0; -pi; -pi; -pi];
Ub = [3.70; 4.60; 3.40; 3.60; 6.50; pi; pi; pi];%call matlab LP solver
[x,feval,exitflag,output,lambda] = linprog(f, Aineq, Bineq, Aeq, Beq, Lb, Ub);
%display results
disp(x);
disp(feval);

  5 件のコメント
William
William 2024 年 9 月 18 日
I changed the equality constraints to
Aeq = [1, 1, 1, 1, 1, 0, 0, 0;
0, 0, 0, 0, 0, 0, 10, 8;
0, 0, 0, 0, 0, 0, 15, -5;
0, 0, 0, 0, 0, 0, 13, -5]
and still get no feasible solution error.
Torsten
Torsten 2024 年 9 月 18 日
編集済み: Torsten 2024 年 9 月 18 日
You can't give three equalities for two unknowns (x7 and x8). This will almost surely result in a contradiction.
You want x7 and x8 to be
[10 8;15 -5]\[3;4]
ans = 2×1
0.2765 0.0294
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
but at the same time you want them to take the values
[15 -5;13 -5]\[4;6.6]
ans = 2×1
-1.3000 -4.7000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>

サインインしてコメントする。

採用された回答

Torsten
Torsten 2024 年 9 月 18 日
移動済み: Torsten 2024 年 9 月 18 日
The last equality constraint says that you want 0*x1 + 0*x2 + 0*x3 + 0*x4 + 0*x5 + 0*x6 + 0*x7 + 0*x8 = 6.6, thus 0 = 6.6 ...
x7 and x8 from the equality constraints 2 and 3 give
[10,8;15,-5]\[3;4]
ans = 2×1
0.2765 0.0294
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
At the same time, you want from the inequality constraints 3 and 4
-2/8 <= x7 <= 2/8
which is also a contradiction.
  1 件のコメント
William
William 2024 年 9 月 18 日
Thank you! That got me to the correct solution!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by