hu.birot.OTKit.performance
Class CoolingScheduleExamples

java.lang.Object
  extended by hu.birot.OTKit.performance.CoolingScheduleExamples

public class CoolingScheduleExamples
extends java.lang.Object

This class returns instances of CoolingSchedules. Unless you write your own implementation of the CoolingSchedule interface, you will create a cooling schedule by employing one of the static methods below.


Field Summary
static double EPSILON
          A constant used to avoid errors due to inexact floating point arithmetic.
 
Constructor Summary
CoolingScheduleExamples()
           
 
Method Summary
static CoolingSchedule exponential(double t_max, double t_min, double q)
          This static method creates a CoolingSchedule for traditional simulated annealing: the real-valued temperature is reduced from t_max to (and including) t_min, each time multiplying it by q.
static CoolingSchedule exponential(double t_max, double t_min, double q, int repeat)
          This static method creates a CoolingSchedule for traditional simulated annealing: the real-valued temperature is reduced from t_max to (and including) t_min, each time multiplying it by q.
static CoolingSchedule exponentialNM(double t_max, double q, int notmoved)
          This static method creates a CoolingSchedule for traditional simulated annealing: the real-valued temperature is reduced from t_max by multiplying it by q each time, as long as the counter Temperature.unmoved has not reached notmoved.
static CoolingSchedule exponentialNM(double t_max, double q, int notmoved, int repeat)
          This static method creates a CoolingSchedule for traditional simulated annealing: the real-valued temperature is reduced from t_max by multiplying it each time by q, as long as the counter Temperature.unmoved has not reached notmoved.
static CoolingSchedule linear(double t_max, double t_min, double t_step)
          This static method creates a CoolingSchedule for traditional simulated annealing: the real-valued temperature is reduced from t_max to (and including) t_min by steps t_step.
static CoolingSchedule linear(double t_max, double t_min, double t_step, int repeat)
          This static method creates a CoolingSchedule for traditional simulated annealing: the real-valued temperature is reduced from t_max to (and including) t_min by steps t_step.
static CoolingSchedule linearNM(double t_max, double t_step, int notmoved)
          This static method creates a CoolingSchedule for traditional simulated annealing: the real-valued temperature is reduced from t_max by steps t_step, as long as the counter Temperature.unmoved has not reached notmoved.
static CoolingSchedule linearNM(double t_max, double t_step, int notmoved, int repeat)
          This static method creates a CoolingSchedule for traditional simulated annealing: the real-valued temperature is reduced from t_max by steps t_step, as long as the counter Temperature.unmoved has not reached notmoved.
static CoolingSchedule saot(double k_max, double k_min, double k_step, double t_max, double t_min, double t_step)
          This static method creates a CoolingSchedule for SA-OT style simulated annealing.
static CoolingSchedule saot(double k_max, double k_min, double k_step, double t_max, double t_min, double t_step, int repeat)
          This static method creates a CoolingSchedule for SA-OT style simulated annealing.
static CoolingSchedule saotNM(double k_max, double k_step, double t_max, double t_min, double t_step, int notmoved)
          This static method creates a CoolingSchedule for SA-OT style simulated annealing.
static CoolingSchedule saotNM(double k_max, double k_step, double t_max, double t_min, double t_step, int notmoved, int repeat)
          This static method creates a CoolingSchedule for SA-OT style simulated annealing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EPSILON

public static final double EPSILON

A constant used to avoid errors due to inexact floating point arithmetic. If the difference of two values of type double is less than EPSILON, then they are considered equal.

EPSILON = 10^(-9) = 0.000000001.

The need to use EPSILON arises whenever t_step or k_step is not an integer. In such cases the stopping condition(s) of the loop(s) can be affected by inaccuracies in floating point arithmetic.

See Also:
Constant Field Values
Constructor Detail

CoolingScheduleExamples

public CoolingScheduleExamples()
Method Detail

