Info

此问题已关闭。 请重新打开它进行编辑或回答。

Updating bounds in fmincon

1 次查看(过去 30 天)
Michelle
Michelle 2013-8-13
关闭: MATLAB Answer Bot 2021-8-20
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)

回答(1 个)

Matt Kindig
Matt Kindig 2013-8-13
编辑:Matt Kindig 2013-8-13
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.
  1 个评论
Matt Kindig
Matt Kindig 2013-8-13
Now that you've edited the question, I see that your constraints are nonlinear. Thus, instead of using the linear inequality method I've described below, you will need to implement this using a custom nonlinear constraint function, with two inequality expressions. See the documentation for fmincon for details.

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by