Minimization linprog constraint no feasible solution

조회 수: 2 (최근 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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver 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