josiann.parallel.psa

josiann.parallel.psa(fun, x0, parallel_args=None, args=None, bounds=None, moves=[Move] ParallelSetStep([array([-1.0000e+00, -9.0000e-01, -8.0000e-01, -7.0000e-01, -6.0000e-01, -5.0000e-01, -4.0000e-01, -3.0000e-01, -2.0000e-01, -1.0000e-01, -2.2204e-16, 1.0000e-01, 2.0000e-01, 3.0000e-01, 4.0000e-01, 5.0000e-01, 6.0000e-01, 7.0000e-01, 8.0000e-01, 9.0000e-01, 1.0000e+00]), array([-1.0000e+00, -9.0000e-01, -8.0000e-01, -7.0000e-01, -6.0000e-01, -5.0000e-01, -4.0000e-01, -3.0000e-01, -2.0000e-01, -1.0000e-01, -2.2204e-16, 1.0000e-01, 2.0000e-01, 3.0000e-01, 4.0000e-01, 5.0000e-01, 6.0000e-01, 7.0000e-01, 8.0000e-01, 9.0000e-01, 1.0000e+00])]), max_iter=200, max_measures=20, final_acceptance_probability=1e-300, epsilon=0.01, T_0=5.0, tol=0.001, backup=False, seed=None, verbose=True, leave_progress_bar=True, suppress_warnings=False, detect_convergence=True, window_size=None, dtype=<class 'numpy.float64'>)[source]

Simulated Annealing algorithm solving multiple problems in parallel.

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

  • x0 (ndarray[Any, dtype[Any]]) – a matrix of <d> dimensional vectors of initial values, one per parallel problem.

  • parallel_args (Optional[Sequence[ndarray[Any, dtype[Any]]]] (default: None)) – an optional sequence of arrays (of size equal to the number of parallel problems) of arguments to pass to the vectorized function to minimize. Parallel arguments are passed before other arguments.

  • 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[ParallelMove, Sequence[ParallelMove], Sequence[tuple[float, ParallelMove]]] (default: [Move] ParallelSetStep([array([-1.0000e+00, -9.0000e-01, -8.0000e-01, -7.0000e-01, -6.0000e-01,        -5.0000e-01, -4.0000e-01, -3.0000e-01, -2.0000e-01, -1.0000e-01,        -2.2204e-16,  1.0000e-01,  2.0000e-01,  3.0000e-01,  4.0000e-01,         5.0000e-01,  6.0000e-01,  7.0000e-01,  8.0000e-01,  9.0000e-01,         1.0000e+00]), array([-1.0000e+00, -9.0000e-01, -8.0000e-01, -7.0000e-01, -6.0000e-01,        -5.0000e-01, -4.0000e-01, -3.0000e-01, -2.0000e-01, -1.0000e-01,        -2.2204e-16,  1.0000e-01,  2.0000e-01,  3.0000e-01,  4.0000e-01,         5.0000e-01,  6.0000e-01,  7.0000e-01,  8.0000e-01,  9.0000e-01,         1.0000e+00])]))) –

    • 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.

  • 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).

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

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

  • leave_progress_bar (bool (default: True)) – leave progress bar after the algorithm has completed (only works if verbose) ?

  • 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.

Notes

This algorithm is equivalent to running several independent josiann.sa() instances in parallel where the cost function would be the same but with different parameters. As for the vectorized version (josiann.vsa()), the cost function should accept a (n x d) matrix of position vectors in d-dimensions. Here, all n optimization problems are solved at once while still being treated as independent.