net.sourceforge.jannealer
Class AnnealingScheme

java.lang.Object
  |
  +--net.sourceforge.jannealer.AnnealingScheme

public class AnnealingScheme
extends java.lang.Object

Implements downhill simplex simulated annealing algorithm

Since:
October 17, 2001

Field Summary
protected  double coolingRate
           
static double DEFAULTCOOLINGRATE
           
static int DEFAULTITERATIONS
           
static double DEFAULTOLERANCE
           
static double DEFAULTTEMP
          default temperature
protected  ObjectiveFunction function
           
protected  int nIterations
           
protected  double[] offset
           
protected  double temperature
           
protected  double tolerance
           
 
Constructor Summary
AnnealingScheme()
           
 
Method Summary
 void anneal()
          runs an annealing, call getOffset() to get result
protected  ObjectiveFunction getFunction()
           
protected  int getMaxIterations()
           
 double[] getSolution()
           
 void setCoolingRate(double coolingRate)
          Sets the CoolingRate attribute of the AnnealingScheme object
 void setFunction(ObjectiveFunction function)
           
 void setIterations(int nIterations)
          Number of iterations before cooling is applied
protected  void setOffsetFromSimplex(double[] t)
           
 void setSolution(double[] offset)
          Sets a starting point for searching for a solution
 void setTemperature(double temperature)
          Sets the Temperature attribute of the AnnealingScheme object
 void setTolerance(double tolerance)
          Sets the Tolerance attribute of the AnnealingScheme object.
protected  void simplex()
          finds a solution using downhill simplex.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

temperature

protected double temperature

coolingRate

protected double coolingRate

nIterations

protected int nIterations

offset

protected double[] offset

tolerance

protected double tolerance

function

protected ObjectiveFunction function

DEFAULTTEMP

public static final double DEFAULTTEMP
default temperature

DEFAULTCOOLINGRATE

public static final double DEFAULTCOOLINGRATE

DEFAULTITERATIONS

public static final int DEFAULTITERATIONS

DEFAULTOLERANCE

public static final double DEFAULTOLERANCE
Constructor Detail

AnnealingScheme

public AnnealingScheme()
Method Detail

setTemperature

public void setTemperature(double temperature)
Sets the Temperature attribute of the AnnealingScheme object
Parameters:
temperature - The new Temperature value

setTolerance

public void setTolerance(double tolerance)
Sets the Tolerance attribute of the AnnealingScheme object. The annealing stops once the return values from the ObjectiveFunction varies by less than the tolerance.
Parameters:
tolerance - The new Tolerance value

setSolution

public void setSolution(double[] offset)
Sets a starting point for searching for a solution
Parameters:
offset - The new Offset value. To reduce API tripwires, the offset is duplicated, i.e. the caller can safely modify the passed in offset it afterwards.

setCoolingRate

public void setCoolingRate(double coolingRate)
Sets the CoolingRate attribute of the AnnealingScheme object
Parameters:
coolingRate - The new CoolingRate value

setIterations

public void setIterations(int nIterations)
Number of iterations before cooling is applied
Parameters:
nIterations - The new NIterations value

getSolution

public double[] getSolution()
Returns:
list of currently best solution. This is a duplicate array that the caller "owns"

getFunction

protected ObjectiveFunction getFunction()
Returns:
ObjectiveFunction object

setFunction

public void setFunction(ObjectiveFunction function)
Parameters:
function -  

anneal

public void anneal()
runs an annealing, call getOffset() to get result

setOffsetFromSimplex

protected void setOffsetFromSimplex(double[] t)

simplex

protected void simplex()
finds a solution using downhill simplex. This is work in progress.

getMaxIterations

protected int getMaxIterations()
Returns:
Override to set maximum number of iterations