Linprog Error - Matrix Coefficients are too Large

8 ビュー (過去 30 日間)
Luka Celic
Luka Celic 2018 年 12 月 21 日
コメント済み: Alan Weiss 2019 年 1 月 21 日
I'm trying to use linprog to calculate the smallest amount of time to accumulate gear damage targets in a mechanical durability test. I have 7 cases (maneuvers) which each generate a certain amount of damage (there are 5 damage equations). I would like to determine how many cycles of each case to perform to reach all 5 damage targets in the shortest amount of time possible.
lb=zeros(7,1);
lb(1)=4000;
lb(2)=70000;
lb(3)=70000;
lb(4)=90000;
lb(5)=40000;
lb(6)=340000;
lb(7)=390000;
ub=inf(7,1);
ub(1)=5000;
ub(2)=80000;
ub(3)=80000;
ub(4)=100000;
ub(5)=50000;
ub(6)=350000;
ub(7)=400000;
A=zeros(0,7);
b=zeros(0,0);
Aeq=zeros(5,7); % Equations
Aeq(1,[1,2,3,4,5,6,7])=[2.56e13,8.55e12,0,8.79e12,0,1.5e12,4.58e11];
Aeq(2,[1,2,3,4,5,6,7])=[0,0,5.9e12,0,1.41e13,9.25e11,2.04e11];
Aeq(3,[1,2,3,4,5,6,7])=[9.67e32,1.42e31,0,3.29e30,0,1e31,3.63e31];
Aeq(4,[1,2,3,4,5,6,7])=[0,0,5.17e31,0,2.86e32,2.75e30,4.09e30];
Aeq(5,[1,2,3,4,5,6,7])=[1.57e21,9.515e20,9.515e20,1.165e21,1.165e21,8.67e19,1.688e21];
beq=zeros(5,1); % Damage Targets
beq(1)=1.87e18;
beq(2)=1.07e18;
beq(3)=1.98e37;
beq(4)=1.24e37;
beq(5)=7.19e26;
f=zeros(7,1); % The time it takes for each cycle to be performed
f(1)=28.2;
f(2)=22.8;
f(3)=19.2;
f(4)=45.6;
f(5)=23.5;
f(6)=2.8;
f(7)=1;
[x fval] = linprog(f,A,b,Aeq,beq,lb,ub)
I get the following error:
Error using linprog (line 345)
LINPROG stopped because some objective or constraint matrix coefficients are too large in magnitude.
Error in Attempt2 (line 146)
[x fval] = linprog(f,A,b,Aeq,beq,lb,ub)
I'm not sure why it won't solve as I know there are solutions within the bounds I have specified. Is this just a case of the damage coefficients being too large?
Thank you!

回答 (1 件)

Alan Weiss
Alan Weiss 2018 年 12 月 26 日
編集済み: Alan Weiss 2018 年 12 月 26 日
The default linprog algorithm is the same as a portion of the intlinprog algorithm, a dual-simplex method. For this algorithm, large coefficients are disallowed. I suggest that you scale some of your coefficients to be in a smaller range and then rescale the solution afterward. Or, switch to the 'interior-point' algorithm. Still, solvers struggle with poorly-scaled problems, so you will probably get more reliable answers if you scale your coefficients.
One more thing: pass A and b as [] instead of zero matrices.
Alan Weiss
MATLAB mathematical toolbox documentation
  6 件のコメント
Luka Celic
Luka Celic 2019 年 1 月 11 日
I've scaled the numbers and changed the lower bounds to zero. Now the Aeq*lb - beq expression is negative.
lb=zeros(7,1);
lb(1)=0;
lb(2)=0;
lb(3)=0;
lb(4)=0;
lb(5)=0;
lb(6)=0;
lb(7)=0;
ub=inf(7,1);
ub(1)=5000;
ub(2)=80000;
ub(3)=80000;
ub(4)=100000;
ub(5)=50000;
ub(6)=350000;
ub(7)=400000;
>> Aeq*lb-beq
ans =
1.0e+12 *
-0.0000
-0.0000
-1.9800
-1.2400
-0.0000
However, I still get a "No feasible solution found" error. Is there something else I am doing wrong with this problem?
Thank you!
Luka
Alan Weiss
Alan Weiss 2019 年 1 月 21 日
Your problem is, doubtless, still infeasible. See Check Linear Constraints.
Alan Weiss
MATLAB mathematical toolbox documentation

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by