SimAnnealing

Struct SimAnnealing 

Source
pub struct SimAnnealing<T: Clone> { /* private fields */ }

Implementations§

Source§

impl<T> SimAnnealing<T>
where T: Clone,

Source

pub fn new( x0_p: T, ef: fn(&T) -> f64, take_step: fn(&mut Rng, &mut T, f64), distance: fn(&T, &T) -> f64, print_pos: Option<fn(&T)>, params: SimAnnealingParams, ) -> SimAnnealing<T>

Source

pub fn solve(&self, rng: &mut Rng) -> T

This function performs a simulated annealing search through a given space. The space is specified by providing the functions Ef and distance. The simulated annealing steps are generated using the random number generator rng and the function take_step.

The starting configuration of the system should be given by x0_p.

The params structure (described below) controls the run by providing the temperature schedule and other tunable parameters to the algorithm.

On exit the best result achieved during the search is returned. If the annealing process has been successful this should be a good approximation to the optimal point in the space.

If the argument print_pos is not None, a debugging log will be printed to stdout with the following columns: #-iter #-evals temperature position energy best_energy and the output of the function print position itself.

Source

pub fn solve_many(&self, rng: &mut Rng) -> T

Like the function solve, but performs multiple runs and returns the best result.

Auto Trait Implementations§

§

impl<T> Freeze for SimAnnealing<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for SimAnnealing<T>
where T: RefUnwindSafe,

§

impl<T> Send for SimAnnealing<T>
where T: Send,

§

impl<T> Sync for SimAnnealing<T>
where T: Sync,

§

impl<T> Unpin for SimAnnealing<T>
where T: Unpin,

§

impl<T> UnwindSafe for SimAnnealing<T>
where T: UnwindSafe,

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