Loading...
Searching...
No Matches
gamsmodelinstance.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 GAMSMODELINSTANCE_H
27#define GAMSMODELINSTANCE_H
28
29#include <string>
30#include <memory>
31#include <vector>
32#include "gamsenum.h"
33#include "gamsmodifier.h"
34#include "gamsmodelinstanceopt.h"
35
36namespace gams {
37
38class GAMSCheckpoint;
39class GAMSDatabase;
40class GAMSOptions;
41class GAMSModelInstanceImpl;
42
125class LIBSPEC GAMSModelInstance
126{
127public:
130
135
139 bool operator!=(const GAMSModelInstance& other) const;
140
144 bool operator==(const GAMSModelInstance& other) const;
145
148 bool isValid() const;
149
152
157 void instantiate(const std::string& modelDefinition, const gams::GAMSOptions& options
158 , const std::vector<gams::GAMSModifier>& modifiers = { });
159
166 void instantiate(const std::string& modelDefinition, const gams::GAMSOptions& options
167 , const GAMSModifier &modifier1 = GAMSModifier(), const GAMSModifier &modifier2 = GAMSModifier()
168 , const GAMSModifier &modifier3 = GAMSModifier());
169
173 void instantiate(const std::string& modelDefinition, const std::vector<gams::GAMSModifier>& modifiers = { });
174
180 void instantiate(const std::string& modelDefinition, const GAMSModifier &modifier1
181 , const GAMSModifier &modifier2 = GAMSModifier(), const GAMSModifier &modifier3 = GAMSModifier());
182
187 void solve(GAMSEnum::SymbolUpdateType updateType, std::ostream& output, GAMSModelInstanceOpt miOpt);
188
192
195 void solve(std::ostream& output);
196
199 void solve(GAMSEnum::SymbolUpdateType updateType = GAMSEnum::SymbolUpdateType::BaseCase);
200
203
205 std::string modelStatusAsString();
206
209
211 std::string solveStatusAsString();
212
216 GAMSModelInstance copyModelInstance(std::string modelInstanceName = "");
217
219 void interrupt();
220
224
227 std::string name();
228
231 LogId logID();
232
233private:
234 friend class GAMSCheckpointImpl;
235 GAMSModelInstance(const std::shared_ptr<GAMSModelInstanceImpl>& impl);
236 GAMSModelInstance(GAMSCheckpoint& checkpoint, const std::string& modelInstanceName = "");
237
238private:
239 std::shared_ptr<GAMSModelInstanceImpl> mImpl;
240};
241
242} // namespace gams
243
244#endif // GAMSMODELINSTANCE_H
SymbolUpdateType
Symbol update type.
Definition: gamsenum.h:208
ModelStat
Model Solution Status.
Definition: gamsenum.h:119
SolveStat
Solver termination condition.
Definition: gamsenum.h:101
The GAMSModelInstanceOpt can be used to customize the GAMSModelInstance.solve() routine.
std::string solveStatusAsString()
Get solve state as string.
void solve(GAMSEnum::SymbolUpdateType updateType, std::ostream &output, GAMSModelInstanceOpt miOpt)
void solve(GAMSModelInstanceOpt miOpt)
void interrupt()
Send interrupt signal to running GAMSModelInstance.
bool operator!=(const GAMSModelInstance &other) const
void instantiate(const std::string &modelDefinition, const gams::GAMSOptions &options, const std::vector< gams::GAMSModifier > &modifiers={ })
GAMSEnum::SolveStat solveStatus()
Get solve state.
void solve(GAMSEnum::SymbolUpdateType updateType=GAMSEnum::SymbolUpdateType::BaseCase)
std::string modelStatusAsString()
Get model state as string.
void instantiate(const std::string &modelDefinition, const GAMSModifier &modifier1, const GAMSModifier &modifier2=GAMSModifier(), const GAMSModifier &modifier3=GAMSModifier())
void instantiate(const std::string &modelDefinition, const gams::GAMSOptions &options, const GAMSModifier &modifier1=GAMSModifier(), const GAMSModifier &modifier2=GAMSModifier(), const GAMSModifier &modifier3=GAMSModifier())
bool operator==(const GAMSModelInstance &other) const
GAMSCheckpoint checkpoint()
void instantiate(const std::string &modelDefinition, const std::vector< gams::GAMSModifier > &modifiers={ })
void solve(std::ostream &output)
GAMSEnum::ModelStat modelStatus()
Get model state.
GAMSModelInstance & operator=(const GAMSModelInstance &other)
GAMSModelInstance copyModelInstance(std::string modelInstanceName="")
GAMSDatabase syncDb()
Retrieve GAMSDatabase used to synchronize modifiable data.
GAMSModelInstance()
Standard constructor.
Definition: gams.h:91