Solver

Struct Solver 

Source
pub struct Solver {
    pub iterations: u64,
    pub initial_temperature: f64,
    pub temperature_reduction: f64,
    pub max_attempts: u64,
    pub max_accepts: u64,
    pub max_rejects: u64,
}
Expand description

A solver will take a problem and use simulated annealing to try and find an optimal state.

Fields§

§iterations: u64

The maximum number of iterations to run the algorithm for.

§initial_temperature: f64

The initial temperature of the process.

§temperature_reduction: f64

The factor to multiply the temperature by each time it is lowered - this should be a number between 0.0 and 1.0.

§max_attempts: u64

The maximimum number of attempts to find a new state before lowering the temperature.

§max_accepts: u64

The maximum number of accepted new states before lowering the temperature.

§max_rejects: u64

The maximum number of rejected states before terminating the process.

Implementations§

Source§

impl Solver

Source

pub fn new() -> Solver

Construct the new default solver.

Source

pub fn build_new<F>(builder: F) -> Solver
where F: FnOnce(&mut Solver),

Construct a new solver with a given builder function.

Source

pub fn solve<P>(&self, problem: &P) -> P::State
where P: Problem,

Run the solver on the given problem.

Trait Implementations§

Source§

impl Clone for Solver

Source§

fn clone(&self) -> Solver

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Solver

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Solver

Source§

fn default() -> Solver

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Solver

§

impl RefUnwindSafe for Solver

§

impl Send for Solver

§

impl Sync for Solver

§

impl Unpin for Solver

§

impl UnwindSafe for Solver

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.