Optimization Questions on set constraint
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (3)
Ho Chun
le 8 Déc 2014
Modifié(e) : Matt J
le 8 Déc 2014
2 commentaires
Matt J
le 8 Déc 2014
Modifié(e) : Matt J
le 8 Déc 2014
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
le 8 Déc 2014
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
le 8 Déc 2014
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)
Alan Weiss
MATLAB mathematical toolbox documentation
0 commentaires
Voir également
Catégories
En savoir plus sur Solver Outputs and Iterative Display dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!