josiann.moves.ensemble.Stretch

class josiann.moves.ensemble.Stretch(*, a=2.0, bounds=None, repr_attributes=(), **kwargs)[source]

Stretch move as defined in ‘Goodman, J., Weare, J., 2010, Comm. App. Math. and Comp. Sci., 5, 65’

Instantiate a Move.

Parameters:
  • position_set – sets of only possible values for x in each dimension.

  • a (float (default: 2.0)) – parameter for tuning the distribution of Z. Smaller values make samples tightly distributed around 1 while bigger values make samples more spread out with a peak getting closer to 0.

  • 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

Stretch.__init__

Instantiate a Move.

Stretch.get_proposal

Generate a new proposed vector x.

Stretch.set_bounds

Set bounds for the move.

Methods

Stretch.__init__(*, a=2.0, bounds=None, repr_attributes=(), **kwargs)[source]

Instantiate a Move.

Parameters:
  • position_set – sets of only possible values for x in each dimension.

  • a (float (default: 2.0)) – parameter for tuning the distribution of Z. Smaller values make samples tightly distributed around 1 while bigger values make samples more spread out with a peak getting closer to 0.

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

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

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