Loading...
Searching...
No Matches
gamsjob.h
1/*
2 * GAMS - General Algebraic Modeling System C++ API
3 *
4 * Copyright (c) 2017-2024 GAMS Software GmbH <support@gams.com>
5 * Copyright (c) 2017-2024 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 GAMSJOB_H
27#define GAMSJOB_H
28
29#include "gamslib_global.h"
30#include <string>
31#include <memory>
32#include <vector>
33#include <set>
34#include <unordered_map>
35#include "gamsengineconfiguration.h"
36
37namespace gams {
38
39class GAMSWorkspace;
40class GAMSModelInstance;
41class GAMSJobImpl;
42class GAMSOptions;
43class GAMSCheckpoint;
44class GAMSDatabase;
45
60class LIBSPEC GAMSJob
61{
62public:
65
68
72 GAMSJob operator=(const GAMSJob& other);
73
77 bool operator!=(const GAMSJob& other) const;
78
82 bool operator==(const GAMSJob& other) const;
83
86 bool isValid() const;
87
88 //TODO: complete run methods
89
91 void run();
92
95 void run(std::ostream& outstream);
96
99 void run(GAMSOptions& gamsOptions);
100
104 void run(GAMSOptions& gamsOptions, std::ostream& outstream);
105
109 void run(GAMSOptions& gamsOptions, GAMSDatabase db);
110
113 void run(GAMSCheckpoint gamsCheckpoint);
114
118 void run(GAMSOptions& gamsOptions, GAMSCheckpoint gamsCheckpoint);
119
126 void run(GAMSOptions& gamsOptions, const GAMSCheckpoint &gamsCheckpoint, std::ostream& output,
127 bool createOutDB, const std::vector<gams::GAMSDatabase> &databases);
128
139 void runEngine(const GAMSEngineConfiguration &engineConfiguration, GAMSOptions* gamsOptions,
140 gams::GAMSCheckpoint *checkpoint, std::ostream* output = nullptr,
141 const std::vector<gams::GAMSDatabase> &databases = {},
142 const std::set<std::string> &extraModelFiles = {},
143 const std::unordered_map<std::string, std::string> &engineOptions = {},
144 bool createOutDB = true, bool removeResults = true);
145
148
150 std::string name();
151
154
158 bool interrupt();
159
162 LogId logID();
163
164private:
165 friend class GAMSWorkspaceImpl;
166 GAMSJob(const std::shared_ptr<::gams::GAMSJobImpl>& impl);
167 GAMSJob(gams::GAMSWorkspace &ws, const std::string& jobName = "", const std::string& fileName = ""
168 , const GAMSCheckpoint *checkpoint = 0);
169
170private:
171 std::shared_ptr<::gams::GAMSJobImpl> mImpl;
172};
173
174} // namespace gams
175
176#endif // GAMSJOB_H
~GAMSJob()
Desctructor.
GAMSWorkspace workspace()
Get GAMSWorkspace containing GAMSJob.
void runEngine(const GAMSEngineConfiguration &engineConfiguration, GAMSOptions *gamsOptions, gams::GAMSCheckpoint *checkpoint, std::ostream *output=nullptr, const std::vector< gams::GAMSDatabase > &databases={}, const std::set< std::string > &extraModelFiles={}, const std::unordered_map< std::string, std::string > &engineOptions={}, bool createOutDB=true, bool removeResults=true)
bool operator!=(const GAMSJob &other) const
void run(GAMSOptions &gamsOptions, GAMSCheckpoint gamsCheckpoint)
void run(GAMSCheckpoint gamsCheckpoint)
bool interrupt()
void run(GAMSOptions &gamsOptions, GAMSDatabase db)
bool operator==(const GAMSJob &other) const
void run(std::ostream &outstream)
GAMSDatabase outDB()
Get GAMSDatabase created by Run method.
GAMSJob operator=(const GAMSJob &other)
GAMSJob()
Standard constructor.
void run(GAMSOptions &gamsOptions)
std::string name()
Retrieve name of GAMSJob.
void run(GAMSOptions &gamsOptions, const GAMSCheckpoint &gamsCheckpoint, std::ostream &output, bool createOutDB, const std::vector< gams::GAMSDatabase > &databases)
void run()
Run GAMSJob.
void run(GAMSOptions &gamsOptions, std::ostream &outstream)
bool isValid() const
Definition: gams.h:91