Skip to content

Commit 9f547fb

Browse files
authored
Merge pull request #267 from scipopt/fix-266
Add primal and dual limits to supported model statuses, update scip-sys
2 parents 833e3ea + 2920631 commit 9f547fb

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

.github/workflows/build_and_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: russcip_pipelines
22

33
env:
4-
version: 9.2.1
4+
version: 9.2.4
55
RUST_VERSION: 1.88.0
66

77
on:

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ from-source = ["scip-sys/from-source"]
1515
datastore = ["anymap3"]
1616

1717
[dependencies]
18-
scip-sys = "0.1.22"
18+
scip-sys = "0.1.25"
1919
anymap3 = { version = "1.0.1", optional = true }
2020

2121
[dev-dependencies]

src/status.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ pub enum Status {
2020
MemoryLimit,
2121
/// The solving process was interrupted because the gap limit was reached.
2222
GapLimit,
23+
/// The solving process was interrupted because the primal limit was reached.
24+
PrimalLimit,
25+
/// The solving process was interrupted because the dual limit was reached.
26+
DualLimit,
2327
/// The solving process was interrupted because the solution limit was reached.
2428
SolutionLimit,
2529
/// The solving process was interrupted because the solution improvement limit was reached.
@@ -50,6 +54,8 @@ impl From<SCIP_Status> for Status {
5054
ffi::SCIP_Status_SCIP_STATUS_TIMELIMIT => Status::TimeLimit,
5155
ffi::SCIP_Status_SCIP_STATUS_MEMLIMIT => Status::MemoryLimit,
5256
ffi::SCIP_Status_SCIP_STATUS_GAPLIMIT => Status::GapLimit,
57+
ffi::SCIP_Status_SCIP_STATUS_PRIMALLIMIT => Status::PrimalLimit,
58+
ffi::SCIP_Status_SCIP_STATUS_DUALLIMIT => Status::DualLimit,
5359
ffi::SCIP_Status_SCIP_STATUS_SOLLIMIT => Status::SolutionLimit,
5460
ffi::SCIP_Status_SCIP_STATUS_BESTSOLLIMIT => Status::BestSolutionLimit,
5561
ffi::SCIP_Status_SCIP_STATUS_RESTARTLIMIT => Status::RestartLimit,
@@ -166,6 +172,34 @@ mod tests {
166172
assert_eq!(model.status(), Status::BestSolutionLimit);
167173
}
168174

175+
#[test]
176+
fn primal_limit() {
177+
let mut model = Model::new()
178+
.hide_output()
179+
.include_default_plugins()
180+
.read_prob("data/test/gen-ip054.mps")
181+
.unwrap();
182+
model = model.set_int_param("presolving/maxrounds", 0).unwrap();
183+
model = model.set_real_param("limits/primal", 100000.).unwrap();
184+
let model = model.solve();
185+
186+
assert_eq!(model.status(), Status::PrimalLimit);
187+
}
188+
189+
#[test]
190+
fn dual_limit() {
191+
let mut model = Model::new()
192+
.hide_output()
193+
.include_default_plugins()
194+
.read_prob("data/test/gen-ip054.mps")
195+
.unwrap();
196+
model = model.set_int_param("presolving/maxrounds", 0).unwrap();
197+
model = model.set_real_param("limits/dual", -100000.).unwrap();
198+
let model = model.solve();
199+
200+
assert_eq!(model.status(), Status::DualLimit);
201+
}
202+
169203
#[test]
170204
fn unknown() {
171205
assert_eq!(Model::new().status(), Status::Unknown);

0 commit comments

Comments
 (0)