gamsenum.h
1/*
2  * GAMS - General Algebraic Modeling System C++ API
3  *
4  * Copyright (c) 2017-2022 GAMS Software GmbH <support@gams.com>
5  * Copyright (c) 2017-2022 GAMS Development Corp. <support@gams.com>
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a copy
8  * of this software and associated documentation files (the "Software"), to deal
9  * in the Software without restriction, including without limitation the rights
10  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11  * copies of the Software, and to permit persons to whom the Software is
12  * furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in all
15  * copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23  * SOFTWARE.
24  */
25 
26 #ifndef GAMSENUM_H
27 #define GAMSENUM_H
28 // TODO(jm) generator-change-request: #pragma once in some cases behaves differently to standard IFDEF guard
29 // TODO(JM) generator-change-request: XML-Tags in comments -> no c++ style
30 // TODO(JM) generator-change-request: add static functions to get enums as string
31 
32 #include <string>
33 #include "gamslib_global.h" // LIBSPEC
34 
35 namespace gams {
36 
38 class LIBSPEC GAMSEnum
39 {
40 public:
41 
44  {
45  SymTypeSet = 0,
48  SymTypeEqu
49  };
50 
52  static std::string text(GAMSEnum::SymbolType type);
53 
54 
55  // TODO(AF) difference gmomcc.h/gmoEquType(=> B) and gclgms.h/GMS_EQUTYPE_MAX(=> MAX)?
57  enum EquType
58  {
59  E = 0,
60  G = 1,
61  L = 2,
62  N = 3,
63  X = 4,
64  C = 5,
65  MAX = 6
66  };
67 
69  static std::string text(GAMSEnum::EquType type);
70 
72  enum SetType
73  {
75  Singleton
76  };
77 
79  static std::string text(GAMSEnum::SetType type);
80 
82  enum VarType
83  {
89  Free,
90  SOS1,
91  SOS2,
93  SemiInt
94  };
95 
97  static std::string text(GAMSEnum::VarType type);
98 
101  {
102  Normal = 1,
114  SystemErr
115  };
116 
119  {
120  OptimalGlobal = 1,
138  InfeasibleNoSolution
139  };
140 
143  {
144  NormalReturn = 0,
156  CouldNotCreateScratchDir = 109,
157  TooManyScratchDirs = 110,
158  CouldNotDeleteScratchDir = 112,
159  CouldNotWriteGamsNext = 113,
160  CouldNotWriteParamFile = 114,
161  CouldNotReadEnvVar = 115,
162  CouldNotSpawnGAMScmex = 400,
163  CurDirNotFound = 401,
164  CurDirNotSet = 402,
165  BlankInSysDir = 404,
166  BlankInCurDir = 405,
167  BlankInScrExt = 406,
168  UnexpectedCmexRC = 407,
169  ProcDirNotFound = 408,
170  CmexLibNotFound = 409,
171  CmexLibEPNotFound = 410,
172  BlankInProcDir = 411,
173  BlankInScrDir = 412,
174  CannotAddPath = 909,
175  MissingCommandLineParameter = 1000,
176  CannotInstallInterrupt = 2000,
177  CouldNotGetCurrentDir = 3000,
178  CmexNotFound = 4000,
179  OptNotFound = 5000
180  };
181 
183  static std::string text(GAMSEnum::GAMSExitCode type);
184 
187  {
188  Param = 0,
189  Upper = 1,
190  Lower = 2,
191  Fixed = 3,
192  Primal = 4,
193  Dual = 5
194  };
195 
198  {
199  Off = 0,
202  Verbose
203  };
204 
207  {
208  Default = 0,
209  BaseCase = 1,
210  Accumulate = 2,
211 
212  Inherit = 3
213  // // TODO(AF): this is not part of the C API (gmdUpdateType)!
214  };
215 
217  enum EAction
218  {
219  RestartAfterSolve = 0,
224  TraceReport
225  };
226 
228  static std::string text(GAMSEnum::EAction type);
229 
231  static std::string code(GAMSEnum::EAction type);
232 
234  static EAction eActionFromCode(std::string str);
235 
236 };
237 
238 }
239 #endif // GAMSENUM_H
@ SystemLimitsReached
System limits were reached.
Definition: gamsenum.h:148
SymbolType
This enum defines the type of a symbol (The type Alias is not supported and shows as Set).
Definition: gamsenum.h:44
@ LicensingError
There was a licensing error.
Definition: gamsenum.h:151
@ GAMSSystemError
There was a GAMS system error.
Definition: gamsenum.h:152
@ Free
Free variable.
Definition: gamsenum.h:89
@ Iteration
Solver ran out of iterations.
Definition: gamsenum.h:103
@ Skipped
Solve skipped.
Definition: gamsenum.h:113
@ CompilationError
There was a compilation error.
Definition: gamsenum.h:146
@ SolvedSingular
Singular in a CNS models.
Definition: gamsenum.h:136
@ SOS1
Special Ordered Set 1.
Definition: gamsenum.h:90
@ License
Solver terminated with a license error.
Definition: gamsenum.h:108
@ Unknown
Unknown variable type.
Definition: gamsenum.h:84
@ ErrorUnknown
Error - No cause known.
Definition: gamsenum.h:131
@ CompileOnly
CompileOnly.
Definition: gamsenum.h:220
ModelStat
Model Solution Status.
Definition: gamsenum.h:119
@ GAMSCouldNotBeStarted
GAMS cold not be started.
Definition: gamsenum.h:153
@ OutOfMemory
Out of memory.
Definition: gamsenum.h:154
@ SymTypePar
Symbol type is a Parameter.
Definition: gamsenum.h:46
@ ShowLog
Keep temporary files.
Definition: gamsenum.h:201
@ OutOfDisk
Out of disk.
Definition: gamsenum.h:155
static EAction eActionFromCode(std::string str)
Get a GAMSEnum::EAction from a std::string.
SymbolUpdateType
Symbol update type.
Definition: gamsenum.h:207
@ Integer
Integer Variable.
Definition: gamsenum.h:86
@ Positive
Positive variable.
Definition: gamsenum.h:87
@ SolverErr
Solver terminated with error.
Definition: gamsenum.h:111
@ IntegerSolution
Integer solution found.
Definition: gamsenum.h:127
EAction
GAMS processing requests.
Definition: gamsenum.h:218
@ Feasible
Feasible solution.
Definition: gamsenum.h:126
@ Resource
Solver exceeded time limit.
Definition: gamsenum.h:104
@ CompileAndExecute
Compile and Execute.
Definition: gamsenum.h:222
@ Binary
Binary variable.
Definition: gamsenum.h:85
Definition: gams.h:91
@ Capability
Solver terminated because the model is beyond the solvers capabilities.
Definition: gamsenum.h:107
@ EvalError
Solver quit with nonlinear term evaluation errors.
Definition: gamsenum.h:106
@ LicenseError
Licensing problem.
Definition: gamsenum.h:130
@ SetupErr
Solver terminated on setup error.
Definition: gamsenum.h:110
@ ParameterError
There was a parameter error.
Definition: gamsenum.h:150
@ GlueCodeGeneration
Glue Code Generation.
Definition: gamsenum.h:223
@ Unbounded
Unbounded model found.
Definition: gamsenum.h:122
@ Solver
Solver quit with a problem.
Definition: gamsenum.h:105
@ SemiCont
Semi-continuous variable.
Definition: gamsenum.h:92
@ Negative
Negative variable.
Definition: gamsenum.h:88
static std::string text(GAMSEnum::SymbolType type)
Get a GAMSEnum::SymbolType as string.
VarType
Variable subtype.
Definition: gamsenum.h:83
static std::string code(GAMSEnum::EAction type)
Get a GAMSEnum::EAction as code.
@ KeepFiles
No Debug.
Definition: gamsenum.h:200
@ IntegerInfeasible
No feasible integer solution could be found.
Definition: gamsenum.h:129
SymbolUpdateAction
What field to update.
Definition: gamsenum.h:187
static std::string text(GAMSEnum::VarType type)
Get a GAMSEnum::VarType as string.
static std::string text(GAMSEnum::EAction type)
Get a GAMSEnum::EAction as text.
static std::string text(GAMSEnum::EquType type)
Get a GAMSEnum::EquType as string.
GAMSExitCode
GAMS exit code.
Definition: gamsenum.h:143
The collection of all common GAMS enumerations.
Definition: gamsenum.h:39
@ UnboundedNoSolution
Unbounded - no solution.
Definition: gamsenum.h:137
@ InfeasibleIntermed
Solver terminated early and model was still infeasible.
Definition: gamsenum.h:125
@ ExecutionError
There was an execution error.
Definition: gamsenum.h:147
@ SOS2
Special Ordered Set 2.
Definition: gamsenum.h:91
static std::string text(GAMSEnum::GAMSExitCode type)
Get a GAMSEnum::GAMSExitCode as text.
@ User
Solver terminated on users request (e.g. Ctrl-C)
Definition: gamsenum.h:109
@ Multi
Multi Set - default.
Definition: gamsenum.h:74
SetType
Set subtype.
Definition: gamsenum.h:73
@ FileError
There was a file error.
Definition: gamsenum.h:149
@ ExecuteOnly
ExecuteOnly.
Definition: gamsenum.h:221
@ InfeasibleGlobal
Infeasible model found.
Definition: gamsenum.h:123
DebugLevel
GAMS Debug Level.
Definition: gamsenum.h:198
EquType
Equation subtype.
Definition: gamsenum.h:58
@ SolvedUnique
Unique solution in a CNS models.
Definition: gamsenum.h:134
static std::string text(GAMSEnum::SetType type)
Get a GAMSEnum::SetType as string.
@ OptimalLocal
Local optimal solution achieved.
Definition: gamsenum.h:121
@ NonIntegerIntermed
Solver terminated early with a non integer solution found.
Definition: gamsenum.h:128
@ InternalErr
Solver terminated with error.
Definition: gamsenum.h:112
@ ErrorNoSolution
Error - No solution attained.
Definition: gamsenum.h:132
@ InfeasibleLocal
Locally infeasible model found.
Definition: gamsenum.h:124
@ Solved
Feasible solution in a CNS models.
Definition: gamsenum.h:135
@ NoSolutionReturned
No solution returned.
Definition: gamsenum.h:133
SolveStat
Solver termination condition.
Definition: gamsenum.h:101
@ SymTypeVar
Symbol type is a Variable.
Definition: gamsenum.h:47
@ SolverToBeCalled
Solver is to be called, the system should never return this number.
Definition: gamsenum.h:145