Bounds on objective function and dependent state with FMINCON

I'm minimizing the function
fun = f(x)
with FMINCON. As the documentation shows, it's easy to apply bounds on x. So let's say:
min f(x)
0 <= x <= 1
But fun as well as a variable y which is dependent of x are bounded. So what I'd like to implement is:
min f(x)
0 <= x <= 1
fun_min <= fun <= fun_max
y_min <= y <= y_max
The dependency of x and y prohibits me from using y as a second optimization variable. What I'm looking for is "minimize fun = f(x) under consideration of the bounds b=[fun_min, fun_max, y_min, y_max]" Any ideas? Thanks for your help

1 Comment

Do we understand correctly that you want to find the minimum of f(x), but that the same time you want to impose a bound on what the minimum can be? If you know it can be the minimum, then why bother searching for the minimum?

Sign in to comment.

 Accepted Answer

Would it work to include a penalty for too-low y at the end of your function f? Something like this:
function y = f(x)
...
if y<y_min
y = y_min + 100*(y_min-y);
end
end % function f
I don't quite see why you need to enforce y_max, since fmincon will try to minimize your function anyway.

4 Comments

Thank you guys! You are right, the objective function has bounds to it, which should be enforced implicitly by the function's definition. So let's focus on the other problem: Bounds and constraints on variables, which are not optimization variables. These are not independent variables, but have to meet the constraints. To put that into context. My problem is following: I have to types of energy storage, defined by their outlet power and want to minimize the dissipated energy due to conversion. The one power is dependent of the other which is my optimization variable, but I can only allow a minimum and maximum power on both of these storage types. Any ideas how to enforce these bounds? Cheers
If you can, work it out as a linear constraint. But if you cannot do that, then implement a nonlinear constraint. Nonlinear constraints can do any amount of computation they need to in order to emit their results.
Thanks Walter,
so my approach to constrain
y=g(x), y_min <= y <= y_max
should be
g(x) >= y_min, g(x) <= y_max
to express y as a function of x and implicitly constrain x?

Sign in to comment.

More Answers (1)

It works perfectly with the nonlinear constraints when you express the second state as a function of the optimization variable. Thanks guys! Quick and perfect help!

Products

Release

R2017b

Community Treasure Hunt

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

Start Hunting!