josiann.moves.discrete.SetStep

class josiann.moves.discrete.SetStep(*, position_set, bounds=None, repr_attributes=(), **kwargs)[source]

Step within a fixed set of possible values for x. For each dimension, the position immediately before or after x will be chosen at random when stepping.

Instantiate a Move.

Parameters:
  • position_set (Sequence[Sequence[float]]) – sets of only possible values for x in each dimension.

  • 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: ())) – tuple of attribute names to include in the move’s representation.

  • kwargs (Any) –

Methods

SetStep.__init__

Instantiate a Move.

SetStep.get_proposal

Generate a new proposed vector x.

SetStep.set_bounds

Set bounds for the move.

Methods

SetStep.__init__(*, position_set, bounds=None, repr_attributes=(), **kwargs)[source]

Instantiate a Move.

Parameters:
  • position_set (Sequence[Sequence[float]]) – sets of only possible values for x in each dimension.

  • 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: ())) – tuple of attribute names to include in the move’s representation.

  • kwargs (Any) –

SetStep.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,).

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