Info

# Updating bounds in fmincon

1 view (last 30 days)
Michelle on 13 Aug 2013
Closed: MATLAB Answer Bot on 20 Aug 2021
Hello,
I am trying to update bounds on a parameter I am optimizing. I have two parameters, b and psi. psi's bounds are a function of b so they need to be updated. How do I keep changing the bounds while also optimizing for both b and psi?
This is the inequality I need to define:
π-2tan^(-1)(2r/b)<Ψ<3π/2-2tan^(-1)(2r/b)

Matt Kindig on 13 Aug 2013
Edited: Matt Kindig on 13 Aug 2013
You can implement the constraints on psi as a linear inequality constraint. If you check the documentation for your solver (e.g., doc fmincon), you should see the definitions of the A, Aeq, B, Beq matrices, which you can use to implement the constraint. For example, if your constraint is that
psi < b
You can convert this constraint to an inequality:
psi - b < 0
implement this as:
A = [1 -1]; B = 0;
%assuming your variables are in the order [psi; b].
Similarly, for psi > b:
A = [1 -1]; B = 0;
Note that you will need to pad out A and B with zeros if you have additional parameters to optimize.