Package org.opt4j.optimizer.sa
Class CoolingScheduleLinear
java.lang.Object
org.opt4j.optimizer.sa.CoolingScheduleLinear
- All Implemented Interfaces:
CoolingSchedule
- Direct Known Subclasses:
CoolingScheduleDefault
The CoolingScheduleLinear is a CoolingSchedule for the
SimulatedAnnealing.
tn - final temperature
t0 - initial temperature
i - current iteration
n - maximal number of iterations
a - alpha value
The current temperature is calculated by t0 - (t0 - tn)*(i/n).
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCoolingScheduleLinear(double t0, double tn) Constructs a newCoolingScheduleLinear. -
Method Summary
Modifier and TypeMethodDescriptiondoublegetTemperature(int i, int n) Returns the temperature for the iterationiof the maximal number of iterationsn.
-
Field Details
-
t0
protected final double t0 -
tn
protected final double tn
-
-
Constructor Details
-
CoolingScheduleLinear
@Inject public CoolingScheduleLinear(double t0, double tn) Constructs a newCoolingScheduleLinear.- Parameters:
t0- the initial temperature (using namespaceCoolingSchedule)tn- the final temperature (using namespaceCoolingSchedule)
-
-
Method Details
-
getTemperature
public double getTemperature(int i, int n) Description copied from interface:CoolingScheduleReturns the temperature for the iterationiof the maximal number of iterationsn.- Specified by:
getTemperaturein interfaceCoolingSchedule- Parameters:
i- the current iterationn- the maximal number of iterations- Returns:
- the temperature for the current iteration
-