Struct argmin::sa::SimulatedAnnealing
[−]
[src]
pub struct SimulatedAnnealing<'a, T, U, V = U> where
T: ArgminParameter + 'a,
U: ArgminCostValue + 'a,
V: 'a, { pub init_temp: f64, pub max_iters: u64, pub temp_func: SATempFunc, pub custom_temp_func: Option<&'a Fn(f64, u64) -> f64>, pub state: Option<SimulatedAnnealingState<'a, T, U, V>>, }
Simulated Annealing struct
Fields
init_temp: f64
Initial temperature
max_iters: u64
Maximum number of iterations
temp_func: SATempFunc
which temperature function?
custom_temp_func: Option<&'a Fn(f64, u64) -> f64>
Custom temperature function
state: Option<SimulatedAnnealingState<'a, T, U, V>>
Current state of solver
Methods
impl<'a, T, U, V> SimulatedAnnealing<'a, T, U, V> where
T: ArgminParameter,
U: ArgminCostValue,
V: 'a,
[src]
T: ArgminParameter,
U: ArgminCostValue,
V: 'a,
fn new(init_temp: f64, max_iters: u64) -> Result<Self, Error>
[src]
Constructor
Returns an SimulatedAnnealing
struct where all entries of the struct are set according to
the parameters provided, apart from temp_func
and custom_temp_func
which are set to
default values (SATempFunc::TemperatureFast
and None
, respectively).
Parameters:
problem
: problem definition
init_tmep
: Initial temperature
max_iters
: Maximum number of iterations
fn temp_func(&mut self, temperature_func: SATempFunc) -> &mut Self
[src]
Change temperature function to one of the options in SATempFunc
.
This will overwrite any custom temperature functions provided by custom_temp_func()
.
fn custom_temp_func(&mut self, func: &'a Fn(f64, u64) -> f64) -> &mut Self
[src]
Provide a custom temperature function.
The function has to implement the function signature &Fn(init_temp: f64, iteration_number: u64) -> f64
and return the current temperature.
This will overwrite any changes done by a call to temp_func()
.
Trait Implementations
impl<'a, T, U, V> ArgminSolver<'a> for SimulatedAnnealing<'a, T, U, V> where
T: ArgminParameter + 'a,
U: ArgminCostValue + 'a,
V: 'a,
[src]
T: ArgminParameter + 'a,
U: ArgminCostValue + 'a,
V: 'a,
type Parameter = T
Parameter vector
type CostValue = U
Cost value
type Hessian = V
Hessian
type StartingPoints = T
Initial parameter(s)
type ProblemDefinition = ArgminProblem<'a, Self::Parameter, Self::CostValue, Self::Hessian>
Type of Problem (TODO: Trait!)
fn init(
&mut self,
problem: &'a Self::ProblemDefinition,
init_param: &Self::StartingPoints
) -> Result<(), Error>
[src]
&mut self,
problem: &'a Self::ProblemDefinition,
init_param: &Self::StartingPoints
) -> Result<(), Error>
Initialize with a given problem and a starting point
fn next_iter(
&mut self
) -> Result<ArgminResult<Self::Parameter, Self::CostValue>, Error>
[src]
&mut self
) -> Result<ArgminResult<Self::Parameter, Self::CostValue>, Error>
Compute next point
fn terminate(&self) -> TerminationReason
[src]
Stopping criterions
fn run(
&mut self,
operator: &'a Self::ProblemDefinition,
init_param: &Self::StartingPoints
) -> Result<ArgminResult<Self::Parameter, Self::CostValue>, Error>
[src]
&mut self,
operator: &'a Self::ProblemDefinition,
init_param: &Self::StartingPoints
) -> Result<ArgminResult<Self::Parameter, Self::CostValue>, Error>
Run initialization and iterations at once