Class VariableAnnealingLength
- All Implemented Interfaces:
Splittable<RestartSchedule>
,RestartSchedule
The VAL restart schedule starts with a short run, and increases run length exponentially across restarts. Specifically, define ri as the run length for run i, with the following: ri = 1000 * 2i. For simulated annealing, run length is number of evaluations (i.e., iterations of the simulated annealing main loop). You can compute the sequence of run lengths incrementally with r0 = 1000 and ri = 2ri-1. The first few run lengths in the sequence are: 1000, 2000, 4000, ....
The VAL restart schedule was introduced in:
Vincent A. Cicirello. "Variable Annealing Length and Parallelism in Simulated Annealing." In
Proceedings of the Tenth International Symposium on Combinatorial Search (SoCS 2017),
pages 2-10. AAAI Press, June 2017. doi:10.1609/socs.v8i1.18424. [PDF] [BIB]
This class supports both the original schedule as defined above, as well as including a parameter to specify the initial run length r0 as something other than 1000. In this case, the subsequent run lengths are still twice the previous. For example, if you start r0 = 50, then the run lengths will follow the sequence: 50, 100, 200, 400, ....
Although not originally stated in the paper that proposed this restart schedule, this implementation converges to a constant restart length of Integer.MAX_VALUE if the next run length of the schedule would otherwise exceed the maximum positive 32-bit integer value.
-
Constructor Summary
ConstructorDescriptionThe default constructor constructs the original Variable Annealing Length (VAL) restart schedule of: Vincent A.VariableAnnealingLength
(int r0) This constructor enables specifying the initial run length for the first run. -
Method Summary
Modifier and TypeMethodDescriptionstatic List<VariableAnnealingLength>
createRestartSchedules
(int numThreads) This is a convenience method for use in generating several identical VAL annealing schedules, such as if needed for a parallel search.static List<VariableAnnealingLength>
createRestartSchedules
(int numThreads, int r0) This is a convenience method for use in generating several identical VAL annealing schedules, such as if needed for a parallel search.int
Gets the next run length in the restart schedule's sequence of run lengths.void
reset()
Resets the restart schedule to its initial conditions, such that the next call toRestartSchedule.nextRunLength()
will return the initial run length of the schedule.split()
Generates a functionally identical copy of this object, for use in multithreaded implementations of search algorithms.
-
Constructor Details
-
VariableAnnealingLength
public VariableAnnealingLength()The default constructor constructs the original Variable Annealing Length (VAL) restart schedule of: Vincent A. Cicirello. "Variable Annealing Length and Parallelism in Simulated Annealing." In Proceedings of the Tenth International Symposium on Combinatorial Search (SoCS 2017), pages 2-10. AAAI Press, June 2017. Specifically, the initial run length is 1000, and each subsequent run length is twice the previous. -
VariableAnnealingLength
public VariableAnnealingLength(int r0) This constructor enables specifying the initial run length for the first run. Subsequent runs otherwise follow the original schedule and are twice the length of the previous run. This restart schedule originated with simulated annealing, but when used with other metaheuristics it may be desirable to either increase or decrease the initial run length from what was originally used.- Parameters:
r0
- The initial run length for the first run.
-
-
Method Details
-
nextRunLength
public int nextRunLength()Description copied from interface:RestartSchedule
Gets the next run length in the restart schedule's sequence of run lengths.- Specified by:
nextRunLength
in interfaceRestartSchedule
- Returns:
- the length for the next run of a multistart metaheuristic
-
reset
public void reset()Description copied from interface:RestartSchedule
Resets the restart schedule to its initial conditions, such that the next call toRestartSchedule.nextRunLength()
will return the initial run length of the schedule.- Specified by:
reset
in interfaceRestartSchedule
-
split
Description copied from interface:Splittable
Generates a functionally identical copy of this object, for use in multithreaded implementations of search algorithms. The state of the object that is returned may or may not be identical to that of the original. Thus, this is a distinct concept from the functionality of theCopyable
interface. Classes that implement this interface must ensure that the object returned performs the same functionality, and that it does not share any state data that would be either unsafe or inefficient for concurrent access by multiple threads. The split method is allowed to simply return the this reference, provided that it is both safe and efficient for multiple threads to share a single copy of the Splittable object. The intention is to provide a multithreaded search with the capability to provide spawned threads with their own distinct search operators. Such multithreaded algorithms can call the split method for each thread it spawns to generate a functionally identical copy of the operator, but with independent state.- Specified by:
split
in interfaceSplittable<RestartSchedule>
- Returns:
- A functionally identical copy of the object, or a reference to this if it is both safe and efficient for multiple threads to share a single instance of this Splittable object.
-
createRestartSchedules
This is a convenience method for use in generating several identical VAL annealing schedules, such as if needed for a parallel search. All of the annealing schedules in the returned list are identical, but are independent (no shared state). This does NOT give you the P-VAL schedule (seeParallelVariableAnnealingLength
for the P-VAL schedule).The list that is returned is of the size of the requested number of threads. This should correspond to the number of parallel instances of the search you intend to execute.
- Parameters:
numThreads
- The number of parallel instances of the search.- Returns:
- A list of numThreads identical VAL restart schedules.
- Throws:
IllegalArgumentException
- if numThreads ≤ 0.
-
createRestartSchedules
This is a convenience method for use in generating several identical VAL annealing schedules, such as if needed for a parallel search. All of the annealing schedules in the returned list are identical, but are independent (no shared state). This does NOT give you the P-VAL schedule (seeParallelVariableAnnealingLength
for the P-VAL schedule).The list that is returned is of the size of the requested number of threads. This should correspond to the number of parallel instances of the search you intend to execute.
- Parameters:
numThreads
- The number of parallel instances of the search.r0
- The initial run length for the first run.- Returns:
- A list of numThreads identical VAL restart schedules.
- Throws:
IllegalArgumentException
- if numThreads ≤ 0.
-