databionics.esom.cooling
Class CachedCooling

java.lang.Object
  extended by databionics.esom.cooling.Cooling
      extended by databionics.esom.cooling.CachedCooling
Direct Known Subclasses:
CenterCooling, ExponentialCooling, LinearCooling

public abstract class CachedCooling
extends Cooling

Abstract base class for cooling of a parameter with a cache of precalculated values. Subclasses have to override the calculate(int step) method and might want to override the init() method. Make sure to call super.init() as the last command in init() to initialize the cache.


Field Summary
protected  cern.colt.matrix.DoubleMatrix1D cache
          cache with precalculated values of the parameter
protected static org.apache.log4j.Logger log
          interface to log4j system
protected  int offset
          step number of first element of cache
 
Fields inherited from class databionics.esom.cooling.Cooling
end, start, steps
 
Constructor Summary
CachedCooling()
          Create a new cooling object with default parameters start = 1.0,steps = 100,end = 0.0, size = 100
CachedCooling(double start, int steps, double end)
          Create a new cooling object with cache size equals to steps.
CachedCooling(double start, int steps, double end, int size)
          Create a new cooling object
 
Method Summary
protected  void fillCache(int offset)
          Fill the cache with precalculated values.
 double get(int step)
          Get value of parameter by the step number.
protected  void init()
          Initialize the cache
 
Methods inherited from class databionics.esom.cooling.Cooling
calculate, getAsInt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Logger log
interface to log4j system


cache

protected cern.colt.matrix.DoubleMatrix1D cache
cache with precalculated values of the parameter


offset

protected int offset
step number of first element of cache

Constructor Detail

CachedCooling

public CachedCooling()
Create a new cooling object with default parameters start = 1.0,steps = 100,end = 0.0, size = 100


CachedCooling

public CachedCooling(double start,
                     int steps,
                     double end)
Create a new cooling object with cache size equals to steps.

Parameters:
start - Initial value of the parameter
steps - Steps towards the final value of the parameter
end - Final value of the parameter

CachedCooling

public CachedCooling(double start,
                     int steps,
                     double end,
                     int size)
Create a new cooling object

Parameters:
start - Initial value of the parameter
steps - Steps towards the final value of the parameter
end - Final value of the parameter
size - Size of cache with precalculated values
Method Detail

init

protected void init()
Initialize the cache

Parameters:
offset -

fillCache

protected void fillCache(int offset)
Fill the cache with precalculated values.

Parameters:
offset -

get

public double get(int step)
Get value of parameter by the step number. If step <= 0 the initial value is returned. If step >= step-1 the final value is returned.

Overrides:
get in class Cooling
Parameters:
step - current step ([0..steps-1])
Returns:
Parameter value for this step


Copyright © 2005-2006 Databionics Research Group. All Rights Reserved.