Crate good_lp[][src]

A Linear Programming modeler that is easy to use, performant with large problems, and well-typed.

use good_lp::{variables, variable, coin_cbc, SolverModel, Solution};

let mut vars = variables!();
let a = vars.add(variable().max(1));
let b = vars.add(variable().min(2).max(4));
let solution = vars.maximise(10 * (a - b / 5) - b)
    .using(coin_cbc)
    .with(a + 2. << b)
    .with(1 + a >> 4. - b)
    .solve()?;

assert_eq!(solution.value(a), 1.);
assert_eq!(solution.value(b), 3.);

Re-exports

pub use variable::Variable;
pub use variable::variable;
pub use constraint::Constraint;

Modules

constraint

Constraints define the inequalities that must hold in the solution.

variable

A Variable is the base element used to create an Expression. The goal of the solver is to find optimal values for all variables in a problem.

Macros

variables

Instantiates crate::variable::ProblemVariables, to create a set of related variables.

Structs

Expression

Represents an affine expression, such as 2x + 3 or x + y + z

Enums

ResolutionError

Represents an error that occurred when solving a problem

Traits

Solution

A problem solution

SolverModel

A solver's own representation of a model, to which constraints can be added.

Functions

coin_cbc

The Cbc COIN-OR solver library