Calling nonlinear constraints before objective function

1 vue (au cours des 30 derniers jours)
Michael Clausen
Michael Clausen le 19 Mar 2019
Commenté : Torsten le 19 Mar 2019
Hi, I am new to optimization and I am having a difficult time finding information that can help me with my particular problem:
My objective function take a vector of parameters: [x1 x2 x3 x4 x5]
It then calculate an additional parameter from the given parameters: y1 = (x1*x2*x3)/(x4*x5)
My problem is that my objective function only handles parameters within certain bounds, but when I use lower and upper bounds, these only apply to the parameters [x1 x2 x3 x4 x5] that I put into the objective function, and not to y1.
My approach has been to use a nonlinear constraint function that sets the bounds for possible y1's. But it seem like this is only called after the objective function, meaning that my restrictions to y1 are violated.
Can someone please help me getting my bounds to cover y1 so that the objective function does not use inappropriate y1's.
Thank you very much
-Michael
  1 commentaire
Torsten
Torsten le 19 Mar 2019
If you start with parameters x1,x2,x3,x4 and x5 for which y1 = x1*x2*x3/(x4*x5) is within the bounds you want to impose on it, everything will work out fine.

Connectez-vous pour commenter.

Réponse acceptée

Rik
Rik le 19 Mar 2019
You could let your objective function return inf when invalid parameters are provided. Then any minimizer will avoid values resulting in that condition.
function val=MyObjectiveFunction(x1,x2,x3,x4,x5)
y1 = (x1*x2*x3)/(x4*x5);
if y1<0
val=inf;
return
end
val=log(y1);
end

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with Optimization Toolbox 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!

Translated by