use std::io::Read;
use simplex_trace::{Method, Options, Problem, Relation, solve};
fn main() {
let problem: Problem = if std::env::args().nth(1).as_deref() == Some("-") {
let mut input = String::new();
std::io::stdin()
.read_to_string(&mut input)
.expect("read stdin");
serde_json::from_str(&input).expect("valid problem JSON")
} else {
Problem::minimize([4, 1])
.subject_to([3, 1], Relation::Eq, 3)
.subject_to([4, 3], Relation::Ge, 6)
.subject_to([1, 2], Relation::Le, 4)
};
let solution = solve(&problem, Method::BigM, &Options::default()).expect("valid problem");
println!(
"{}",
serde_json::to_string_pretty(&solution).expect("serializable")
);
}