Skip to content

smcopt⚓︎

Stochastic Monte-Carlo optimization compatible with OptimizerBase.

SmcOpt ⚓︎

Bases: OptimizerBase

Sequential Monte-Carlo optimizer with resampling and backtracking.

obj_func_values ⚓︎

Legacy alias for fk.

__init__(x0, fun, sens=None, args=(), bounds=None, callback=None, **options) ⚓︎

Parameters:

Name Type Description Default
x0 ndarray

Initial state

required
fun callable

objective function

required
sens callable

Ensemble sensitivity function

None
args tuple

Initial covariance tuple where args[0] is the covariance matrix used for sampling.

()
bounds list

(min, max) pairs for each element in x. None is used to specify no bound.

None
callback callable

Callback invoked after successful updates.

None
options dict

SmcOpt configuration, plus everything :class:OptimizerBase takes (transform is forced off: SmcOpt works in physical coordinates).

  • tol: convergence tolerance for the objective function (default 1e-6). Also used as ftol when given.
  • alpha: weight between previous and new step (default 0.1)
  • alpha_maxiter: maximum number of backtracking trials (default 5)
  • resample: number indicating how many times resampling is tried if no improvement is found
  • cov_factor: factor used to shrink the covariance for each resampling trial (default 0.5)
  • inflation_factor: term used to weight down prior influence (default 1.0)
  • survival_factor: fraction of surviving samples (clipped to [0.1, 1.0])
  • best_func: best objective value seen before this run (default: the initial objective)
  • savefolder/save_folder: folder used when saveit is true (default './')
{}

log_columns() ⚓︎

The row of the iteration log: iteration, backtracking attempts, objective, best objective seen, step size.

update_step() ⚓︎

Perform one SMC update step with backtracking and optional resampling.