NLopt and Inequality Constraints

698 views
Skip to first unread message

Alexandros Theloudis

unread,
Apr 21, 2015, 6:29:11 AM4/21/15
to juli...@googlegroups.com
Hello,
I am carrying out a multi-dimensional optimisation using NLopt in Julia. The optimisation is subject to an inequality constraint. I am using the gradient based algorithm SLSQP. 

Usually the algorithm selects intermediate points that do not strictly satisfy the constraint (I guess it is designed to deliver final points that are feasible but does not need to strictly satisfy feasibility in intermediate evaluations). In the application I am considering this is a problem because the objective function is not defined if the inequality constraint is not satisfied. Is there a way (an option) that can enforce the inequality constraint in each round?

Thanks,
Alex

Miles Lubin

unread,
Apr 21, 2015, 11:25:36 AM4/21/15
to juli...@googlegroups.com
I can't speak for NLopt, but for Ipopt a typical trick is to encode such hard inequality constraints as bounds on variables, which should be respected on intermediate iterations. E.g., if you have a log(x) term in the objective, make sure that the variable x has a lower bound of 0 or even a small positive number.

Alexandros Theloudis

unread,
Apr 23, 2015, 4:40:35 AM4/23/15
to juli...@googlegroups.com
Hello. Thanks Miles. 

What you suggest is not doable in my application. The dimension of my optimisation problem is 4 and is subject to one equality constraint. The 4-element vector x is bounded from below and above. I could rewrite the problem removing the equality constraint and incorporating it in the objective function; in this case the dimension would go down to 3. But I will have to add an inequality constraint (which essentially plays the role of respecting the bounds of the one variable that I dropped). 

Knitro and other solvers give the user an option to have the inequality constraints satisfied in all rounds of the optimisation; I was wondering whether Nlopt also does that.

Thanks,
Alex

Steven G. Johnson

unread,
Apr 23, 2015, 10:44:39 AM4/23/15
to juli...@googlegroups.com


On Tuesday, April 21, 2015 at 6:29:11 AM UTC-4, Alexandros Theloudis wrote:
No, none of the NLopt algorithms currently have this option.

However, see NLopt issue https://github.com/stevengj/nlopt/issues/30 ... some of the algorithms may allow you to return NaN from the objective when it is not feasible to compute it.  SLSQP was just patched to allow this, although it's not in a released version of NLopt, and it should be possible to modify MMA and CCSA for that as well.

As Miles suggested, the ideal thing is to choose a coordinate system so that your "hard" inequality constraints can be expressed as simple upper/lower bound (box) constraints on one or more parameters.  NLopt will never violate a box constraint.

Steven G. Johnson

unread,
Apr 23, 2015, 10:47:16 AM4/23/15
to juli...@googlegroups.com
Actually, with CCSA it looks like you can just return Inf from your objective when it is not feasible to compute, and it may do the right thing.
Reply all
Reply to author
Forward
0 new messages