[][src]Trait net_ensembles::sampling::traits::MarkovChain

pub trait MarkovChain<S, Res> {
    fn undo_step(&mut self, step: S) -> Res;
fn undo_step_quiet(&mut self, step: S);
fn m_step(&mut self) -> S; fn m_steps(&mut self, count: usize) -> Vec<S> { ... }
fn undo_steps(&mut self, steps: Vec<S>) -> Vec<Res> { ... }
fn undo_steps_quiet(&mut self, steps: Vec<S>) { ... } }

Required methods

fn undo_step(&mut self, step: S) -> Res

  • undo a markov 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 markov, panic on invalid result state
  • for undoing multiple steps see undo_steps_quiet

fn m_step(&mut self) -> S

Markov step

  • use this to perform a markov step step
  • for doing multiple markov steps at once, use m_steps
Loading content...

Provided methods

fn m_steps(&mut self, count: usize) -> Vec<S>

Markov steps

  • use this to perform multiple markov steps at once
  • result Vec<S> can be used to undo the steps with self.undo_steps(result)

fn undo_steps(&mut self, steps: Vec<S>) -> Vec<Res>

Undo markov 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 markov 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
Loading content...

Implementors

impl<T, R> MarkovChain<ErStepC, ErStepC> for ErEnsembleC<T, R> where
    T: Node + SerdeStateConform,
    R: Rng
[src]

fn m_step(&mut self) -> ErStepC[src]

Markov step

  • use this to perform a markov step, e.g., to create a markov chain
  • result ErStepC can be used to undo the step with self.undo_step(result)

fn undo_step(&mut self, step: ErStepC) -> ErStepC[src]

Undo a markcov 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 markov 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> MarkovChain<SwChangeState, SwChangeState> for SwEnsemble<T, R> where
    T: Node + SerdeStateConform,
    R: Rng
[src]

fn m_step(&mut self) -> SwChangeState[src]

Markov step

  • use this to perform a markov step
  • keep in mind, that it is not unlikely for a step to do Nothing as it works by drawing an edge and then reseting it with r_prob, else the edge is rewired
  • result SwChangeState can be used to undo the step with self.undo_step(result)
  • result should never be InvalidAdjecency or GError if used on a valid graph

fn undo_step(&mut self, step: SwChangeState) -> SwChangeState[src]

Undo a markov step

  • rewires edge to old state
  • Note: cannot undo InvalidAdjecency or GError, will just return InvalidAdjecency or GError respectively
  • returns result of rewire

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: SwChangeState)[src]

Undo a Monte Carlo step

  • rewires edge to old state
  • panics if you try to undo InvalidAdjecency or GError
  • panics if rewire result (SwChangeState) is invalid (i.e. !result.is_valid())

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> MarkovChain<ErStepM, ErStepM> for ErEnsembleM<T, R> where
    T: Node + SerdeStateConform,
    R: Rng
[src]

fn undo_step(&mut self, step: ErStepM) -> ErStepM[src]

  • undo a markov 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 markov step, panic on invalid result state
  • for undoing multiple steps see undo_steps_quiet

fn m_step(&mut self) -> ErStepM[src]

Markov step

  • use this to perform a markov step
  • for doing multiple mc steps at once, use m_steps
Loading content...