1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /*                                                                       */
3 /*    This file is part of the HiGHS linear optimization suite           */
4 /*                                                                       */
5 /*    Written and engineered 2008-2021 at the University of Edinburgh    */
6 /*                                                                       */
7 /*    Available as open-source under the MIT License                     */
8 /*                                                                       */
9 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
10 /**@file lp_data/HConst.h
11  * @brief Constants for HiGHS
12  * @author Julian Hall, Ivet Galabova, Qi Huangfu and Michael Feldmeier
13  */
14 #ifndef LP_DATA_HCONST_H_
15 #define LP_DATA_HCONST_H_
16 
17 #include <cstdint>
18 #include <limits>
19 #include <string>
20 
21 const int HIGHS_CONST_I_INF = std::numeric_limits<int>::max();
22 const double HIGHS_CONST_INF = std::numeric_limits<double>::infinity();
23 const double HIGHS_CONST_TINY = 1e-14;
24 const double HIGHS_CONST_ZERO = 1e-50;
25 const std::string off_string = "off";
26 const std::string choose_string = "choose";
27 const std::string on_string = "on";
28 const int HIGHS_THREAD_LIMIT = 8;  // 32;
29 
30 enum HighsDebugLevel {
31   HIGHS_DEBUG_LEVEL_MIN = 0,
32   HIGHS_DEBUG_LEVEL_NONE = HIGHS_DEBUG_LEVEL_MIN,  // 0
33   HIGHS_DEBUG_LEVEL_CHEAP,                         // 1
34   HIGHS_DEBUG_LEVEL_COSTLY,                        // 2
35   HIGHS_DEBUG_LEVEL_EXPENSIVE,                     // 3
36   HIGHS_DEBUG_LEVEL_MAX = HIGHS_DEBUG_LEVEL_EXPENSIVE
37 };
38 
39 enum class HighsDebugStatus {
40   NOT_CHECKED = -1,
41   OK,
42   SMALL_ERROR,
43   WARNING,
44   LARGE_ERROR,
45   ERROR,
46   EXCESSIVE_ERROR,
47   LOGICAL_ERROR,
48 };
49 
50 enum class HighsVarType : uint8_t {
51   CONTINUOUS = 0,
52   IMPLICIT_INTEGER = 1,
53   INTEGER = 2,
54 };
55 
56 enum class HighsOptionType { BOOL = 0, INT, DOUBLE, STRING };
57 
58 enum class HighsInfoType { INT = 1, DOUBLE };
59 
60 enum OptionOffChooseOn { OPTION_OFF = -1, OPTION_CHOOSE, OPTION_ON };
61 
62 /** SCIP/HiGHS Objective sense */
63 enum class ObjSense { MINIMIZE = 1, MAXIMIZE = -1 };
64 
65 enum SolverOption {
66   SOLVER_OPTION_SIMPLEX = -1,
67   SOLVER_OPTION_CHOOSE,
68   SOLVER_OPTION_IPM
69 };
70 
71 enum PrimalDualStatus {
72   STATUS_NOTSET = -1,
73   STATUS_MIN = STATUS_NOTSET,
74   STATUS_NO_SOLUTION,
75   STATUS_UNKNOWN,
76   STATUS_INFEASIBLE_POINT,
77   STATUS_FEASIBLE_POINT,
78   STATUS_MAX = STATUS_FEASIBLE_POINT
79 };
80 
81 const std::string FILENAME_DEFAULT = "";
82 
83 // Need to allow infinite costs to pass SCIP LPI unit tests
84 const bool allow_infinite_costs = true;
85 
86 // Primal/dual statuses and corresponding HighsModelStatus
87 // values. Note that if dual infeasibility is identified, then the
88 // prototype primal code is used to distinguish PRIMAL_DUAL_INFEASIBLE
89 // from PRIMAL_UNBOUNDED. If this fails, then HiGHS may just return
90 // DUAL_INFEASIBLE
91 //
92 //           | Du Infeas    | Du Feas   | Du UnBd
93 // Pr Infeas | PR_DU_INFEAS | PR_INFEAS | PR_INFEAS
94 // Pr Feas   | PR_UNBD      | OPTIMAL   |   N/A
95 // Pr Unbd   | PR_UNBD      |     N/A   |   N/A
96 //
97 // Dual infeasibility is recognised by infeasibility at dual phase 1 optimality
98 // (and implied by primal unboundedness)
99 //
100 // Dual feasibility is recognised by feasibility at dual phase 1 optimality or
101 // primal phase 2 optimality
102 //
103 // Dual unboundedness is recognised by unboundedness in dual phase 2
104 //
105 // Primal infeasibility is recognised by infeasibility at primal phase 1
106 // optimality (and implied by dual unboundedness)
107 //
108 // Primal feasibility is recognised by feasibility at primal phase 1 optimality
109 // or dual phase 2 optimality
110 //
111 // Primal unboundedness is recognised by unboundedness in primal phase 2
112 //
113 
114 enum class HighsModelStatus {
115   // NB Add new status values to the end so that int cast of status
116   // values is unchanged, since enums are not preserved in some
117   // interfaces
118   NOTSET = 0,
119   HIGHS_MODEL_STATUS_MIN = NOTSET,
120   LOAD_ERROR,
121   MODEL_ERROR,
122   PRESOLVE_ERROR,
123   SOLVE_ERROR,
124   POSTSOLVE_ERROR,
125   MODEL_EMPTY,
126   PRIMAL_INFEASIBLE,
127   PRIMAL_UNBOUNDED,
128   OPTIMAL,
129   REACHED_DUAL_OBJECTIVE_VALUE_UPPER_BOUND,
130   REACHED_TIME_LIMIT,
131   REACHED_ITERATION_LIMIT,
132   PRIMAL_DUAL_INFEASIBLE,
133   DUAL_INFEASIBLE,
134   HIGHS_MODEL_STATUS_MAX = DUAL_INFEASIBLE
135 };
136 
137 /** SCIP/CPLEX-like HiGHS basis status for columns and rows. */
138 enum class HighsBasisStatus {
139   LOWER =
140       0,  // (slack) variable is at its lower bound [including fixed variables]
141   BASIC,  // (slack) variable is basic
142   UPPER,  // (slack) variable is at its upper bound
143   ZERO,   // free variable is non-basic and set to zero
144   NONBASIC,  // nonbasic with no specific bound information - useful for users
145              // and postsolve
146   SUPER      // Super-basic variable: non-basic and either free and
147              // nonzero or not at a bound. No SCIP equivalent
148 };
149 
150 #endif /* LP_DATA_HCONST_H_ */
151