1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
use crate::ffi;
/// An enum representing the status of a SCIP optimization run.
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum Status {
/// The solving status is not yet known.
Unknown,
/// The user interrupted the solving process (by pressing CTRL-C).
UserInterrupt,
/// The solving process was interrupted because the node limit was reached.
NodeLimit,
/// The solving process was interrupted because the total node limit was reached (incl. restarts).
TotalNodeLimit,
/// The solving process was interrupted because the stalling node limit was reached (no improvement w.r.t. primal bound).
StallNodeLimit,
/// The solving process was interrupted because the time limit was reached.
TimeLimit,
/// The solving process was interrupted because the memory limit was reached.
MemoryLimit,
/// The solving process was interrupted because the gap limit was reached.
GapLimit,
/// The solving process was interrupted because the solution limit was reached.
SolutionLimit,
/// The solving process was interrupted because the solution improvement limit was reached.
BestSolutionLimit,
/// The solving process was interrupted because the restart limit was reached.
RestartLimit,
/// The problem was solved to optimality, an optimal solution is available.
Optimal,
/// The problem was proven to be infeasible.
Infeasible,
/// The problem was proven to be unbounded.
Unbounded,
/// The problem was proven to be either infeasible or unbounded.
Inforunbd,
/// Status if the process received a SIGTERM signal.
Terminate,
}
impl From<u32> for Status {
/// Converts a u32 value to a `Status` enum variant.
fn from(val: u32) -> Self {
match val {
ffi::SCIP_Status_SCIP_STATUS_UNKNOWN => Status::Unknown,
ffi::SCIP_Status_SCIP_STATUS_USERINTERRUPT => Status::UserInterrupt,
ffi::SCIP_Status_SCIP_STATUS_NODELIMIT => Status::NodeLimit,
ffi::SCIP_Status_SCIP_STATUS_TOTALNODELIMIT => Status::TotalNodeLimit,
ffi::SCIP_Status_SCIP_STATUS_STALLNODELIMIT => Status::StallNodeLimit,
ffi::SCIP_Status_SCIP_STATUS_TIMELIMIT => Status::TimeLimit,
ffi::SCIP_Status_SCIP_STATUS_MEMLIMIT => Status::MemoryLimit,
ffi::SCIP_Status_SCIP_STATUS_GAPLIMIT => Status::GapLimit,
ffi::SCIP_Status_SCIP_STATUS_SOLLIMIT => Status::SolutionLimit,
ffi::SCIP_Status_SCIP_STATUS_BESTSOLLIMIT => Status::BestSolutionLimit,
ffi::SCIP_Status_SCIP_STATUS_RESTARTLIMIT => Status::RestartLimit,
ffi::SCIP_Status_SCIP_STATUS_OPTIMAL => Status::Optimal,
ffi::SCIP_Status_SCIP_STATUS_INFEASIBLE => Status::Infeasible,
ffi::SCIP_Status_SCIP_STATUS_UNBOUNDED => Status::Unbounded,
ffi::SCIP_Status_SCIP_STATUS_INFORUNBD => Status::Inforunbd,
ffi::SCIP_Status_SCIP_STATUS_TERMINATE => Status::Terminate,
_ => panic!("Unknown SCIP status {val:?}"),
}
}
}