Trait neil::Problem
[−]
[src]
pub trait Problem { type 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
type State
Required Methods
fn energy(&self, state: &Self::State) -> f64
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.
fn new_state(&self, state: &Self::State) -> Self::State
This function should provide a new state, given the previous state.