Optimization in LinProg
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
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 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!