Warm Start in AMPL

504 views
Skip to first unread message

David Veerasingam

unread,
Oct 16, 2005, 4:50:30 PM10/16/05
to AMPL Modeling Language
Is there a way to warm start an NLP in AMPL?

Has anyone tried encapsulating a problem as a "named problem" and then
calling it recursively? How does one do it for a huge problem with
thousands of variables? (it seems that declaring the problem's
variables would be rather unwieldy) Or is there a better way?

Thanks.

Robert Fourer

unread,
Oct 17, 2005, 5:32:00 PM10/17/05
to David Veerasingam, AMPL Modeling Language

> From: David Veerasingam [vdavi...@gmail.com]
> Sent: Sunday, October 16, 2005 3:51 PM
> To: AMPL Modeling Language
> Subject: [AMPL] Warm Start in AMPL
>
> Is there a way to warm start an NLP in AMPL?

AMPL lets you set the variables to any values that you like. When a solver is
invoked, those values are send (along with the rest of the information about
the problem) to the solver interface, which may pass them to the solver as a
warm start if the solver can use them for that purpose.

There is an example on pages 407-409 of the AMPL book, where the variables are
assigned values in the statements that declare them. AMPL "let" statement can
also be used to assign values to variables.

> Has anyone tried encapsulating a problem as a "named problem" and then
> calling it recursively? How does one do it for a huge problem with
> thousands of variables? (it seems that declaring the problem's
> variables would be rather unwieldy) Or is there a better way?

I'm not sure what you have in mind here. Can you give a specific example?

Bob Fourer
4...@ampl.com




David Veerasingam

unread,
Oct 17, 2005, 6:07:16 PM10/17/05
to AMPL Modeling Language
Thanks for your reply, Bob. I always appreciate your input.

Robert Fourer wrote:
> There is an example on pages 407-409 of the AMPL book, where the variables are
> assigned values in the statements that declare them. AMPL "let" statement can
> also be used to assign values to variables.

Yup, that's similar to what I want to do.... but I was wondering if it
could be, sort of, automated....
i.e. a kind of "let" that will take all the values of solution and use
them as initial guesses for the next "solve".

I have thousands of variables in my problem... it's a bit tedious to
write thousands of "let" statements after every solve phase.

> I'm not sure what you have in mind here. Can you give a specific example?

What I had in mind is something like a two-tier strategy.

I have a problem with many degrees of freedom, so there is a whole set
of admissible optimal solutions. In that sense, it is quite sensitive
to initial guesses. What I want to do is this....

1) Start with an arbitrary initial guess for all decision variables,
x0.
2) Run it through the solver once, obtain values for the decision
variables, x and the objective function, Obj = p, where p is a scalar.
3) This is the part that I need AMPL to do: take the values of x from
the previous solution, and use those as the initial guess.
4) On my part, I will take the previous value of the objective
function, p, and constrain the objective function to equal to p. I will
also impose some other constraints to narrow down the set of solutions.
5) Re-solve the system.
6) Repeat from (3) until a single solution is obtained.

So I was thinking of something along the lines of encapsulating my
problem as a "named problem", and then solving it, and then somehow
getting the values of the decision variables and calling the "named
problem" again with those values as initial guesses. Of course I may be
completely off-base here....

Robert Fourer

unread,
Oct 17, 2005, 11:56:50 PM10/17/05
to David Veerasingam, AMPL Modeling Language

> David Veerasingam [vdavi...@gmail.com]
> Sent: Monday, October 17, 2005 5:07 PM
> To: AMPL Modeling Language
> Subject: [AMPL] Re: Warm Start in AMPL
>
> Robert Fourer wrote:
> > There is an example on pages 407-409 of the AMPL book, where the
> > variables are
> > assigned values in the statements that declare them. AMPL "let"
> > statement can
> > also be used to assign values to variables.
>
> Yup, that's similar to what I want to do.... but I was wondering if it
> could be, sort of, automated....
> i.e. a kind of "let" that will take all the values of solution and use
> them as initial guesses for the next "solve".
>
> I have thousands of variables in my problem... it's a bit tedious to
> write thousands of "let" statements after every solve phase.

The values of the variables returned by a "solve" will automatically be sent
as the initial guess at the next "solve", if you do nothing to change them.
AMPL does not reset the variables to their values before the previous
"solve", unless you explicitly specify "option reset_initial_guesses 1".

> > I'm not sure what you have in mind here. Can you give a specific
> example?
>
> What I had in mind is something like a two-tier strategy.
>
> I have a problem with many degrees of freedom, so there is a whole set
> of admissible optimal solutions. In that sense, it is quite sensitive
> to initial guesses. What I want to do is this....
>
> 1) Start with an arbitrary initial guess for all decision variables,
> x0.
> 2) Run it through the solver once, obtain values for the decision
> variables, x and the objective function, Obj = p, where p is a scalar.
> 3) This is the part that I need AMPL to do: take the values of x from
> the previous solution, and use those as the initial guess.
> 4) On my part, I will take the previous value of the objective
> function, p, and constrain the objective function to equal to p. I will
> also impose some other constraints to narrow down the set of solutions.
> 5) Re-solve the system.
> 6) Repeat from (3) until a single solution is obtained.
>
> So I was thinking of something along the lines of encapsulating my
> problem as a "named problem", and then solving it, and then somehow
> getting the values of the decision variables and calling the "named
> problem" again with those values as initial guesses. Of course I may be
> completely off-base here....

