[Ipopt] If statement in objective function

Gregory K. khoroshylov at yahoo.com
Mon Sep 19 17:44:02 EDT 2011

```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
Warburger Str. 100