AMPL example for Simulate Anneal

166 views
Skip to first unread message

Tingting

unread,
Nov 17, 2016, 6:21:43 AM11/17/16
to AMPL Modeling Language
Hi.
I noticed the solver option for Simulate Anneal in ampl.  http://ampl.com/products/solvers/solvers-we-sell/localsolver/options/
I want to learn how to do that but didnt find related ampl examples.
Do you know where to find them?

Robert Fourer

unread,
Nov 18, 2016, 9:05:06 PM11/18/16
to am...@googlegroups.com
According to the documentation of SetAnnelingLevel at http://www.localsolver.com/documentation/java/localsolver/LSParam.html,

"The level must be an integer between 0 and 9. The default simulated annealing level is set to 1. If set to 0, the search heuristic is equivalent to a standard descent: moves deteriorating the current solution are rejected. By increasing this parameter, you increase the number of uphill moves (that is, moves deteriorating the objective value of the current solution): this increases chances to reach better solutions (diversification), but slows the convergence of the search."

So for example you can set

option locsol_options 'annealing_level=3';

to choose a somewhat greater percentage of uphill moves than the default. For a particular modeling application, you would have to experiment with different values to see which is best.

Bob Fourer
am...@googlegroups.com

=======

Tingting

unread,
Dec 7, 2016, 5:22:47 AM12/7/16
to AMPL Modeling Language, 4...@ampl.com
Thanks Bob:)  It works and I want to ask a bit more.
For Simulate Anneal SA, I was thinking it is an algorithm and several parameter should be particularly set for different case( initial temperature, termination criteria, cooling schedule...).
So here we can set from 1-9 to make difference. which parameter is this level 1- 9  linked to? ( initial temperature, termination criteria, cooling schedule...)
And for SA, we need an initial solution,  which will be improved (accepted or rejected with some probability) during each iteration. 
So with for example,  option locsol_options 'annealing_level=3', I can get the solution. 
Do you know how I can check the initial solution and objvalue for each interation?

Robert Fourer

unread,
Dec 7, 2016, 10:15:45 PM12/7/16
to am...@googlegroups.com
LocalSolver only provides the one "annealing level" setting. It does not give access to internal parameters of simulated annealing such as initial temperature, termination criteria, or cooling schedule. Normally termination occurs when your time limit is reached.

From AMPL you can provide an initial solution, by assigning values to the variables before the "solve". To see what is happening while LocalSolver is running, add verbosity=detailed to the locsol_options string. In the resulting listing you will see the objective value among other things.

Bob Fourer
am...@googlegroups.com

=======

From: am...@googlegroups.com [mailto:am...@googlegroups.com] On Behalf Of Tingting
Sent: Wednesday, December 7, 2016 4:23 AM
To: AMPL Modeling Language
Cc: 4...@ampl.com
Subject: Re: [AMPL 13136] AMPL example for Simulate Anneal

Thanks Bob:) It works and I want to ask a bit more.
For Simulate Anneal SA, I was thinking it is an algorithm and several parameter should be particularly set for different case( initial temperature, termination criteria, cooling schedule...).
So here we can set from 1-9 to make difference. which parameter is this level 1- 9 linked to? (initial temperature, termination criteria, cooling schedule...)
Reply all
Reply to author
Forward
0 new messages