[][src]Trait ddo::core::abstraction::dp::Problem

pub trait Problem<T> {
    fn nb_vars(&self) -> usize;
fn initial_state(&self) -> T;
fn initial_value(&self) -> i32;
fn domain_of<'a>(&self, state: &'a T, var: Variable) -> Domain<'a>;
fn transition(&self, state: &T, vars: &VarSet, d: Decision) -> T;
fn transition_cost(&self, state: &T, vars: &VarSet, d: Decision) -> i32; fn impacted_by(&self, state: &T, variable: Variable) -> bool { ... }
fn root_node(&self) -> Node<T> { ... }
fn all_vars(&self) -> VarSet { ... } }

This is the main abstraction that should be provided by any user of our library. Indeed, it defines the problem to be solved in the form of a dynamic program. Therefore, this trait closely sticks to the formal definition of a dynamic program.

The type parameter <T> denotes the type of the states of the dynamic program.

Required methods

fn nb_vars(&self) -> usize

Returns the number of decision variables that play a role in the problem.

fn initial_state(&self) -> T

Returns the initial state of the problem (when no decision is taken).

fn initial_value(&self) -> i32

Returns the initial value of the objective function (when no decision is taken).

fn domain_of<'a>(&self, state: &'a T, var: Variable) -> Domain<'a>

Returns the domain of variable var in the given state. These are the possible values that might possibly be affected to var when the system has taken decisions leading to state.

fn transition(&self, state: &T, vars: &VarSet, d: Decision) -> T

Returns the next state reached by the system if the decision d is taken when the system is in the given state and the given set of vars are still free (no value assigned).

fn transition_cost(&self, state: &T, vars: &VarSet, d: Decision) -> i32

Returns the marginal benefit (in terms of objective function to maximize) of taking decision d is when the system is in the given state and the given set of vars are still free (no value assigned).

Loading content...

Provided methods

fn impacted_by(&self, state: &T, variable: Variable) -> bool

Optional method for the case where you'd want to use a pooled mdd implementation. This method returns true iff taking a decision on variable might have an impact (state or longest path) on a node having the given state

fn root_node(&self) -> Node<T>

Returns the root node of an exact MDD standing for this problem.

This method is (trivially) auto-implemented, but re-implementing it does not make much sense.

fn all_vars(&self) -> VarSet

Returns a var set with all the variables of this problem.

This method is (trivially) auto-implemented, but re-implementing it does not make much sense.

Loading content...

Implementors

impl<T, P, X> Problem<T> for PbRef<X, P> where
    P: Problem<T>,
    X: Borrow<P>, 
[src]

impl<T, P: Problem<T>> Problem<T> for Minimize<P>[src]

Loading content...