Optimization in LinProg

8 views (last 30 days)
Meemai
Meemai on 29 May 2012
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

Accepted Answer

Seth DeLand
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.
  1 Comment
Meemai
Meemai on 30 May 2012
Hi Mr. Seth,
Thank you very much.

Sign in to comment.

More Answers (2)

Meemai
Meemai on 30 May 2012
Hi. I run the program stated above. The optimization terminated message is gone but the answer is not appearing in the Matlab. Pls. Help. Thank you.
  2 Comments
Meemai
Meemai on 30 May 2012
Thank you very much

Sign in to comment.


Meemai
Meemai on 30 May 2012
Hi.
Is there any chance to see the results of lambda in the program above? Thanks

Community Treasure Hunt

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

Start Hunting!