[Ipopt] Are piecewise functions constraints depending of a state, variable allowed?

Edson Cordeiro do Valle edsoncv at enq.ufrgs.br
Thu Oct 13 15:33:34 EDT 2016


Some time ago I needed to implement a discontinuous constraint, them I 
found a paper that showed how to smooth some commonly found 
discontinuous functions.
It may be necessary to handle your function to smooth it, but it is a 
good starting point.

Eg. suppose you have a function and want a smooth version for the step 
function. You can use a function like the below (in matlab, scilab 
notation, supposing "x" a vector).

th1 = (tanh(a*(x + c.ones(size(x,1))) ) + d.ones(size(x,1)))./b
making a= 100, b= 2 c and d = 1, you have the smooth version of the step 

By multiplying your function by th1, and adjusting the parameters, a, b, 
c and d again, you can "activate" or "deactivate" your continuous 
function, making it "virtually" discontinuous but mathematically continuous.

If you generate a vector, say x from -10 to 10 with 100 elements, apply 
the function above and plot you'll see what I am talking about.

Of course that, latter you will need to calculate the exact first and 
second order derivatives for Ipopt or use numeric derivatives.

Here are the references for other smoothing functions.

GOPAL, V.; BIEGLER, L. T. Smoothing methods for complementarity problems 
in process engineering. AIChE Journal, v. 45, n. 7, p. 1535–1547, jul. 

You can contact me by e-mail  if you want.

Good luck

More information about the Ipopt mailing list