[Ipopt] If statement in objective function

Hans Pirnay hans.pirnay at rwth-aachen.de
Tue Sep 20 02:48:51 EDT 2011

Hi Greg,

that model is not a smooth nonlinear optimization problem, and
therefore not directly solvable with Ipopt.

Here's one simple thing you can do if you only have one constraint of
this kind: Solve the problem three times, once with the constraint

x <=a,   price=0
x >=a, x<=b   ,  price=1
x>=b,  price = 0

If you have several price variables, this approach quickly becomes
infeasible, and you will need to use an MINLP solver (I don't have any
suggestion which, it probably depends on what you can afford, though).

good luck


On Mon, Sep 19, 2011 at 11:44 PM, Gregory K. <khoroshylov at yahoo.com> wrote:
> Thank's for your response. To be honest I had finished my CO major awhile
> ago, and a bit rusty on theory.
> On a very simplified level, that's what I am trying to achieve
> maximize price:
> if x>=a and x <=b then 1 else 0
> But IPOPT gives me all zero solution which is obviously is not optimal.
> What should be done to make IPOPT solve it correctly? Am I missing anything
> (any ipopt option)?
> Is it even possible to solve it?
> Or maybe you can recomend any other more suitable solver.
> Thanks a bunch,
> Greg
> ________________________________
> From: Andrea Walther <andrea.walther at uni-paderborn.de>
> To: Stefan Vigerske <stefan at math.hu-berlin.de>
> Cc: Gregory K. <khoroshylov at yahoo.com>; ipopt at list.coin-or.org
> Sent: Monday, September 19, 2011 2:05:14 AM
> Subject: Re: [Ipopt] If statement in objective function
> Hi,
>> I don't know how AMPL computes derivatives for functions containing
>> if-statements, but you should make sure that you have at least
>> continuous first derivatives for Ipopt to work.
> as far as I know, AMPL uses Automatic Differentiation for the derivative
> calculation. Therefore, as long as you are not right at the kink caused
> by the if statement you get a derivative that is valid in a certain
> region around the current point. However, if this point is close to the
> kink the derivative information perhaps is not that useful. This might
> cause the problems in the optimisation process.
> Best regards,
> Andrea Walther
> --
> Prof. Dr. Andrea Walther
> Lehrstuhl fuer Mathematik und ihre Anwendungen
> Institut fuer Mathematik
> Universitaet Paderborn
> Warburger Str. 100
> 33098 Paderborn
> Email: andrea.walther at uni-paderborn.de
> Phone: ++49 5251 602721
> Fax:  ++49 5251 603728
> **********
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/ipopt

More information about the Ipopt mailing list