13#include "CoinHelperFunctions.hpp"
21#error "don't have header file for string"
29 : gmo(gmo_), gev(gmo_ ? (gevHandle_t)gmoEnvironment(gmo_) : NULL)
36 gmoModelStatSet(
gmo, ModelStat_ErrorNoSolution);
37 gmoSolveStatSet(
gmo, SolveStat_SolverErr);
38 gevLogStat(
gev,
"Error: OS result does not have header.");
43 gmoModelStatSet(
gmo, ModelStat_ErrorNoSolution);
44 gmoSolveStatSet(
gmo, SolveStat_SolverErr);
45 gevLogStatPChar(
gev,
"Error: OS result reports error: ");
51 gevLogStatPChar(
gev,
"Warning: OS result reports warning: ");
55 gmoSolveStatSet(
gmo, SolveStat_Normal);
59 gmoModelStatSet(
gmo, ModelStat_NoSolutionReturned);
63 gmoModelStatSet(
gmo, ModelStat_Unbounded);
67 gmoModelStatSet(
gmo, ModelStat_OptimalGlobal);
71 gmoModelStatSet(
gmo, ModelStat_OptimalLocal);
75 gmoModelStatSet(
gmo, ModelStat_OptimalGlobal);
79 gmoModelStatSet(
gmo, ModelStat_NonOptimalIntermed);
83 gmoModelStatSet(
gmo, ModelStat_NonOptimalIntermed);
87 gmoModelStatSet(
gmo, ModelStat_InfeasibleGlobal);
91 gmoSolveStatSet(
gmo, SolveStat_Iteration);
92 gmoModelStatSet(
gmo, ModelStat_InfeasibleIntermed);
96 gmoModelStatSet(
gmo, ModelStat_InfeasibleIntermed);
100 gmoModelStatSet(
gmo, ModelStat_ErrorUnknown);
104 gmoModelStatSet(
gmo, ModelStat_InfeasibleIntermed);
108 gmoModelStatSet(
gmo, ModelStat_ErrorUnknown);
113 gevLogStat(
gev,
"Error: Number of variables in OS result does not match with gams model.");
114 gmoModelStatSet(
gmo, ModelStat_ErrorNoSolution);
115 gmoSolveStatSet(
gmo, SolveStat_SystemErr);
120 gevLogStat(
gev,
"Error: Number of constraints in OS result does not match with gams model.");
121 gmoModelStatSet(
gmo, ModelStat_ErrorNoSolution);
122 gmoSolveStatSet(
gmo, SolveStat_SystemErr);
128#define SMAG_DBL_NA -1E20
129 int* colBasStat = CoinCopyOfArray((
int*)NULL, gmoN(
gmo), (
int)Bstat_Super);
130 int* colIndic = CoinCopyOfArray((
int*)NULL, gmoN(
gmo), (
int)Cstat_OK);
131 double* colMarg = CoinCopyOfArray((
double*)NULL, gmoN(
gmo),
SMAG_DBL_NA);
132 double* colLev = CoinCopyOfArray((
double*)NULL, gmoN(
gmo),
SMAG_DBL_NA);
134 int* rowBasStat = CoinCopyOfArray((
int*)NULL, gmoM(
gmo), (
int)Bstat_Super);
135 int* rowIndic = CoinCopyOfArray((
int*)NULL, gmoM(
gmo), (
int)Cstat_OK);
136 double* rowLev = CoinCopyOfArray((
double*)NULL, gmoM(
gmo),
SMAG_DBL_NA);
137 double* rowMarg = CoinCopyOfArray((
double*)NULL, gmoM(
gmo),
SMAG_DBL_NA);
170 gmoSetSolution8(
gmo, colLev, colMarg, rowMarg, rowLev, colBasStat, colIndic, rowBasStat, rowIndic);
195 gevLogStat(
gev,
"Error parsing the OS result string:");
197 gmoModelStatSet(
gmo, ModelStat_ErrorNoSolution);
198 gmoSolveStatSet(
gmo, SolveStat_SystemErr);
DualVariableValues * dualValues
a pointer to an array of DualVariableValues objects
double value
value of dual variable on the constraint indexed by idx
int idx
idx is the index on a constraint
DualVarValue ** con
con is a vector of DualVarValue objects that give an index and dual variable value for each constrain...
int numberOfCon
record the number of constraints for which values are given
used for throwing exceptions.
std::string errormsg
errormsg is the error that is causing the exception to be thrown
std::string getSolutionStatusType(int solIdx)
Get the [i]th optimization solution status type, where i equals the given solution index.
GeneralResult * general
general holds the first child of the OSResult specified by the OSrL Schema.
OptimizationResult * optimization
optimization holds the fifth child of the OSResult specified by the OSrL Schema.
std::string getGeneralMessage()
Get the general message.
int getSolutionNumber()
get the number of solutions.
int getConstraintNumber()
Get constraint number.
int getVariableNumber()
Get variable number.
std::string getGeneralStatusType()
Get the general status type, which can be: success, error, warning.
OSrL2Gams(struct gmoRec *gmo_)
Constructor.
void writeSolution(OSResult &osresult)
Writes a solution into a GMO with the result given as OSResult object.
OSResult * readOSrL(const std::string &posrl)
Get an OSResult object from an OSrL string.
double value
the value of the objective indexed by idx
ObjectiveValues * values
a pointer to an array of ObjectiveValues objects
ObjValue ** obj
obj is a pointer to an array of ObjValue objects that give an index and objective function value for ...
OptimizationSolution ** solution
solution is an array of pointers to OptimizationSolution objects
The OptimizationSolution Class.
VariableSolution * variables
variables holds the solution information for the variables
ObjectiveSolution * objectives
objectives holds the solution information for the objectives
ConstraintSolution * constraints
constraints holds the solution information for the constraints
std::string value
value holds a general value associated with a variable, for example, rather than the value of a varia...
int idx
the index of a variable in the solution
std::string name
the name of the result the user is defining
int numberOfVar
the number of variables which have values for this particular type of result
int idx
idx is the index on variable in the solution
OtherVariableResult ** other
a pointer to an array of other pointer objects for variables
int numberOfOtherVariableResults
the number of types of variable results other than the value of the variable
VariableValues * values
a pointer to a VariableValues object
VarValue ** var
a vector of VarValue objects, there will be one for each variable in the solution
int numberOfVar
the number of variable values that are in the solution