Extending Josiann

Custom move functions can be used with Josiann as long as they inherit from one of the base Move classes :

Minimal requirement

Custom moves must at least implement the _get_proposal() method, which generates candidate positions for iteration \(k+1\) by altering the position vector of iteration \(k\). Function _get_proposal() has the following signature :

def _get_proposal(self,
          x: npt.NDArray[Union[np.int64, np.float64]],
          state: State) -> npt.NDArray[Union[np.int64, np.float64]]:
    """
    Generate a new proposed vector x.

    Args:
        x: current vector x of shape (ndim,).
        state: current state of the SA algorithm.

    Returns:
        New proposed vector x of shape (ndim,).
    """
    ...

The state parameter is a josiann.moves.base.State object holding the current state of the SA algorithm.