linear

public static CoolingSchedule linear(double t_max,
                                     double t_min,
                                     double t_step)
This static method creates a CoolingSchedule for traditional simulated annealing: the real-valued temperature is reduced from t_max to (and including) t_min by steps t_step.

Method CoolingSchedule.initial will return t_max, method CoolingSchedule.next(t) will return t-t_step, and method CoolingSchedule.stop(t) will return true only if t < t_min.

Parameters:
t_max - : Initial temperature.
t_min - : Final temperature.
t_step - : Steps for decreasing the temperature (linearly).
Returns:
The CoolingSchedule object implementing what has just been described.

linear

public static CoolingSchedule linear(double t_max,
                                     double t_min,
                                     double t_step,
                                     int repeat)
This static method creates a CoolingSchedule for traditional simulated annealing: the real-valued temperature is reduced from t_max to (and including) t_min by steps t_step.

Method CoolingSchedule.initial will return t_max, method CoolingSchedule.next(t) will return t-t_step, and method CoolingSchedule.stop(t) will return true only if t < t_min. Additionally, the same value of the temperature is used repeat number of times (that is, the counter of the temperature is decreased, instead of the temperature itself).

Parameters:
t_max - : Initial temperature.
t_min - : Final temperature.
t_step - : Steps for decreasing the temperature (linearly).
repeat - : The number of iterations per value of temperature (must be a positive integer, otherwise you may get infinite loops and other troubles).
Returns:
The CoolingSchedule object implementing what has just been described.

exponential

public static CoolingSchedule exponential(double t_max,
                                          double t_min,
                                          double q)
This static method creates a CoolingSchedule for traditional simulated annealing: the real-valued temperature is reduced from t_max to (and including) t_min, each time multiplying it by q.

Method CoolingSchedule.initial will return t_max, method CoolingSchedule.next(t) will return temperature q*t, and method CoolingSchedule.stop(t) will return true only if t < t_min.

Parameters:
t_max - : Initial temperature.
t_min - : Final temperature.
q - : Steps for decreasing the temperature (exponentially).
Returns:
The CoolingSchedule object implementing what has just been described.

exponential

public static CoolingSchedule exponential(double t_max,
                                          double t_min,
                                          double q,
                                          int repeat)
This static method creates a CoolingSchedule for traditional simulated annealing: the real-valued temperature is reduced from t_max to (and including) t_min, each time multiplying it by q.

Method CoolingSchedule.initial will return t_max, method CoolingSchedule.next(t) will return q*t, and method CoolingSchedule.stop(t) will return true only if t < t_min. Additionally, the same value of the temperature is used repeat number of times (that is, the counter of the temperature is decreased, instead of the temperature itself).

Parameters:
t_max - : Initial temperature.
t_min - : Final temperature.
q - : Steps for decreasing the temperature (exponentially).
repeat - : The number of iterations per value of temperature (must be a positive integer, otherwise you may get infinite loops and other troubles).
Returns:
The CoolingSchedule object implementing what has just been described.

saot

public static CoolingSchedule saot(double k_max,
                                   double k_min,
                                   double k_step,
                                   double t_max,
                                   double t_min,
                                   double t_step,
                                   int repeat)
This static method creates a CoolingSchedule for SA-OT style simulated annealing. The SA-OT style temperature is reduced by the external loop k_max to k_min via steps k_step, within which is embedded another loop runing from t_max to t_min via steps t_step. NB: t_min is not reached during decreasing, but k_min is reached. For each T = value of the temperature, an innermost loop repeats the core of the loop repeat times. (If repeat is omitted, then its value is set to 1 by default.)

Method CoolingSchedule.initial will return t_max, method CoolingSchedule.next(t) will return t-t_step, and method CoolingSchedule.stop(t) will return true only if K < k_min. Additionally, the same value of the temperature is used repeat number of times (that is, the counter of the temperature is decreased, instead of the temperature itself).

