Package pipe_control :: Module minimise
[hide private]
[frames] | no frames]

Module minimise

source code

Module for model minimisation/optimisation.

Functions [hide private]
list of numpy rank-2, float64 array or list of None
assemble_scaling_matrix(scaling=True)
Create and return the per-model scaling matrices.
source code
 
calc(verbosity=1)
Function for calculating the function value.
source code
 
grid_search(lower=None, upper=None, inc=None, verbosity=1, constraints=True, skip_preset=True)
The grid search function.
source code
tuple of lists of lists of float, lists of lists of float, list of lists of int
grid_setup(lower=None, upper=None, inc=None, verbosity=1, skip_preset=True)
Determine the per-model grid bounds, allowing for the zooming grid search.
source code
 
grid_zoom(level=0)
Store the grid zoom level.
source code
 
minimise(min_algor=None, line_search=None, hessian_mod=None, hessian_type=None, func_tol=None, grad_tol=None, max_iter=None, constraints=True, scaling=True, verbosity=1, sim_index=None)
Minimisation function.
source code
 
reset_min_stats(data_pipe=None, sim_index=None, verbosity=1)
Function for resetting all minimisation statistics.
source code
 
set(val=None, error=None, param=None, scaling=None, spin_id=None)
Set global or spin specific minimisation parameters.
source code
Variables [hide private]
  status = Status()
  uf_tables = Uf_tables()
  __package__ = 'pipe_control'

Imports: float64, identity, sys, RelaxError, RelaxIntListIntError, RelaxLenError, isNaN, write_data, Processor_box, return_spin, spin_loop, pipes, check_pipe, return_api, return_parameter_object, Status, Uf_tables


Function Details [hide private]

assemble_scaling_matrix(scaling=True)

source code 

Create and return the per-model scaling matrices.

Parameters:
  • scaling (bool) - If True, diagonal scaling is enabled during optimisation to allow the problem to be better conditioned.
Returns: list of numpy rank-2, float64 array or list of None
The list of diagonal and square scaling matrices.

calc(verbosity=1)

source code 

Function for calculating the function value.

Parameters:
  • verbosity (int) - The amount of information to print. The higher the value, the greater the verbosity.

grid_search(lower=None, upper=None, inc=None, verbosity=1, constraints=True, skip_preset=True)

source code 

The grid search function.

Parameters:
  • lower (array of numbers) - The lower bounds of the grid search which must be equal to the number of parameters in the model.
  • upper (array of numbers) - The upper bounds of the grid search which must be equal to the number of parameters in the model.
  • inc (int or list of int) - The increments for each dimension of the space for the grid search. The number of elements in the array must equal to the number of parameters in the model.
  • verbosity (int) - The amount of information to print. The higher the value, the greater the verbosity.
  • constraints (bool) - If True, constraints are applied during the grid search (elinating parts of the grid). If False, no constraints are used.
  • skip_preset (bool) - This argument, when True, allows any parameter which already has a value set to be skipped in the grid search.

grid_setup(lower=None, upper=None, inc=None, verbosity=1, skip_preset=True)

source code 

Determine the per-model grid bounds, allowing for the zooming grid search.

Parameters:
  • lower (list of numbers) - The user supplied lower bounds of the grid search which must be equal to the number of parameters in the model.
  • upper (list of numbers) - The user supplied upper bounds of the grid search which must be equal to the number of parameters in the model.
  • inc (int or list of int) - The user supplied grid search increments.
  • verbosity (int) - The amount of information to print. The higher the value, the greater the verbosity.
  • skip_preset (bool) - This argument, when True, allows any parameter which already has a value set to be skipped in the grid search.
Returns: tuple of lists of lists of float, lists of lists of float, list of lists of int
The per-model grid upper and lower bounds. The first dimension of each structure corresponds to the model, the second the model parameters.

grid_zoom(level=0)

source code 

Store the grid zoom level.

Parameters:
  • level (int) - The zoom level.

minimise(min_algor=None, line_search=None, hessian_mod=None, hessian_type=None, func_tol=None, grad_tol=None, max_iter=None, constraints=True, scaling=True, verbosity=1, sim_index=None)

source code 

Minimisation function.

Parameters:
  • min_algor (str) - The minimisation algorithm to use.
  • line_search (str or None) - The line search algorithm which will only be used in combination with the line search and conjugate gradient methods. This will default to the More and Thuente line search.
  • hessian_mod (str or None) - The Hessian modification. This will only be used in the algorithms which use the Hessian, and defaults to Gill, Murray, and Wright modified Cholesky algorithm.
  • hessian_type (str or None) - The Hessian type. This will only be used in a few trust region algorithms, and defaults to BFGS.
  • func_tol (None or float) - The function tolerance which, when reached, terminates optimisation. Setting this to None turns of the check.
  • grad_tol (None or float) - The gradient tolerance which, when reached, terminates optimisation. Setting this to None turns of the check.
  • max_iter (int) - The maximum number of iterations for the algorithm.
  • constraints (bool) - If True, constraints are used during optimisation.
  • scaling (bool) - If True, diagonal scaling is enabled during optimisation to allow the problem to be better conditioned.
  • verbosity (int) - The amount of information to print. The higher the value, the greater the verbosity.
  • sim_index (None or int) - The index of the simulation to optimise. This should be None if normal optimisation is desired.

reset_min_stats(data_pipe=None, sim_index=None, verbosity=1)

source code 

Function for resetting all minimisation statistics.

Parameters:
  • data_pipe (str) - The name of the data pipe to reset the minimisation statistics of. This defaults to the current data pipe.
  • sim_index (int) - The optional Monte Carlo simulation index.
  • verbosity (int) - The amount of information to print. The higher the value, the greater the verbosity.

set(val=None, error=None, param=None, scaling=None, spin_id=None)

source code 

Set global or spin specific minimisation parameters.

Parameters:
  • val (number) - The parameter values.
  • param (str) - The parameter names.
  • scaling (float) - Unused.
  • spin_id (str) - The spin identification string.