Named problems are probably irrelevant here. Step (3) happens
automatically, and you can add whatever constraints you like between one
solve and the next.

Bob Fourer
4...@ampl.com



David Veerasingam

unread,
Oct 18, 2005, 4:40:39 PM10/18/05
to AMPL Modeling Language
Robert Fourer wrote:
> The values of the variables returned by a "solve" will automatically be sent
> as the initial guess at the next "solve", if you do nothing to change them.
> AMPL does not reset the variables to their values before the previous
> "solve", unless you explicitly specify "option reset_initial_guesses 1".

That is excellent!

Thanks for this information!

warmest regards,
David

francesca...@unibg.it

unread,
Jan 5, 2015, 12:04:19 PM1/5/15
to am...@googlegroups.com
Hello,

I have tried to accelerate the computation of some bounds for a mulstistage non linear stochastic problem implemented in AMPL with solver MOSEK by warm-starting the respective optimization problems from the solutions of some other problems. However I have noticed that the variables where the warm-start was applied stopped at that point instead to get it as inizial condition.
I have used the let command in the run file.
Are there any other ways to implement warm-start under AMPL with solver Mosek?

Many thanks,
with best regards,
Francesca 

Robert Fourer

unread,
Jan 6, 2015, 11:05:04 AM1/6/15
to am...@googlegroups.com
Using AMPL, the only way to give MOSEK an initial solution for a warm start is to assign initial values to the variables, as you are doing. If MOSEK returns with an "optimal solution" message after you do this, then the resulting solution should indeed be optimal, even if some of the variables did not change from their initial values. However if you do not receive an "optimal solution" message then possibly MOSEK did not return a solution, in which case the variables in AMPL will have the same values that they had before the solve.

A simple test that you can try is to solve the same problem with the warm start and without the warm start. If MOSEK reports "optimal solution" in both solves, and also reports the same optimal objective value for both solves, then everything is working properly. Otherwise you have evidence of an error that you can report to MOSEK support for further help.

Bob Fourer
am...@googlegroups.com

=======

Francesca Maggioni

unread,
Jan 6, 2015, 5:34:58 PM1/6/15
to am...@googlegroups.com
Dear Bob,

thank you very much for the explanation. Without warm-start I get an optimal solution. 
However, with warm-start I get the following message:
Optimizer terminated. Time: 0.11    
Return code - 0  [MSK_RES_OK]
MOSEK finished.
Problem status    : UNKNOWN
Solution status   : UNKNOWN

solve_result_num = 500

with best regards,
Francesca

--
You received this message because you are subscribed to a topic in the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ampl/MTuKyFXLjOQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at http://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.



--
________________________________________________________
Francesca Maggioni, PhD
Assistant Professor of Operations Research 
Department of Management, Economics and Quantitative Methods, 
University of Bergamo Via dei Caniana 2, 24127 Bergamo, Italy
tel: +39-035-2052649
e-mail: francesca...@unibg.it
home-page: http://www.matapp.unimib.it/~maggioni
________________________________________________________

Robert Fourer

unread,
Jan 7, 2015, 3:45:06 PM1/7/15
to am...@googlegroups.com
This output suggests that, in the warm-start run, some error occurred either in MOSEK's AMPL interface or in the MOSEK solver. I would suggest following up by posting complete details to the MOSEK forum, by sending email to mo...@googlegroups.com.

Bob Fourer
am...@googlegroups.com

=======

e.d.an...@mosek.com

unread,
Jan 8, 2015, 8:59:25 AM1/8/15
to am...@googlegroups.com, 4...@ampl.com
The issue is most likely that Francesca wants to do hotstart for a nonlinear problem. Hotstart is only available when you use the simplex optimizer to solve linear problems in MOSEK. No one except MOSEK can do something about that.

Some nonlinear hotstart capabilities may become available in version 8 planned to be released some time in 2015.

In general for an issue that involves both MOSEK and AMPL it is better to follow Bobs advice below or contact MOSEK support. Since the MOSEK interface is maintained by MOSEK and not AMPL.

Francesca Maggioni

unread,
Jan 8, 2015, 4:23:30 PM1/8/15
to am...@googlegroups.com
Dear Bob and Erling,

thank you for your suggestion. I wrote to MOSEK support and the problem was due to the fact I have not installed the latest Mosek release 7.1.
Now with the version 7.1 the error does not appear anymore.
However I understand nonlinear hotstart capabilities may become available in version 8 planned to be released some time in 2015.

Thank you very much for your help!
with best regards,
Francesca

--
You received this message because you are subscribed to a topic in the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ampl/MTuKyFXLjOQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at http://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages