WithTimeLimit trait implemented for LpSolveProblem, MicroLpProblem, CPLEXProblem, and lp-solvers Model<T>#113
WithTimeLimit trait implemented for LpSolveProblem, MicroLpProblem, CPLEXProblem, and lp-solvers Model<T>#113jk2997 wants to merge 18 commits intorust-or:mainfrom
Conversation
| russcip = { version = "0.8.2", optional = true } | ||
| lp-solvers = { version = "1.0.0", features = ["cplex"], optional = true } | ||
| cplex-rs = { version = "0.1", optional = true } | ||
| cplex-rs = { git = "https://github.com/jk2997/cplex_rs_fork", optional = true } |
There was a problem hiding this comment.
We can't ship a git dependency. Could you pleas upstream your changes into cplex-rs first :)
|
|
||
| impl WithTimeLimit for MicroLpProblem { | ||
| fn with_time_limit<T: Into<f64>>(self, _seconds: T) -> Self { | ||
| // microlp does not support time limits yet |
There was a problem hiding this comment.
then do not implement WithTimeLimit on it :)
| let name = CString::new("sos").unwrap(); | ||
| self.0 | ||
| .add_sos_constraint(&name, SOSType::Type1, 1, &weights, &variables); | ||
| .add_sos_constraint(&name, SOSType::Type1, 1, weights.as_mut_slice(), variables.as_mut_slice()); |
| let (obj_coefs, obj_idx, _const) = expr_to_scatter_vec(objective); | ||
| assert!(model.scatter_objective_function(&obj_coefs, &obj_idx)); | ||
| let (mut obj_coefs, mut obj_idx, _const) = expr_to_scatter_vec(objective); | ||
| model.scatter_objective_function(obj_coefs.as_mut_slice(), obj_idx.as_mut_slice()).unwrap(); | ||
| for (i, v) in variables.into_iter().enumerate() { | ||
| let col = to_c(i + 1); | ||
| assert!(model.set_integer(col, v.is_integer)); | ||
| model.set_integer(col, v.is_integer).unwrap(); | ||
| if v.min.is_finite() || v.max.is_finite() { | ||
| assert!(model.set_bounds(col, v.min, v.max)); | ||
| model.set_bounds(col, v.min, v.max).unwrap(); | ||
| } else { | ||
| assert!(model.set_unbounded(col)); | ||
| model.set_unbounded(col).unwrap(); |
There was a problem hiding this comment.
why all these unrelated changes ?
Maybe open a separate pr if they are indeed justified ?
|
|
||
| #[test] | ||
| fn solve_problem_with_time_limit() { | ||
| eprintln!("Testing time limit..."); |
|
The as_mut_slice() changes were because the |
|
Receiving feedback on a pull request is normal, you can also just leave this open and push to the same branch to fix things up :) |
No description provided.