[][src]Struct ddo::core::implementation::solver::parallel::ParallelSolver

pub struct ParallelSolver<T, DD> where
    T: Send,
    DD: MDD<T> + Clone + Send
{ /* fields omitted */ }

This is the structure implementing a multi-threaded MDD solver.

Example Usage

let problem    = MockProblem;
let relaxation = MockRelax;
let mdd        = mdd_builder_ref(&problem, relaxation).build();
// the solver is created using an mdd. By default, it uses as many threads
// as there are hardware threads on the machine.
let mut solver = ParallelSolver::new(mdd);
// val is the optimal value of the objective function,
// sol is the sequence of decision yielding that optimal value (if sol exists, `sol != None`)
let (val, sol) = solver.maximize();

Methods

impl<T, DD> ParallelSolver<T, DD> where
    T: Send,
    DD: MDD<T> + Clone + Send
[src]

private interface of the parallel solver

pub fn new(mdd: DD) -> Self[src]

This creates a solver that will find the best solution in the problem described by the given mdd (mdd is not expanded yet). This solver will return the optimal solution from what would be an exact expansion of mdd.

All the other parameters will use their default value. + nb_threads will be the number of hardware threads + verbosity will be 0

pub fn with_verbosity(mdd: DD, verbosity: u8) -> Self[src]

This creates a solver that will find the best solution in the problem described by the given mdd (mdd is not expanded yet) and configure that solver to be more or less verbose.

When using this constructor, the default number of threads will amount to the number of available hardware threads of the platform.

Return value

This solver will return the optimal solution from what would be an exact expansion of mdd.

Verbosity

So far, there are three levels of verbosity:

  • 0 which prints nothing
  • 1 which only prints the final statistics when the problem is solved
  • 2 which prints progress information every 100 explored nodes.

pub fn with_nb_threads(mdd: DD, nb_threads: usize) -> Self[src]

This creates a solver that will find the best solution in the problem described by the given mdd (mdd is not expanded yet) using nb_threads. This solver will return the optimal solution from what would be an exact expansion of mdd.

When using this constructor, the verbosity of the solver is set to level 0.

pub fn customized(mdd: DD, verbosity: u8, nb_threads: usize) -> Self[src]

This constructor lets you specify all the configuration parameters of the solver.

Return value

This solver will return the optimal solution from what would be an exact expansion of mdd.

Verbosity

So far, there are three levels of verbosity:

  • 0 which prints nothing
  • 1 which only prints the final statistics when the problem is solved
  • 2 which prints progress information every 100 explored nodes.

Nb Threads

The nb_threads argument lets you customize the number of threads to spawn in order to solve the problem. We advise you to use the number of hardware threads on your machine.

Trait Implementations

impl<T, DD> Solver for ParallelSolver<T, DD> where
    T: Send,
    DD: MDD<T> + Clone + Send
[src]

fn maximize(&mut self) -> (i32, &Option<Vec<Decision>>)[src]

Applies the branch and bound algorithm proposed by Bergman et al. to solve the problem to optimality. To do so, it spawns nb_threads workers (long running threads); each of which will continually get a workload and process it until the problem is solved.

Auto Trait Implementations

impl<T, DD> !RefUnwindSafe for ParallelSolver<T, DD>

impl<T, DD> Send for ParallelSolver<T, DD>

impl<T, DD> Sync for ParallelSolver<T, DD> where
    DD: Sync

impl<T, DD> Unpin for ParallelSolver<T, DD> where
    DD: Unpin

impl<T, DD> !UnwindSafe for ParallelSolver<T, DD>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.