[−][src]Trait net_ensembles::traits::Ensemble
Required methods
fn undo_step(&mut self, step: S) -> Res
- undo a monte carlo step, return result-state
- if you want to undo more than one step
see
undo_steps
fn undo_step_quiet(&mut self, step: S)
- undo a monte carlo step, panic on invalid result state
- for undoing multiple steps see
undo_steps_quiet
fn randomize(&mut self)
Randomizes self according to model
- this is intended for creation of initial sample
- used in
simple_sample
andsimple_sample_vec
fn mc_step(&mut self) -> S
Monte Carlo step
- use this to perform a Monte Carlo step
- for doing multiple mc steps at once, use
mc_steps
Provided methods
fn mc_steps(&mut self, count: usize) -> Vec<S>
Monte Carlo steps
- use this to perform multiple Monte Carlo steps at once
- result
Vec<S>
can be used to undo the steps withself.undo_steps(result)
fn simple_sample<F>(&mut self, times: usize, f: F) where
F: FnMut(&Self),
F: FnMut(&Self),
do the following times
times:
f(self)
self.randomize()
fn simple_sample_vec<F, G>(&mut self, times: usize, f: F) -> Vec<G> where
F: FnMut(&Self) -> G,
F: FnMut(&Self) -> G,
fn undo_steps(&mut self, steps: Vec<S>) -> Vec<Res>
Undo Monte Carlo steps
- Note: uses undo_step in correct order and returns result
Important:
- look at specific implementation of
undo_step
, every thing mentioned there applies to each step
fn undo_steps_quiet(&mut self, steps: Vec<S>)
Undo Monte Carlo steps
- Note: uses
undo_step_quiet
in correct order
Important:
- look at specific implementation of
undo_step_quiet
, every thing mentioned there applies to each step
Implementors
impl<T, R> Ensemble<ErStepC, ErStepC> for ErEnsembleC<T, R> where
T: Node,
R: Rng,
[src]
T: Node,
R: Rng,
fn randomize(&mut self)
[src]
Randomizes the edges according to Er probabilities
- this is used by
ErEnsembleC::new
to create the initial topology - you can use this for sampling the ensemble
- runs in
O(vertices * vertices)
fn mc_step(&mut self) -> ErStepC
[src]
Monte Carlo step
- use this to perform a Monte Carlo step
- result
ErStepC
can be used to undo the step withself.undo_step(result)
fn undo_step(&mut self, step: ErStepC) -> ErStepC
[src]
Undo a Monte Carlo step
- adds removed edge, or removes added edge, or does nothing
- if it returns an Err value, you probably used the function wrong
Important:
Restored graph is the same as before the random step except the order of nodes in the adjacency list might be shuffled!
fn undo_step_quiet(&mut self, step: ErStepC)
[src]
Undo a Monte Carlo step
- adds removed edge, or removes added edge, or does nothing
- if it returns an Err value, you probably used the function wrong
Important:
Restored graph is the same as before the random step except the order of nodes in the adjacency list might be shuffled!
impl<T, R> Ensemble<ErStepM, ErStepM> for ErEnsembleM<T, R> where
T: Node,
R: Rng,
[src]
T: Node,
R: Rng,
fn undo_step(&mut self, step: ErStepM) -> ErStepM
[src]
- undo a monte carlo step, return result-state
- if you want to undo more than one step
see
undo_steps
fn undo_step_quiet(&mut self, step: ErStepM)
[src]
- undo a monte carlo step, panic on invalid result state
- for undoing multiple steps see
undo_steps_quiet
fn randomize(&mut self)
[src]
Randomizes self according to model
- this is intended for creation of initial sample
- used in
simple_sample
andsimple_sample_vec
fn mc_step(&mut self) -> ErStepM
[src]
Monte Carlo step
- use this to perform a Monte Carlo step
- for doing multiple mc steps at once, use
mc_steps