MATLAB Answers

nonlinear optimization constraints problem

1 view (last 30 days)
Zhang Zhang
Zhang Zhang on 24 Mar 2020
Commented: Zhang Zhang on 13 May 2020
I've a optimization problem which has 2 design variables x1 and x2. There are 2 nonlinear constraints g1(x1,x2) and g2(x1,x2). g1 defines the nonlinear relationship between x1 and x2 such as x1^2 <= x2^2 - 1 and g2 can be determined after a simulation outside matlab. I chose sqp algorithm to solve the problem and the question is that sqp will calculate gradient of g2 even if g1 is violated(e.t. x1 = 1,x2 =1 ) and error will occur in g2 because of the design varibales will generate a wrong shape in simulation which can not be used. Correct shape can only be generated when g1 is satisfied. The biggest problem is that g1 can not be reformed to a linear constraint as an upper bound and a lower bound.What should I do?

Answers (1)

Alan Weiss
Alan Weiss on 24 Mar 2020
I suggest that you ensure that your initial point is feasible, and then insert code into your objective function that first evaluates the constraint, and, if not satisfied, returns NaN for the objective function value without any further calculation (I mean without calling the simulation).
Alan Weiss
MATLAB mathematical toolbox documentation
  1 Comment
Zhang Zhang
Zhang Zhang on 13 May 2020
Sry to reply late. That worked well with my code, thanks.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by