Using fmincon with multiple inequality constraints

13 views (last 30 days)
I'm not really sure if I'm asking this correctly, but I'm trying to minimize this function given the constraints using fmincon:
  1 Comment
Michael
Michael on 2 Nov 2020
Something to note is that your function seems to be a function of both x and y. Because fmincon is designed for functions of x, you will need to write these as a function of x, and solve for variable values of y. This means you can iterate through different guesses of y, and try to plot outputs to get a good approximation, and then look more carefully at a local optimum.
Hope that helps, but fmincon is limited to functions of x exclusively,
Michael

Sign in to comment.

Accepted Answer

Alan Weiss
Alan Weiss on 3 Nov 2020
You can easily formulate these constraint for fmincon using the recipes in Write Constraints. Your first two constraints, and , can be written as Nonlinear Constraints. The third, , is a Linear Constraint. The constraints and are best expressed as Bound Constraints.
And you need to keep in mind that fmincon insists that you formulate all of your functions in terms of one variable, x, so you would have x = x(1) and y = x(2). See Writing Scalar Objective Functions.
Alan Weiss
MATLAB mathematical toolbox documentation
  1 Comment
Matt J
Matt J on 3 Nov 2020
Edited: Matt J on 4 Nov 2020
Your first two constraints, g1 and g2, can be written as Nonlinear Constraints. The third, g3, is a Linear Constraint.
However, I recommend making the change of variables s=1e5*x*y, t=y so that the problem can be re-written in terms of a convex objective and convex constraints as below. This transforms g3 into a non-linear constraint, while g2 becomes a simple lower bound.
f(s,t)=s
g1 = 240/s - t <= 0
g2 = s>=1.125
g3 = t^2 - 2*s <=0
s>=0
t>=0

Sign in to comment.

More Answers (0)

Tags

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!