josiann.Trace

class josiann.Trace(nb_iterations, nb_walkers, nb_dimensions, run_parameters, initial_position, initial_cost)[source]

Object for storing the trace history of an SA run.

Instantiate a Trace.

Parameters:
  • nb_iterations (int) – number of expected iterations for the SA algorithm.

  • nb_walkers (int) – number of walkers that run in parallel.

  • nb_dimensions (int) – number of dimensions per optimization problem.

  • run_parameters (SAParameters) – parameters used for running the SA algorithm.

  • initial_position (ndarray[Any, dtype[float64]]) – initial positions before running the SA algorithm.

  • initial_cost (ndarray[Any, dtype[float64]]) – cost of initial positions.

Attributes

Trace.nb_dimensions

Number of dimensions per optimization problem.

Trace.nb_iterations

Number of iterations that the SA algorithm run for.

Trace.nb_walkers

Number of walkers that run in parallel.

Methods

Trace.__init__

Instantiate a Trace.

Trace.finalize

When the SA algorithm terminates, finalize() is called on position and parameter traces to delete rows for iterations that where never run.

Trace.plot_parameters

Plot temperature, number of repeats per iteration and number of averaged function evaluations along iterations.

Trace.plot_positions

Plot reached positions and costs for the vector to optimize along iterations.

Attributes

Trace.nb_dimensions

Number of dimensions per optimization problem.

Trace.nb_iterations

Number of iterations that the SA algorithm run for.

Trace.nb_walkers

Number of walkers that run in parallel.

Methods

Trace.__init__(nb_iterations, nb_walkers, nb_dimensions, run_parameters, initial_position, initial_cost)[source]

Instantiate a Trace.

Parameters:
  • nb_iterations (int) – number of expected iterations for the SA algorithm.

  • nb_walkers (int) – number of walkers that run in parallel.

  • nb_dimensions (int) – number of dimensions per optimization problem.

  • run_parameters (SAParameters) – parameters used for running the SA algorithm.

  • initial_position (ndarray[Any, dtype[float64]]) – initial positions before running the SA algorithm.

  • initial_cost (ndarray[Any, dtype[float64]]) – cost of initial positions.

Trace.finalize(iteration)[source]

When the SA algorithm terminates, finalize() is called on position and parameter traces to delete rows for iterations that where never run.

Parameters:

iteration (int) – final iteration that was computed before termination.

Return type:

None

Trace.plot_parameters(save=None, show=True)[source]

Plot temperature, number of repeats per iteration and number of averaged function evaluations along iterations.

Parameters:
  • save (Union[Path, str, None] (default: None)) – optional path to save the plot as a html file.

  • show (bool (default: True)) – render the plot ?

Return type:

None

abstract Trace.plot_positions(save=None, true_values=None, show=True, walker_titles=None, dimension_titles=None)[source]

Plot reached positions and costs for the vector to optimize along iterations.

Parameters:
  • save (Optional[Path] (default: None)) – optional path to save the plot as a html file.

  • true_values (Optional[ndarray[Any, dtype[Any]]] (default: None)) – an optional sequence of known true values for each dimension of the vector to optimize.

  • show (bool (default: True)) – render the plot ?

  • walker_titles (Optional[Sequence[str]] (default: None)) – an optional list of sub-plot titles, one title per parallel walker.

  • dimension_titles (Optional[Sequence[str]] (default: None)) – an optional list of sub-plot titles, one title per dimension.

Return type:

None