OR-Tools  8.2
lp_types.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 namespace glop {
18 
19 std::string GetProblemStatusString(ProblemStatus problem_status) {
20  switch (problem_status) {
22  return "OPTIMAL";
24  return "PRIMAL_INFEASIBLE";
26  return "DUAL_INFEASIBLE";
28  return "INFEASIBLE_OR_UNBOUNDED";
30  return "PRIMAL_UNBOUNDED";
32  return "DUAL_UNBOUNDED";
34  return "INIT";
36  return "PRIMAL_FEASIBLE";
38  return "DUAL_FEASIBLE";
40  return "ABNORMAL";
42  return "INVALID_PROBLEM";
44  return "IMPRECISE";
45  }
46  // Fallback. We don't use "default:" so the compiler will return an error
47  // if we forgot one enum case above.
48  LOG(DFATAL) << "Invalid ProblemStatus " << static_cast<int>(problem_status);
49  return "UNKNOWN ProblemStatus";
50 }
51 
52 std::string GetVariableTypeString(VariableType variable_type) {
53  switch (variable_type) {
55  return "UNCONSTRAINED";
57  return "LOWER_BOUNDED";
59  return "UPPER_BOUNDED";
61  return "UPPER_AND_LOWER_BOUNDED";
63  return "FIXED_VARIABLE";
64  }
65  // Fallback. We don't use "default:" so the compiler will return an error
66  // if we forgot one enum case above.
67  LOG(DFATAL) << "Invalid VariableType " << static_cast<int>(variable_type);
68  return "UNKNOWN VariableType";
69 }
70 
72  switch (status) {
74  return "FREE";
76  return "AT_LOWER_BOUND";
78  return "AT_UPPER_BOUND";
80  return "FIXED_VALUE";
82  return "BASIC";
83  }
84  // Fallback. We don't use "default:" so the compiler will return an error
85  // if we forgot one enum case above.
86  LOG(DFATAL) << "Invalid VariableStatus " << static_cast<int>(status);
87  return "UNKNOWN VariableStatus";
88 }
89 
91  switch (status) {
93  return "FREE";
95  return "AT_LOWER_BOUND";
97  return "AT_UPPER_BOUND";
99  return "FIXED_VALUE";
101  return "BASIC";
102  }
103  // Fallback. We don't use "default:" so the compiler will return an error
104  // if we forgot one enum case above.
105  LOG(DFATAL) << "Invalid ConstraintStatus " << static_cast<int>(status);
106  return "UNKNOWN ConstraintStatus";
107 }
108 
110  switch (status) {
112  return ConstraintStatus::FREE;
121  }
122  // Fallback. We don't use "default:" so the compiler will return an error
123  // if we forgot one enum case above.
124  LOG(DFATAL) << "Invalid VariableStatus " << static_cast<int>(status);
125  // This will never be reached and is here only to guarantee compilation.
126  return ConstraintStatus::FREE;
127 }
128 
129 } // namespace glop
130 } // namespace operations_research
#define LOG(severity)
Definition: base/logging.h:420
std::string GetProblemStatusString(ProblemStatus problem_status)
Definition: lp_types.cc:19
std::string GetConstraintStatusString(ConstraintStatus status)
Definition: lp_types.cc:90
ConstraintStatus VariableToConstraintStatus(VariableStatus status)
Definition: lp_types.cc:109
std::string GetVariableTypeString(VariableType variable_type)
Definition: lp_types.cc:52
std::string GetVariableStatusString(VariableStatus status)
Definition: lp_types.cc:71
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...