|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.mrami.libre.annealing.Annealer
Runs a simulated annealing session over an Annealable object.
Simulated annealing is designed to work like annealing in the real world: the more slowly you lower the temperature of a liquid as it freezes, the more likely the resulting solid will have larger crystals (which in turn means a lower total energy configuration).
With simulated annealing, we are basically doing the same thing. Lowering the "temperature" slowly lowers the probability that we have a "high-energy" configuration. The fact that high-energy configurations can exist means that we are more likely not to get shoehorned into a local minimum.
For reference, check any material on simulated annealing. My thanks to "Numerical Recipes in C" for the basic algorithm here.
| Constructor Summary | |
Annealer(double startTemp,
int itersPerTemp,
int tempSteps,
double stepPercent)
Set up the annealer. |
|
| Method Summary | |
Annealable |
anneal(Annealable start,
java.io.PrintWriter outStream)
Anneal an annealable. |
int |
getItersPerTemp()
|
double |
getStartTemp()
|
double |
getStepPercent()
|
int |
getTempSteps()
|
protected boolean |
metropolis(double temp,
double delta)
The metropolis algorithm. |
void |
setItersPerTemp(int itersPerTemp)
|
void |
setStartTemp(double startTemp)
|
void |
setStepPercent(double stepPercent)
|
void |
setTempSteps(int tempSteps)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Annealer(double startTemp,
int itersPerTemp,
int tempSteps,
double stepPercent)
startTemp - start temperatureitersPerTemp - iterations before lowering the temperaturetempSteps - number of times to lower the temperaturestepPercent - percentage to decrease the temp per lowering (i.e., newTemp =
oldTemp * stepPercent)| Method Detail |
public int getItersPerTemp()
public void setItersPerTemp(int itersPerTemp)
itersPerTemp - The itersPerTemp to set.public double getStartTemp()
public void setStartTemp(double startTemp)
startTemp - The startTemp to set.public double getStepPercent()
public void setStepPercent(double stepPercent)
stepPercent - The stepPercent to set.public int getTempSteps()
public void setTempSteps(int tempSteps)
tempSteps - The tempSteps to set.
public Annealable anneal(Annealable start,
java.io.PrintWriter outStream)
start parameter will be modified.
start - the start configuration (WILL BE MODIFIED)outStream - output stream to send log messages to (or null)
start)
protected boolean metropolis(double temp,
double delta)
temp - the current temperaturedelta - the cost difference between old configuration and new
configuration
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||