OR-Tools  8.1
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 
16 namespace operations_research {
17 
19  switch (s) {
21  return MPSolver::OPTIMAL;
22  case glop::ProblemStatus::PRIMAL_FEASIBLE:
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
37  case glop::ProblemStatus::DUAL_UNBOUNDED:
38  return MPSolver::INFEASIBLE;
39 
40  case glop::ProblemStatus::DUAL_INFEASIBLE: // PASS_THROUGH_INTENDED
41  case glop::ProblemStatus::PRIMAL_UNBOUNDED:
42  return MPSolver::UNBOUNDED;
43 
44  case glop::ProblemStatus::DUAL_FEASIBLE: // PASS_THROUGH_INTENDED
46  return MPSolver::NOT_SOLVED;
47 
48  case glop::ProblemStatus::ABNORMAL: // PASS_THROUGH_INTENDED
49  case glop::ProblemStatus::IMPRECISE: // PASS_THROUGH_INTENDED
50  case glop::ProblemStatus::INVALID_PROBLEM:
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;
66  return MPSolver::FIXED_VALUE;
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;
100  return MPSolver::FIXED_VALUE;
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
glop_utils.h
operations_research::glop::ConstraintStatus::FREE
@ FREE
operations_research::glop::VariableStatus::AT_UPPER_BOUND
@ AT_UPPER_BOUND
operations_research::glop::VariableStatus::BASIC
@ BASIC
operations_research::glop::ProblemStatus::ABNORMAL
@ ABNORMAL
LOG
#define LOG(severity)
Definition: base/logging.h:420
operations_research::MPSolver::OPTIMAL
@ OPTIMAL
optimal.
Definition: linear_solver.h:429
operations_research::glop::ConstraintStatus::FIXED_VALUE
@ FIXED_VALUE
operations_research::MPSolver::UNBOUNDED
@ UNBOUNDED
proven unbounded.
Definition: linear_solver.h:435
operations_research
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
Definition: dense_doubly_linked_list.h:21
operations_research::glop::ConstraintStatus
ConstraintStatus
Definition: lp_types.h:227
operations_research::MPSolver::ABNORMAL
@ ABNORMAL
abnormal, i.e., error of some kind.
Definition: linear_solver.h:437
operations_research::glop::ConstraintStatus::AT_UPPER_BOUND
@ AT_UPPER_BOUND
operations_research::MPSolverToGlopConstraintStatus
glop::ConstraintStatus MPSolverToGlopConstraintStatus(MPSolver::BasisStatus s)
Definition: glop_utils.cc:108
operations_research::glop::VariableStatus::FIXED_VALUE
@ FIXED_VALUE
operations_research::MPSolver::BASIC
@ BASIC
Definition: linear_solver.h:647
operations_research::GlopToMPSolverResultStatus
MPSolver::ResultStatus GlopToMPSolverResultStatus(glop::ProblemStatus s)
Definition: glop_utils.cc:18
operations_research::MPSolver::NOT_SOLVED
@ NOT_SOLVED
not been solved yet.
Definition: linear_solver.h:441
operations_research::MPSolver::FREE
@ FREE
Definition: linear_solver.h:643
operations_research::MPSolverToGlopVariableStatus
glop::VariableStatus MPSolverToGlopVariableStatus(MPSolver::BasisStatus s)
Definition: glop_utils.cc:74
operations_research::MPSolver::BasisStatus
BasisStatus
Advanced usage: possible basis status values for a variable and the slack variable of a linear constr...
Definition: linear_solver.h:642
operations_research::glop::ConstraintStatus::BASIC
@ BASIC
operations_research::MPSolver::AT_UPPER_BOUND
@ AT_UPPER_BOUND
Definition: linear_solver.h:645
operations_research::MPSolver::ResultStatus
ResultStatus
The status of solving the problem.
Definition: linear_solver.h:427
operations_research::MPSolver::FIXED_VALUE
@ FIXED_VALUE
Definition: linear_solver.h:646
operations_research::GlopToMPSolverVariableStatus
MPSolver::BasisStatus GlopToMPSolverVariableStatus(glop::VariableStatus s)
Definition: glop_utils.cc:57
operations_research::glop::ProblemStatus::OPTIMAL
@ OPTIMAL
operations_research::GlopToMPSolverConstraintStatus
MPSolver::BasisStatus GlopToMPSolverConstraintStatus(glop::ConstraintStatus s)
Definition: glop_utils.cc:91
operations_research::glop::ProblemStatus
ProblemStatus
Definition: lp_types.h:101
operations_research::glop::ConstraintStatus::AT_LOWER_BOUND
@ AT_LOWER_BOUND
operations_research::glop::ProblemStatus::INIT
@ INIT
operations_research::MPSolver::INFEASIBLE
@ INFEASIBLE
proven infeasible.
Definition: linear_solver.h:433
operations_research::glop::VariableStatus
VariableStatus
Definition: lp_types.h:196
operations_research::glop::VariableStatus::FREE
@ FREE
operations_research::MPSolver::AT_LOWER_BOUND
@ AT_LOWER_BOUND
Definition: linear_solver.h:644
operations_research::glop::VariableStatus::AT_LOWER_BOUND
@ AT_LOWER_BOUND
operations_research::MPSolver::FEASIBLE
@ FEASIBLE
feasible, or stopped by limit.
Definition: linear_solver.h:431