Optimization in LinProg

3 次查看(过去 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.

更多回答(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.

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

类别

Help CenterFile Exchange 中查找有关 Solver 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