Calling nonlinear constraints before objective function

1 Ansicht (letzte 30 Tage)
Michael Clausen
Michael Clausen am 19 Mär. 2019
Kommentiert: Torsten am 19 Mär. 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 Kommentar
Torsten
Torsten am 19 Mär. 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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Rik
Rik am 19 Mär. 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

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with Optimization Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by