I was wondering if you'd be willing to have CoinCbcProblem use the Clone attribute.
The model is cloneable in coin_cbc and allows for the usage of an unsolved model to be used within a loop...
let mut ref_model = SubsetModel::new(items, item_reqs, weights, state_1_values, state_2_values);
ref_model.problem.set_parameter("log", "0");
for storage in 0..state_1_sum_lb {
for lodging in 0..state_2_sum_lb {
let model = ref_model.clone();
// The state sum LB constraints.
let state_1_sum_lb_expr: Expression = (storage as f64).into();
let state_2_sum_lb_expr: Expression = (lodging as f64).into();
let state_1_sum_lb_constraint =
constraint!(state_1_sum_lb_expr <= model.state_1_sum_expr);
let state_2_sum_lb_constraint =
constraint!(state_2_sum_lb_expr <= model.state_2_sum_expr);
let subset_solution = model
.problem
.with(state_1_sum_lb_constraint)
.with(state_2_sum_lb_constraint)
.solve()
.unwrap();
...
The performance is pretty much identical on my small test sets.
I was wondering if you'd be willing to have CoinCbcProblem use the Clone attribute.
The model is cloneable in coin_cbc and allows for the usage of an unsolved model to be used within a loop...
The performance is pretty much identical on my small test sets.
but I imagine that on models with many more variables might benefit performance wise.
Perhaps there is already a better way to handle this kind of situation and I just missed it?