Loading...
Searching...
No Matches
gamsworkspace.h
1
26#ifndef GAMSWORKSPACE_H
27#define GAMSWORKSPACE_H
28
29#include <memory>
30#include "gamslib_global.h"
31#include "gamsenum.h"
32#include "gamsworkspaceinfo.h"
33
34namespace gams {
35
36class GAMSDatabase;
37class GAMSCheckpoint;
38class GAMSOptions;
39class GAMSWorkspaceImpl;
40class GAMSJob;
41
88class LIBSPEC GAMSWorkspace
89{
90public:
93
99 GAMSWorkspace(const std::string& workingDir, const std::string& systemDir, GAMSEnum::DebugLevel debug);
100
105 GAMSWorkspace(const std::string& workingDir, const std::string& systemDir = "");
106
111 GAMSWorkspace(const std::string& workingDir, GAMSEnum::DebugLevel debug);
112
116
119
124
127
132
134 std::string version();
135
138
141
144
148 static std::string apiVersionDetail();
149
153 static std::string apiVersion();
154
156 static int apiMajorRelNumber();
157
159 static int apiMinorRelNumber();
160
162 static int apiGoldRelNumber();
163
165 std::string scratchFilePrefix() const;
166
169 void setScratchFilePrefix(std::string prefix);
170
173 double myEPS();
174
177 void setMyEPS(double eps);
178
185 GAMSDatabase addDatabaseFromGDX(const std::string& gdxFileName, const std::string& databaseName
186 , const std::string& inModelName);
187
193 GAMSDatabase addDatabaseFromGDX(const std::string& gdxFileName, const std::string& databaseName);
194
199 GAMSDatabase addDatabaseFromGDX(const std::string& gdxFileName);
200
201 // TODO(JM): experimental (keep this?)
207
212 GAMSDatabase addDatabase(const std::string& databaseName = "", const std::string& inModelName = "");
213
219 GAMSDatabase addDatabase(const GAMSDatabase& sourceDatabase, const std::string& databaseName = ""
220 , const std::string& inModelName = "");
221
226 GAMSCheckpoint addCheckpoint(const std::string& checkpointName = "");
227
232 GAMSJob addJobFromFile(const std::string& fileName, const std::string& jobName = "");
233
239 GAMSJob addJobFromFile(const std::string& fileName, const GAMSCheckpoint& checkpoint, const std::string& jobName = "");
240
245 GAMSJob addJobFromString(const std::string& gamsSource, const std::string& jobName = "");
246
252 GAMSJob addJobFromString(const std::string& gamsSource, const GAMSCheckpoint& checkpoint, const std::string& jobName = "");
253
258 GAMSJob addJobFromGamsLib(const std::string& model, const std::string& jobName = "");
259
265 GAMSJob addJobFromGamsLib(const std::string& model, const GAMSCheckpoint& checkpoint, const std::string& jobName = "");
266
271 GAMSJob addJobFromApiLib(const std::string& model, const std::string& jobName = "");
272
278 GAMSJob addJobFromApiLib(const std::string& model, const GAMSCheckpoint& checkpoint, const std::string& jobName = "");
279
284 GAMSJob addJobFromTestLib(const std::string& model, const std::string& jobName = "");
285
291 GAMSJob addJobFromTestLib(const std::string& model, const GAMSCheckpoint& checkpoint, const std::string& jobName = "");
292
297 GAMSJob addJobFromEmpLib(const std::string& model, const std::string& jobName = "");
298
304 GAMSJob addJobFromEmpLib(const std::string& model, const GAMSCheckpoint& checkpoint, const std::string& jobName = "");
305
310 GAMSJob addJobFromDataLib(const std::string& model, const std::string& jobName = "");
311
317 GAMSJob addJobFromDataLib(const std::string& model, const GAMSCheckpoint& checkpoint, const std::string& jobName = "");
318
323 GAMSJob addJobFromFinLib(const std::string& model, const std::string& jobName = "");
324
330 GAMSJob addJobFromFinLib(const std::string& model, const GAMSCheckpoint& checkpoint, const std::string& jobName = "");
331
336 GAMSJob addJobFromNoaLib(const std::string& model, const std::string& jobName = "");
337
343 GAMSJob addJobFromNoaLib(const std::string& model, const GAMSCheckpoint& checkpoint, const std::string& jobName = "");
344
349 GAMSJob addJobFromPsoptLib(const std::string& model, const std::string& jobName = "");
350
356 GAMSJob addJobFromPsoptLib(const std::string& model, const GAMSCheckpoint& checkpoint, const std::string& jobName = "");
357
362
368
373 GAMSOptions addOptions(const std::string& optFile);
374
377 void gamsLib(std::string model);
378
381 void testLib(std::string model);
382
385 void empLib(std::string model);
386
389 void dataLib(std::string model);
390
393 void apiLib(std::string model);
394
397 void finLib(std::string model);
398
401 void noaLib(std::string model);
402
405 void psoptLib(std::string model);
406
409 std::string workingDirectory() const;
410
413 std::string systemDirectory() const;
414
418 bool operator==(const GAMSWorkspace& other) const;
419
423 bool operator!=(const GAMSWorkspace& other) const;
424
427
430 LogId logID() const;
431
433 double* specValues() const;
434
437 bool hasError() const;
438
441 void setHasError(bool newHasError);
442
443private:
444 friend class GAMSModelInstanceImpl;
445 friend class GAMSJobImpl;
446 friend class GAMSDatabaseImpl;
447 friend class GAMSCheckpointImpl;
448
449 GAMSDatabase addDatabaseFromGDXForcedName(std::string gdxFileName, std::string databaseName, std::string inModelName = "");
450
451 bool usingTmpWorkingDir() const;
452
456 std::string registerDatabase(const std::string databaseName = "") const;
457 std::string nextDatabaseName() const;
458
462 std::string registerCheckpoint(const std::string &checkpointName = "") const;
463
467 std::string registerModelInstance(const std::string modelInstanceName = "");
468
469 std::string optFileExtension(int optfile); // TODO(JM) check if this method can stay here
470
471private:
472 std::shared_ptr<GAMSWorkspaceImpl> mImpl;
473};
474
475} // namespace gams
476
477#endif // GAMSWORKSPACE_H
DebugLevel
GAMS Debug Level.
Definition: gamsenum.h:198
The GAMSWorkspaceInfo can be used to input parameters for the GAMSWorkspace constructor.
std::string workingDirectory() const
GAMSJob addJobFromPsoptLib(const std::string &model, const GAMSCheckpoint &checkpoint, const std::string &jobName="")
GAMSJob addJobFromNoaLib(const std::string &model, const std::string &jobName="")
GAMSJob addJobFromGamsLib(const std::string &model, const std::string &jobName="")
GAMSJob addJobFromDataLib(const std::string &model, const std::string &jobName="")
GAMSWorkspace(const GAMSWorkspace &other)
Copy Constructor.
GAMSJob addJobFromGamsLib(const std::string &model, const GAMSCheckpoint &checkpoint, const std::string &jobName="")
void finLib(std::string model)
GAMSJob addJobFromTestLib(const std::string &model, const GAMSCheckpoint &checkpoint, const std::string &jobName="")
GAMSWorkspace & operator=(const GAMSWorkspace &other)
GAMSWorkspace(const std::string &workingDir, const std::string &systemDir, GAMSEnum::DebugLevel debug)
GAMSJob addJobFromEmpLib(const std::string &model, const GAMSCheckpoint &checkpoint, const std::string &jobName="")
double * specValues() const
Get all special values related to a system.
static int apiGoldRelNumber()
Get the GAMS C++ API GOLD release number.
std::string systemDirectory() const
void noaLib(std::string model)
int goldRelNumber()
Get the GAMS GOLD release number.
void dataLib(std::string model)
LogId logID() const
bool hasError() const
GAMSOptions addOptions()
GAMSJob addJobFromFinLib(const std::string &model, const GAMSCheckpoint &checkpoint, const std::string &jobName="")
void psoptLib(std::string model)
GAMSWorkspace(const std::string &workingDir, const std::string &systemDir="")
~GAMSWorkspace()
Destructor.
void empLib(std::string model)
GAMSJob addJobFromNoaLib(const std::string &model, const GAMSCheckpoint &checkpoint, const std::string &jobName="")
GAMSJob addJobFromApiLib(const std::string &model, const GAMSCheckpoint &checkpoint, const std::string &jobName="")
void gamsLib(std::string model)
static int apiMajorRelNumber()
Get the GAMS C++ API major release number.
void setMyEPS(double eps)
std::string scratchFilePrefix() const
Get the string used to prefix automatically generated files.
GAMSOptions addOptions(const std::string &optFile)
GAMSJob addJobFromString(const std::string &gamsSource, const GAMSCheckpoint &checkpoint, const std::string &jobName="")
GAMSDatabase addDatabase(const GAMSDatabase &sourceDatabase, const std::string &databaseName="", const std::string &inModelName="")
GAMSJob addJobFromFinLib(const std::string &model, const std::string &jobName="")
void setHasError(bool newHasError)
void setScratchFilePrefix(std::string prefix)
GAMSJob addJobFromEmpLib(const std::string &model, const std::string &jobName="")
bool operator==(const GAMSWorkspace &other) const
int minorRelNumber()
Get the required GAMS minor version number.
GAMSJob addJobFromFile(const std::string &fileName, const GAMSCheckpoint &checkpoint, const std::string &jobName="")
GAMSJob addJobFromFile(const std::string &fileName, const std::string &jobName="")
GAMSJob addJobFromTestLib(const std::string &model, const std::string &jobName="")
GAMSWorkspace(GAMSEnum::DebugLevel debug)
GAMSDatabase addDatabaseFromGDX(const std::string &gdxFileName, const std::string &databaseName)
GAMSEnum::DebugLevel debug()
Get GAMS debug level.
static std::string apiVersion()
GAMSJob addJobFromString(const std::string &gamsSource, const std::string &jobName="")
GAMSDatabase addDatabase(const std::string &databaseName="", const std::string &inModelName="")
static std::string apiVersionDetail()
GAMSWorkspace()
Constructor.
static int apiMinorRelNumber()
Get the GAMS C++ API minor release number.
GAMSWorkspace(const GAMSWorkspaceInfo &wsInfo)
GAMSDatabase addDatabaseFromGMD(void *gmdPtr)
int majorRelNumber()
Get the required GAMS major version number.
GAMSJob addJobFromPsoptLib(const std::string &model, const std::string &jobName="")
std::string version()
Get the required GAMS version.
bool operator!=(const GAMSWorkspace &other) const
GAMSJob addJobFromApiLib(const std::string &model, const std::string &jobName="")
GAMSWorkspace(const std::string &workingDir, GAMSEnum::DebugLevel debug)
GAMSOptions addOptions(const GAMSOptions &optFrom)
void apiLib(std::string model)
GAMSJob addJobFromDataLib(const std::string &model, const GAMSCheckpoint &checkpoint, const std::string &jobName="")
GAMSDatabase addDatabaseFromGDX(const std::string &gdxFileName, const std::string &databaseName, const std::string &inModelName)
void testLib(std::string model)
GAMSDatabase addDatabaseFromGDX(const std::string &gdxFileName)
GAMSCheckpoint addCheckpoint(const std::string &checkpointName="")
Definition: gams.h:91