pub fn solve(
problem: &Problem,
method: Method,
options: &Options,
) -> Result<Solution, Error>Expand description
Solves problem with the given method, recording every step.
use simplex_trace::{solve, Method, Options, Problem, Relation, Status, ratio};
let problem = Problem::maximize([3, 5])
.subject_to([1, 0], Relation::Le, 4)
.subject_to([0, 2], Relation::Le, 12)
.subject_to([3, 2], Relation::Le, 18);
let solution = solve(&problem, Method::Simplex, &Options::default()).unwrap();
assert_eq!(
solution.status,
Status::Optimal { objective: ratio(36, 1), values: vec![ratio(2, 1), ratio(6, 1)] }
);
println!("{}", solution.trace);