josiann.moves.sequential.RandomStep

class josiann.moves.sequential.RandomStep(*, magnitude, bounds=None, repr_attributes=(), **kwargs)[source]

Simple random step within a radius of (-0.5 * magnitude) to (+0.5 * magnitude) around x.

Instantiate a Move.

Parameters:
  • magnitude (float) – size of the random step is (-0.5 * magnitude) to (+0.5 * magnitude)

  • bounds (Optional[ndarray[Any, dtype[Union[float64, int64]]]] (default: None)) – optional sequence of (min, max) bounds for values to propose in each dimension.

  • repr_attributes (tuple[str, ...] (default: ())) – list of attribute names to include in the string representation of this Move.

  • kwargs (Any) –

Methods

RandomStep.__init__

Instantiate a Move.

RandomStep.get_proposal

Generate a new proposed vector x.

RandomStep.set_bounds

Set bounds for the move.

Methods

RandomStep.__init__(*, magnitude, bounds=None, repr_attributes=(), **kwargs)[source]

Instantiate a Move.

Parameters:
  • magnitude (float) – size of the random step is (-0.5 * magnitude) to (+0.5 * magnitude)

  • bounds (Optional[ndarray[Any, dtype[Union[float64, int64]]]] (default: None)) – optional sequence of (min, max) bounds for values to propose in each dimension.

  • repr_attributes (tuple[str, ...] (default: ())) – list of attribute names to include in the string representation of this Move.

  • kwargs (Any) –

RandomStep.get_proposal(x, state)

Generate a new proposed vector x.

Parameters:
  • x (ndarray[Any, dtype[TypeVar(DT_ARR, bound= Union[float64, int64])]]) – current vector x of shape (ndim,).

  • state (State) – current state of the SA algorithm.

Return type:

ndarray[Any, dtype[TypeVar(DT_ARR, bound= Union[float64, int64])]]

Returns:

New proposed vector x of shape (ndim,).

RandomStep.set_bounds(bounds)

Set bounds for the move.

Parameters:

bounds (Union[tuple[float, float], Sequence[tuple[float, float]], None]) – sequence of (min, max) bounds for values to propose in each dimension.

Return type:

None