OR-Tools  8.2
glop_utils.cc
Go to the documentation of this file.
1// Copyright 2010-2018 Google LLC
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
15
16namespace operations_research {
17
19 switch (s) {
21 return MPSolver::OPTIMAL;
23 return MPSolver::FEASIBLE;
24
25 // Note(user): MPSolver does not have the equivalent of
26 // INFEASIBLE_OR_UNBOUNDED however UNBOUNDED is almost never relevant in
27 // applications, so we decided to report this status as INFEASIBLE since
28 // it should almost always be the case. Historically, we where reporting
29 // ABNORMAL, but that was more confusing than helpful.
30 //
31 // TODO(user): We could argue that it is infeasible to find the optimal of
32 // an unbounded problem. So it might just be simpler to completely get rid
33 // of the MpSolver::UNBOUNDED status that seems to never be used
34 // programmatically.
35 case glop::ProblemStatus::INFEASIBLE_OR_UNBOUNDED: // PASS_THROUGH_INTENDED
36 case glop::ProblemStatus::PRIMAL_INFEASIBLE: // PASS_THROUGH_INTENDED
39
40 case glop::ProblemStatus::DUAL_INFEASIBLE: // PASS_THROUGH_INTENDED
43
44 case glop::ProblemStatus::DUAL_FEASIBLE: // PASS_THROUGH_INTENDED
47
48 case glop::ProblemStatus::ABNORMAL: // PASS_THROUGH_INTENDED
49 case glop::ProblemStatus::IMPRECISE: // PASS_THROUGH_INTENDED
51 return MPSolver::ABNORMAL;
52 }
53 LOG(DFATAL) << "Invalid glop::ProblemStatus " << s;
54 return MPSolver::ABNORMAL;
55}
56
58 switch (s) {
60 return MPSolver::FREE;
68 return MPSolver::BASIC;
69 }
70 LOG(DFATAL) << "Unknown variable status: " << s;
71 return MPSolver::FREE;
72}
73
75 switch (s) {
76 case MPSolver::FREE:
84 case MPSolver::BASIC:
86 }
87 LOG(DFATAL) << "Unknown variable status: " << s;
89}
90
92 switch (s) {
94 return MPSolver::FREE;
102 return MPSolver::BASIC;
103 }
104 LOG(DFATAL) << "Unknown constraint status: " << s;
105 return MPSolver::FREE;
106}
107
109 switch (s) {
110 case MPSolver::FREE:
118 case MPSolver::BASIC:
120 }
121 LOG(DFATAL) << "Unknown constraint status: " << s;
123}
124
125} // namespace operations_research
#define LOG(severity)
Definition: base/logging.h:420
ResultStatus
The status of solving the problem.
@ FEASIBLE
feasible, or stopped by limit.
@ NOT_SOLVED
not been solved yet.
@ INFEASIBLE
proven infeasible.
@ UNBOUNDED
proven unbounded.
@ ABNORMAL
abnormal, i.e., error of some kind.
BasisStatus
Advanced usage: possible basis status values for a variable and the slack variable of a linear constr...
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
MPSolver::BasisStatus GlopToMPSolverVariableStatus(glop::VariableStatus s)
Definition: glop_utils.cc:57
MPSolver::BasisStatus GlopToMPSolverConstraintStatus(glop::ConstraintStatus s)
Definition: glop_utils.cc:91
MPSolver::ResultStatus GlopToMPSolverResultStatus(glop::ProblemStatus s)
Definition: glop_utils.cc:18
glop::VariableStatus MPSolverToGlopVariableStatus(MPSolver::BasisStatus s)
Definition: glop_utils.cc:74
glop::ConstraintStatus MPSolverToGlopConstraintStatus(MPSolver::BasisStatus s)
Definition: glop_utils.cc:108