Minimization linprog constraint no feasible solution

2 Ansichten (letzte 30 Tage)
William
William am 17 Sep. 2024
Kommentiert: William am 18 Sep. 2024

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 Kommentare
William
William am 18 Sep. 2024
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 am 18 Sep. 2024
Bearbeitet: Torsten am 18 Sep. 2024
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>

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Torsten
Torsten am 18 Sep. 2024
Verschoben: Torsten am 18 Sep. 2024
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.

Weitere Antworten (0)

Produkte


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by