Note that while the internal loop does not reach t_min, the external loop does reach k_min.

Parameters:
k_max - : Initial temperature range in the external loop.
k_min - : Final temperature range in the external loop.
k_step - : Steps for decreasing the temperature range in the external loop.
t_max - : Initial temperature in the internal loop.
t_min - : Final temperature in the internal loop is higher than t_min.
t_step - : Steps for decreasing the temperature in the internal loop.
repeat - : The number of iterations per value of temperature (must be a positive integer, otherwise you may get infinite loops and other troubles). Optional.
Returns:
The CoolingSchedule object implementing what has just been described.

saot

public static CoolingSchedule saot(double k_max,
                                   double k_min,
                                   double k_step,
                                   double t_max,
                                   double t_min,
                                   double t_step)
This static method creates a CoolingSchedule for SA-OT style simulated annealing. The SA-OT style temperature is reduced by the external loop k_max to k_min via steps k_step, within which is embedded another loop runing from t_max to t_min via steps t_step. NB: t_min is not reached during decreasing, but k_min is reached.

Method CoolingSchedule.initial will return t_max, method CoolingSchedule.next(t) will return t-t_step, and method CoolingSchedule.stop(t) will return true only if t < t_min. Additionally, the same value of the temperature is used repeat number of times (that is, the counter of the temperature is decreased, instead of the temperature itself).

Note that while the internal loop does not reach t_min, the external loop does reach k_min.

Parameters:
k_max - : Initial temperature range in the external loop.
k_min - : Final temperature range in the external loop.
k_step - : Steps for decreasing the temperature range in the external loop.
t_max - : Initial temperature in the internal loop.
t_min - : Final temperature in the internal loop is higher than t_min.
t_step - : Steps for decreasing the temperature in the internal loop.
Returns:
The CoolingSchedule object implementing what has just been described.

linearNM

public static CoolingSchedule linearNM(double t_max,
                                       double t_step,
                                       int notmoved)
This static method creates a CoolingSchedule for traditional simulated annealing: the real-valued temperature is reduced from t_max by steps t_step, as long as the counter Temperature.unmoved has not reached notmoved.

Method CoolingSchedule.initial will return t_max, method CoolingSchedule.next(t) will return t-t_step, and method CoolingSchedule.stop(t) will return true only if t < t_min.

Parameters:
t_max - : Initial temperature.
t_step - : Steps for decreasing the temperature.
notmoved - : The value that the counter has to reach.
Returns:
The CoolingSchedule object implementing what has just been described.

linearNM

public static CoolingSchedule linearNM(double t_max,
                                       double t_step,
                                       int notmoved,
                                       int repeat)
This static method creates a CoolingSchedule for traditional simulated annealing: the real-valued temperature is reduced from t_max by steps t_step, as long as the counter Temperature.unmoved has not reached notmoved.

Method CoolingSchedule.initial will return t_max, method CoolingSchedule.next(t) will return t-t_step, and method CoolingSchedule.stop(t) will return true only if t < t_min. Additionally, the same value of the temperature is used repeat number of times (that is, the counter of the temperature is decreased, instead of the temperature itself).

Parameters:
t_max - : Initial temperature.
t_step - : Steps for decreasing the temperature.
notmoved - : The value that the counter has to reach.
repeat - : The number of iterations per value of temperature (must be a positive integer, otherwise you may get infinite loops and other troubles).
Returns:
The CoolingSchedule object implementing what has just been described.

exponentialNM

public static CoolingSchedule exponentialNM(double t_max,
                                            double q,
                                            int notmoved)
This static method creates a CoolingSchedule for traditional simulated annealing: the real-valued temperature is reduced from t_max by multiplying it by q each time, as long as the counter Temperature.unmoved has not reached notmoved.

Method CoolingSchedule.initial will return t_max, method CoolingSchedule.next(t) will return t-t_step, and method CoolingSchedule.stop(t) will return true only if t < t_min.

