Package transsys :: Module optim :: Class SimulatedAnnealer
[hide private]
[frames] | no frames]

Class SimulatedAnnealer

source code

       object --+    
                |    
AbstractOptimiser --+
                    |
                   SimulatedAnnealer

Simple Simulated Annealing tool.

The parameterisation of stepping is based on the concepts outlined in "Mathematical Optimization", with (rather major) modifications.

Instance Methods [hide private]
 
__init__(self, cooling_rate=0.995, temperature_init=None, termination_temperature=None, termination_objective=None, termination_iteration=None, stepsize_learning_rate=0.0, target_improvement_ratio=0.2, stepsize_init=1.0, stepvector_learning_rate=0.0, stepvector_learning_decay=0.0, perturbation_method=PERTURBATION_METHOD_UNIFORM, rng=None, transformer=None, randomInitRange=None, verbose=0)
Constructor.
source code
 
setPerturbationMethod(self, pMethodString)
Set the perturbation method, 'uniform' or 'gauss'.
source code
 
check_savefile_magic(self, s)
Check whether s is the "magic word" indicating the beginning of a valid save file.
source code
 
parse_variables(self, f)
Get the values of instance variables from file f.
source code
 
__str__(self)
str(x)
source code
 
verifyTermination(self)
Verify that at least one termination condition is applicable.
source code
bool
terminationCondition(self, temperature, objective, iteration)
Check whether termination condition is satisfied.
source code
 
optimise(self, transsys_program_init, objective_function, factor_name_list=None, gene_name_list=None, stepvector_init=None)
Simulated annealing optimise method.
source code

Inherited from AbstractOptimiser: initialiseParameterTransformer, parse, setRandomNumberGenerator, setRandomNumberSeed

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__

Class Variables [hide private]
  savefile_magic = 'SimulatedAnnealer-0.1'
  PERTURBATION_METHOD_UNIFORM = 1
specifies local search by perturbation of current state by uniformly distributed random values
  PERTURBATION_METHOD_GAUSS = 2
specifies local search by perturbation of current state by random values with Gaussian distribution
Instance Variables [hide private]
  cooling_rate
current temperature is multiplied by this value in each iteration.
  perturbation_method
perturbation method for local search
  stepsize_init
initial step size
  stepsize_learning_rate
learning rate for stepsize
  stepvector_learning_decay
parameter for decaying the "learned" stepvector direction by "learning" the unbiased stepvector
  stepvector_learning_rate
learning rate for updating stepvector
  target_improvement_ratio
target ratio of improvements in objective value among candidate solutions generated
  temperature_init
initial temperature.
  termination_iteration
number of iteration after which process is terminated
  termination_objective
objective function value at or below which process is terminated
  termination_temperature
temperature threshold below which the annealing process is terminated.

Inherited from AbstractOptimiser: randomInitRange, rng, transformer, verbose

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, cooling_rate=0.995, temperature_init=None, termination_temperature=None, termination_objective=None, termination_iteration=None, stepsize_learning_rate=0.0, target_improvement_ratio=0.2, stepsize_init=1.0, stepvector_learning_rate=0.0, stepvector_learning_decay=0.0, perturbation_method=PERTURBATION_METHOD_UNIFORM, rng=None, transformer=None, randomInitRange=None, verbose=0)
(Constructor)

source code 

Constructor.

Parameters:
  • rng - random number generator (see rng instance variable)
  • transformer - parameter transformer (see transformer instance variable)
  • randomInitRange - range for initialising parameters (see randomInitRange instance variable)
  • verbose - verbosity level
Overrides: object.__init__

check_savefile_magic(self, s)

source code 

Check whether s is the "magic word" indicating the beginning of a valid save file.

Overrides: AbstractOptimiser.check_savefile_magic

parse_variables(self, f)

source code 

Get the values of instance variables from file f.

Overrides: AbstractOptimiser.parse_variables

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

verifyTermination(self)

source code 

Verify that at least one termination condition is applicable.

If no termination condition is given, the annealer would run indefinitely. Notice that setting termination_objective only does constitute a termination condition but there is no guarantee that it will ever be satisfied. In contrast to this, setting termination_temperature implicitly limits the number of iterations and termination_iteration explicitly does so.

Raises:
  • StandardError - No termination condition applicable.

terminationCondition(self, temperature, objective, iteration)

source code 

Check whether termination condition is satisfied.

Returns: bool
True if termination condition is satisfied

optimise(self, transsys_program_init, objective_function, factor_name_list=None, gene_name_list=None, stepvector_init=None)

source code 

Simulated annealing optimise method.

Parameters:
  • transsys_program_init - The transsys program to be optimised. Optimisers should not modify this transsys program, modifications should be done to a copy.
  • objective_function - The objective function used to optimise the transsys program.
  • factor_name_list - factors for which parameters are to be optimised
  • gene_name_list - genes for which parameters are to be optimised
Overrides: AbstractOptimiser.optimise

Instance Variable Details [hide private]

temperature_init

initial temperature. May be set to None, in this case, the initial value is the objective function value of the transsys program to be optimised.