Solving more than one problem/model (the enveloppe..sort of..)

21 views
Skip to first unread message

louisperrault

unread,
Sep 21, 2016, 10:48:48 AM9/21/16
to AMPL Modeling Language
Hello,

So far when I have been using a .run file I can only include one model file (.mod). That has usually been ok. I could solve that model or solve it many times in a loop.

What I would like to do, and I am not too sure I can do that in AMPL is to use the output of the first solve and enter them in a new problem.

I will give a generalization of the problem. 

Let u_i(X ; w_i, q) be  continuous function where the choice variables (var in AMPL) is the vector X. The function depends on both parameter w_i and q. The subscript i is to represent different values for each i (suppose N of them), and q would be same for all i. 

w_i is taken from a set W and each w_i is different. I take this from a .txt file that I input. 

Here max u_i(X ; w_i, q) would be is a model file .mod. Now I use my .run file to give the values for the parameters then do a loop to solve the N problems.

In the end I will have all the optimal choice variables for each i. If I plug those back in, I should get v_i(w_i, q)=max_X u(X*; w_i ,q).

What I would like to do from there is to, for example, minimize/maximize the value of some objective function, suppose F(q)=sum_i v_i(w_i,q), by picking q. 

I guess I could solve this by using the first-order conditions (FOC) of the first set of problems and use those as contraints for the bigger problem. However, each small problem in the loop gives a large number of FOCs which would make it (practically) infeasible. 

So is there a way to use the output of solving the many first problems as an input for the bigger problem? I understand that this would need a solver that tests jumps before moving in different directions since I wouldn't be really able to feed it an hessian or something like that. And every time it tests a new value, the whole inner loop as to be redone. 

I haven't able to do this on my own, so I figured I would ask here.

Thank you for your time.

Robert Fourer

unread,
Sep 22, 2016, 6:21:42 PM9/22/16
to am...@googlegroups.com
You can define more than one model using AMPL's "named problems" feature in sections 14.4 and 14.5 of the AMPL book (starting at http://ampl.com/BOOK/CHAPTERS/17-solvers.pdf#page=30). Also after a "solve" you can assign the values of variables to parameters that are used later in optimizing a different problem, using AMPL "let" statements to make the assignments.

However I get the impression that you may be trying to solve a two-stage optimization problem, where some master problem is optimized, subject to certain parameters of the master being optimal when then are included as variables in different subproblems. If you have an idea for an algorithm that alternates between solving the master problem and the subproblems, that might be implemented in AMPL; however more general methods, such as those using first-order conditions, are usually necessary to get a provably optimal solution. Also AMPL does not have a direct way of writing a two-stage problem so that it can be sent as a single optimization problem to a solver.

Bob Fourer
am...@googlegroups.com

=======
Reply all
Reply to author
Forward
0 new messages