RE: [AMPL 10079] Using previous solution to solve faster

323 views
Skip to first unread message

Robert Fourer

unread,
Jun 18, 2015, 6:55:35 PM6/18/15
to am...@googlegroups.com
If you do a "solve" in AMPL and then another "solve", then normally AMPL will send the solution from the first solve to CPLEX to use, if possible, in starting the second solve. [You do need to be sure that there is no "reset" command between the solves, that no other values were assigned to the variables between the solves (using "let" statements, for instance), and that there wasn't an "option reset_initial_guesses 1;" command which suppresses sending the solution to the second solve.]

Can you be more specific as to why you think that "it didn't work"? If CPLEX was able to use the first solution in starting on the second solve, you should see messages about "MIP starts", such as

1 of 1 MIP starts provided solutions.
MIP start 'm1' defined initial solution with objective 233975.0000.

However, if you only see a message like

Retaining values of one MIP start for possible repair.

then your solution from the first problem may not have been feasible for the second, and CPLEX may not have been able to use it.

Also, AMPL's presolve phase may change the problem in ways that make it hard to send a feasible solution, so you may want to try your runs with "option presolve 0;". And finally, it is important to keep in mind that initial solutions are of only limited value to CPLEX when solving MIPs. So even if you give CPLEX a feasible solution, the time to reach a 1% mipgap may not be reduced very much.

Bob Fourer
am...@googlegroups.com

=======

From: am...@googlegroups.com [mailto:am...@googlegroups.com] On Behalf Of Guillaume Marois
Sent: Wednesday, June 17, 2015 2:02 PM
To: am...@googlegroups.com
Subject: [AMPL 10079] Using previous solution to solve faster

I'm currently working on a MIP problem with cplex on AMPL.
And right now I need it to solve faster.

I know it's possible to use a previous solution of the problem to help cplex find an initial solution.
I've been trying to do so for quite a long time now and I haven't find the right way so far.

I tried solving both problems one after the other in a run file, so that the results of the first one would be kept in memory but it didn't work.

The options I use with cplex are : ' time 180 mipdisplay 2 mipgap 0.01 mipemphasis 1'

Is there an option I should add? Or am I just doing this all wrong?


Guillaume Marois

unread,
Jun 19, 2015, 8:32:18 AM6/19/15
to am...@googlegroups.com, 4...@ampl.com
Thank you for your response Bob! I found out what I wanted to do, but your answer will be useful in the future.
 
Guillaume

b225320

unread,
Jun 19, 2015, 10:28:03 AM6/19/15
to am...@googlegroups.com, 4...@ampl.com
a quick question related to this:

[You do need to be sure that there is no "reset" command between the solves, that no other values were assigned to the variables between the solves (using "let" statements, for instance)
does switching between named problems result in any changes to the variables that are shared between problems? e.g., "problem A; solve; problem B; solve;" - will the solver use solution A unchanged as the initial guess for B?

Robert Fourer

unread,
Jun 20, 2015, 12:40:14 PM6/20/15
to am...@googlegroups.com
Switching between problems will fix some variables and unfix others, but it will not change the values of the variables.

To be sure what values are being send to problem B, you can use some "display" commands to view the values of the variables just before the second "solve".

Bob Fourer
am...@googlegroups.com

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