Optimization in LinProg
2 views (last 30 days)
Show older comments
Hi
When I run this in Matlab:
%Load is system load plus losses Load=2.1787;
%Build objective function vector. c=[1307 1211 1254 0 0 0 0 0 0 0 0 0]';
%Build Aeq matrix for equality constraints. Aeq=
[0 0 0 -1 0 0 0 0 10 0 0 -10;
0 0 0 0 -1 0 0 0 10 -10 0 0;
0 0 0 0 0 -1 0 0 0 10 -10 0;
0 0 0 0 0 0 -1 0 0 0 -10 10;
0 0 0 0 0 0 0 -1 10 0 -10 0;
-1 0 0 0 0 0 0 0 30 -10 -10 -10
0 -1 0 0 0 0 0 0 -10 20 -10 0;
0 0 0 0 0 0 0 0 -10 -10 30 -10;
0 0 -1 0 0 0 0 0 -10 0 -10 20;];
%Build right-hand side of equality constraint.
beq=zeros(9,1);
%beq(6)=-1;
beq(7)=-1;
beq(8)=-1.1787;
%Build upper and lower bounds on decision variables.
LB=[.50 .375 .45 -500 -0.300 -0.300 -500 -500 -pi -pi -pi -pi]';
UB=[2.00 1.50 1.80 500 0.300 0.300 500 500 pi pi pi pi]';
[X,FVAL,exitflag,output,lambda]= linprog(c,[],[],Aeq,beq,LB,UB);
I always get "Optimization Terminated" . I changed the optimset but still same result. Please Help. Thanks
0 Comments
Accepted Answer
Seth DeLand
on 29 May 2012
Hi Meemai,
The message "Optimization Terminated" means that the optimization completed as normal. If you look at the value of exitflag, it should be 1. The documentation for LINPROG says that a value of 1 means "Function converged to a solution x.". So the solver converged and the resulting solution is returned in X.
I can see how the message "Optimization Terminated" can be confusing or undesirable. You can turn off this message with an options structure:
options = optimset('Display','none');
and then calling LINPROG with that structure:
[X,FVAL,exitflag,output,lambda]= linprog(c,[],[],Aeq,beq,LB,UB,[],options);
Hope that helps.
More Answers (2)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!