Parameters:
t_max - : Initial temperature.
q - : Steps for decreasing the temperature exponentially.
notmoved - : The value that the counter has to reach.
Returns:
The CoolingSchedule object implementing what has just been described.

exponentialNM

public static CoolingSchedule exponentialNM(double t_max,
                                            double q,
                                            int notmoved,
                                            int repeat)
This static method creates a CoolingSchedule for traditional simulated annealing: the real-valued temperature is reduced from t_max by multiplying it each time by q, as long as the counter Temperature.unmoved has not reached notmoved.

Method CoolingSchedule.initial will return t_max, method CoolingSchedule.next(t) will return t-t_step, and method CoolingSchedule.stop(t) will return true only if t < t_min. Additionally, the same value of the temperature is used repeat number of times (that is, the counter of the temperature is decreased, instead of the temperature itself).

Parameters:
t_max - : Initial temperature.
q - : Steps for decreasing the temperature exponentially.
notmoved - : The value that the counter has to reach.
repeat - : The number of iterations per value of temperature (must be a positive integer, otherwise you may get infinite loops and other troubles).
Returns:
The CoolingSchedule object implementing what has just been described.

saotNM

public static CoolingSchedule saotNM(double k_max,
                                     double k_step,
                                     double t_max,
                                     double t_min,
                                     double t_step,
                                     int notmoved,
                                     int repeat)
This static method creates a CoolingSchedule for SA-OT style simulated annealing. The SA-OT style temperature is reduced by the external loop from k_max via steps of k_step, within which is embedded another loop running from t_max to t_min via steps t_step. The external loop goes as long as the counter Temperature.unmoved has not reached notmoved. NB: t_min is not reached during decreasing. For each T = value of the temperature, an innermost loop repeats the middle of the loop repeat times. (If repeat is omitted, then its value is set to 1 by default.)

Method CoolingSchedule.initial will return t_max, method CoolingSchedule.next(t) will return t-t_step, and method CoolingSchedule.stop(t) will return true only if t < t_min. Additionally, the same value of the temperature is used repeat number of times (that is, the counter of the temperature is decreased, instead of the temperature itself).

Parameters:
k_max - : Initial temperature range in the external loop.
k_step - : Steps for decreasing the temperature range in the external loop.
t_max - : Initial temperature in the internal loop.
t_min - : Final temperature in the internal loop.
t_step - : Steps for decreasing the temperature in the internal loop.
notmoved - : The value that the counter has to reach.
repeat - : The number of iterations per value of temperature (must be a positive integer, otherwise you may get infinite loops and other troubles). Optional.
Returns:
The CoolingSchedule object implementing what has just been described.

saotNM

public static CoolingSchedule saotNM(double k_max,
                                     double k_step,
                                     double t_max,
                                     double t_min,
                                     double t_step,
                                     int notmoved)
This static method creates a CoolingSchedule for SA-OT style simulated annealing. The SA-OT style temperature is reduced by the external loop from k_max via steps of k_step, within which is embedded another loop running from t_max to t_min via steps t_step. The external loop goes as long as the counter Temperature.unmoved has not reached notmoved. NB: t_min is not reached during decreasing.

Method CoolingSchedule.initial will return t_max, method CoolingSchedule.next(t) will return t-t_step, and method CoolingSchedule.stop(t) will return true only if t < t_min. Additionally, the same value of the temperature is used repeat number of times (that is, the counter of the temperature is decreased, instead of the temperature itself).

Parameters:
k_max - : Initial temperature range in the external loop.
k_step - : Steps for decreasing the temperature range in the external loop.
t_max - : Initial temperature in the internal loop.
t_min - : Final temperature in the internal loop.
t_step - : Steps for decreasing the temperature in the internal loop.
notmoved - : The value that the counter has to reach.
Returns:
The CoolingSchedule object implementing what has just been described.