Optimization in LinProg

조회 수: 6 (최근 30일)
Meemai
Meemai 2012년 5월 29일
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

채택된 답변

Seth DeLand
Seth DeLand 2012년 5월 29일
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
Meemai
Meemai 2012년 5월 30일
Hi Mr. Seth,
Thank you very much.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Meemai
Meemai 2012년 5월 30일
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
Sean de Wolski
Sean de Wolski 2012년 5월 30일
The answer is X.
Meemai
Meemai 2012년 5월 30일
Thank you very much

댓글을 달려면 로그인하십시오.


Meemai
Meemai 2012년 5월 30일
Hi.
Is there any chance to see the results of lambda in the program above? Thanks

카테고리

Help CenterFile Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by