josiann.mcsa

josiann.mcsa(fun, x0, args=None, bounds=None, moves=((0.8, [Move] RandomStep(0.05)), (0.2, [Move] RandomStep(0.5))), nb_walkers=1, max_iter=200, max_measures=20, final_acceptance_probability=1e-300, epsilon=0.01, T_0=5.0, tol=0.001, backup=False, nb_cores=0, timeout=None, seed=None, verbose=True, suppress_warnings=False, detect_convergence=True, window_size=None, dtype=<class 'numpy.float64'>)[source]

Simulated Annealing running a vectorized cost function on multiple CPU cores in parallel for computing multiple function evaluations at once.

Parameters:
  • fun (Callable[..., float]) – a <d> dimensional (noisy) function to minimize.

  • x0 (ndarray[Any, dtype[Any]]) – a <d> dimensional vector of initial values.

  • args (Optional[tuple[Any, ...]] (default: None)) – an optional sequence of arguments to pass to the function to minimize.

  • bounds (Optional[Sequence[tuple[float, float]]] (default: None)) – an optional sequence of bounds (one for each <n> dimensions) with the following format: (lower_bound, upper_bound) or a single (lower_bound, upper_bound) tuple of bounds to set for all dimensions.

  • moves (Union[Move, Sequence[Move], Sequence[tuple[float, Move]]] (default: ((0.8, [Move] RandomStep(0.05)), (0.2, [Move] RandomStep(0.5))))) –

    • a single josiann.Move object

    • a sequence of josiann.Move objects (all Moves have the same probability of being selected at

      each step for proposing a new candidate vector x)

    • a sequence of tuples with the following format(selection probability, josiann.Move)

      In this case, the selection probability dictates the probability of each Move of being selected at each step.

  • nb_walkers (int (default: 1)) – the number of parallel walkers in the ensemble.

  • max_iter (int (default: 200)) – the maximum number of iterations before stopping the algorithm.

  • max_measures (int (default: 20)) – the maximum number of function evaluations to average per step.

  • final_acceptance_probability (float (default: 1e-300)) – the targeted final acceptance probability at iteration <max_iter>.

  • epsilon (float (default: 0.01)) – parameter in (0, 1) for controlling the rate of standard deviation decrease (bigger values yield steeper descent profiles)

  • T_0 (float (default: 5.0)) – initial temperature value.

  • tol (float (default: 0.001)) – the convergence tolerance.

  • backup (bool (default: False)) – use Backup for storing previously computed function evaluations and reusing them when returning to the same position vector ? (Only available when using SetStep moves).

  • nb_cores (int (default: 0)) – number of cores that can be used to move walkers in parallel.

  • timeout (Optional[int] (default: None)) – parameter of ProcessPoolExecutor(), number of seconds to wait per process. If None, there is no limit.

  • seed (Optional[int] (default: None)) – a seed for the random generator.

  • verbose (bool (default: True)) – print progress bar ?

  • suppress_warnings (bool (default: False)) – remove warnings ?

  • detect_convergence (bool (default: True)) – run convergence detection for an early stop of the algorithm ?

  • window_size (Optional[int] (default: None)) – number of past iterations to look at for detecting the convergence, getting the best position and computing the acceptance fraction.

  • dtype (Union[float64, int64] (default: <class 'numpy.float64'>)) – the data type for the values stored in the Trace.

Return type:

Result

Returns:

A Result object.