[Ipopt] Runtime modification of the model

Paul Smith phhs80 at gmail.com
Sat Feb 26 07:05:27 EST 2011

```On Fri, Feb 25, 2011 at 3:59 PM, Horand Gassmann <Horand.Gassmann at dal.ca> wrote:
>>> Is it possible to modify the optimization model while the C++ program
>>> is running? For instance, is it possible to write a C++ program to
>>> solve different optimization models inside a loop and with theses
>>> models being not known until runtime? Basically, what I am wanting to
>>> do is to change the coefficients of the initial model as new
>>> information comes into the system.
>>
>> Should I interpret your silence as being impossible what I am wanting
>> to do? Can a C++ program solve not more than a single optimization
>> model?
>
> Modification is always a tough thing. What do you want to modify? Just
> parameter values, or possibly problem dimensions? Even if it's just
> parameter values: You are using Ipopt, so presumably you have
> nonlinear problems. Do you know if these problems are convex? Can the
> convexity be destroyed by your modifications? How do you run Ipopt? If
> you call it from AMPL, you can set up the loop inside of AMPL, calling
> Ipopt from inside the loop.
>

Thanks, Horand and Andreas, for your reply. I will try to clarify
better what I am wanting to do in what follows.

First, I am interfacing Ipopt through a C++ program (and not via
AMPL). I know nothing about convexity of my models. But let me
illustrate what I am wanting with an example.

Consider the following model:

minimize a x^3 + b y

subject to:

c x + d y^2 = 5

x,y >= 0,

where a, b, c, d are real parameters. Suppose that the initial values
of the parameters are known from the outset. And now suppose that one
wants to solve the model by replacing, sequentially, the value of each
parameter by a value drawn from a common uniform distribution. Notice
that one would need to solve 4 models, one for each parameter
replacement.  My question is: how could one do that trough a single
C++ program (and not with 4 separated C++ programs)?

I hope this time I was clearer.

Have a nice weekend,

Paul

```