MATLAB Answers

nonlinear optimization constraints problem

7 views (last 30 days)
Zhang Zhang
Zhang Zhang on 24 Mar 2020
Commented: Zhang Zhang on 13 May 2020 at 3:09
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?

  0 Comments

Sign in to comment.

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 at 3:09
Sry to reply late. That worked well with my code, thanks.

Sign in to comment.

Sign in to answer this question.


Translated by