savi.alg
Class SimAnnealingBasicSolver

java.lang.Object
  extended by savi.alg.SimAnnealingSkeleton
      extended by savi.alg.SimAnnealingBasicSolver
Direct Known Subclasses:
SimAnnealingStepSolver

public class SimAnnealingBasicSolver
extends SimAnnealingSkeleton

First instance of SimAnnealingSkeleton, basic class for solving with simulated annealing algorithm. Solving cannot be stepped.


Field Summary
 
Fields inherited from class savi.alg.SimAnnealingSkeleton
coolFactor, finalTemp, state, temp
 
Constructor Summary
SimAnnealingBasicSolver(StateSkeleton s, double temp, double finalTemp, double coolFactor, int equilibSteps)
          Standard constructor for simulated annealing algorithm with all needed parameters, creates a new instance of SimAnnealingBasicSolver.
 
Method Summary
protected  void cool()
          Call this function lowers current temperature.
protected  void equilibrium()
          Do iteration of equilibrium cycle with constant temperature.
static double findOptimalStartTemp(StateSkeleton s, int equilibSteps)
          This method is able to find and return starting temp.
protected  boolean frozen()
          This function can be called to recognition end of algorithm run.
 StateSkeleton solve()
          Finish and solve the problem.
 
Methods inherited from class savi.alg.SimAnnealingSkeleton
getState, getTemp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimAnnealingBasicSolver

public SimAnnealingBasicSolver(StateSkeleton s,
                               double temp,
                               double finalTemp,
                               double coolFactor,
                               int equilibSteps)
Standard constructor for simulated annealing algorithm with all needed parameters, creates a new instance of SimAnnealingBasicSolver.

Parameters:
s - Initial state
temp - Starting temperature value
finalTemp - Final temperature value.
coolFactor - Cooling factor
equilibSteps - Number of steps in equilibrium.
Method Detail

findOptimalStartTemp

public static double findOptimalStartTemp(StateSkeleton s,
                                          int equilibSteps)
This method is able to find and return starting temp.

Parameters:
s - State
equilibSteps - Number of steps in equilibrium.
Returns:
Founded starting temperature

cool

protected void cool()
Call this function lowers current temperature.

Specified by:
cool in class SimAnnealingSkeleton

equilibrium

protected void equilibrium()
Do iteration of equilibrium cycle with constant temperature.

Specified by:
equilibrium in class SimAnnealingSkeleton

frozen

protected boolean frozen()
This function can be called to recognition end of algorithm run.

Specified by:
frozen in class SimAnnealingSkeleton
Returns:
Return true if algorithm finished (current temperature is below final temperature).

solve

public StateSkeleton solve()
Finish and solve the problem.

Specified by:
solve in class SimAnnealingSkeleton
Returns:
Final state