Trait neil::Problem [] [src]

pub trait Problem {
    type State;
    fn initial_state(&self) -> Self::State;
    fn energy(&self, state: &Self::State) -> f64;
    fn new_state(&self, state: &Self::State) -> Self::State;
}

A problem represents something to be solved using simulated annealing, and provides methods to calculate the energy of a state and generate new states.

Associated Types

Required Methods

This function should generate an initial state for the problem.

This function should calculate the energy of a given state, as a number between 0.0 and 1.0.

Lower energy means the state is more optimal - simulated annealing will try to find a state with the lowest energy.

This function should provide a new state, given the previous state.

Implementors