Optimization Questions on set constraint

조회 수: 5 (최근 30일)
Ho Chun
Ho Chun 2014년 12월 7일
댓글: Torsten 2014년 12월 8일
Halo
I have got a question when setting the constraint of optimization I want to optimize the p(1,p(2)and p(3) There are 4 constraint i need to set
1)p(1)+p(2)+p(3)=1
2)p(1)*e(1)+p(2)*e(2)+p(3)*e(3)<=eav
3)0<=p(i), where i=1,2,3
4)p(i)<=1, where i=1,2,3
I want these set in a condition file However matlab just tell me
Warning: The default trust-region-reflective algorithm does not solve problems with the constraints you
have specified. FMINCON will use the active-set algorithm instead. For information on applicable
algorithms, see Choosing the Algorithm in the documentation.
> In fmincon at 504
In optst22 at 32
Warning: Your current settings will run a different algorithm (interior-point) in a future release.
> In fmincon at 509
In optst22 at 32
PS it seems that it failure PLZ help me

답변 (3개)

Matt J
Matt J 2014년 12월 8일
편집: Matt J 2014년 12월 8일
No, there is non evidence of failure. The messages are just warnings that fmincon switched to non-default settings.

Ho Chun
Ho Chun 2014년 12월 8일
편집: Matt J 2014년 12월 8일
I have set the constraint that the range of p(1), p(2) and p(3) must within 0 and 1. However, they still have negative value appear. It seems that this constraint does not work.
May you tell me how to set constraint?
My code as follow
c(1)=p(1)*t*e(1)+p(2)*t*e(2)+p(3)*t*e(3);
c(2)=-p(1)*t;
c(3)=-p(2)*t;
c(4)=-p(3)*t;
c(5)=p(1)*t-1;
c(6)=p(2)*t-1;
c(7)=p(3)*t-1;
ceq=[-1+result;];
  댓글 수: 2
Matt J
Matt J 2014년 12월 8일
편집: Matt J 2014년 12월 8일
Only bound constraints can be satisfied exactly, but only with the interior-point or sqp algorithm, and only if you use the lb,ub arguments to express them, as Alan indicated.
The rest of the constraints can be violated slightly and you must accept this. Although, you can use the TolCon input option to demand a lower non-zero violation. The price will be more iterations and longer compute time for fmincon, however.
Torsten
Torsten 2014년 12월 8일
If t=1, result=p(1)+p(2)+p(3) and your call to fmincon is correct, I don't see anything wrong.
By the way: The constraints p(i)<=1 are superfluous because you claim p(i)>=0 and p(1)+p(2)+p(3)=1.
Best wishes
Torsten.

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


Alan Weiss
Alan Weiss 2014년 12월 8일
You should not be using nonlinear constraints. Instead, use bounds and linear constraints as follows:
lb = zeros(3,1)
ub = ones(3,1)
Aeq = [1,1,1]; beq = 1;
A = [e(1),e(2),e(3)]; b = eav;
options = optimoptions(@fmincon,'Algorithm','interior-point');
[x,fval,eflag,outpt] = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,[],options)
For more information, see the documentation on constraints.
Alan Weiss
MATLAB mathematical toolbox documentation

카테고리

Help CenterFile Exchange에서 Surrogate Optimization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by