1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
pub mod coin_cbc;

use crate::Constraint;
use crate::Variable;

#[derive(Eq, PartialEq, Clone, Copy)]
pub enum ObjectiveDirection { Maximisation, Minimisation }

#[derive(Debug, PartialEq, Clone)]
pub enum ResolutionError {
    Unbounded,
    Infeasible,
    Other(&'static str),
}

pub trait SolverModel<F> {
    type Solution: Solution<F>;
    type Error;

    fn with(self, constraint: Constraint<F>) -> Self;

    fn solve(self) -> Result<Self::Solution, Self::Error>;
}

pub trait Solution<F> {
    fn value(&self, variable: Variable<F>) -> f64;
}