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 // there is a gmoNAinteger, but no gmoNAdouble
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);
191 osresult = osrl_reader.
readOSrL(osrl);
195 gevLogStat(
gev,
"Error parsing the OS result string:");
197 gmoModelStatSet(
gmo, ModelStat_ErrorNoSolution);
198 gmoSolveStatSet(
gmo, SolveStat_SystemErr);
std::string getGeneralMessage()
Get the general message.
int numberOfVar
the number of variable values that are in the solution
std::string getGeneralStatusType()
Get the general status type, which can be: success, error, warning.
std::string getSolutionStatusType(int solIdx)
Get the [i]th optimization solution status type, where i equals the given solution index...
ObjValue ** obj
obj is a pointer to an array of ObjValue objects that give an index and objective function value for ...
int idx
idx is the index on variable in the solution
std::string errormsg
errormsg is the error that is causing the exception to be thrown
DualVarValue ** con
con is a vector of DualVarValue objects that give an index and dual variable value for each constrain...
DualVariableValues * dualValues
a pointer to an array of DualVariableValues objects
OSResult * readOSrL(const std::string &posrl)
Get an OSResult object from an OSrL string.
GeneralResult * general
general holds the first child of the OSResult specified by the OSrL Schema.
The OptimizationSolution Class.
OptimizationResult * optimization
optimization holds the fifth child of the OSResult specified by the OSrL Schema.
ObjectiveSolution * objectives
objectives holds the solution information for the objectives
int numberOfVar
the number of variables which have values for this particular type of result
void writeSolution(OSResult &osresult)
Writes a solution into a GMO with the result given as OSResult object.
int numberOfCon
record the number of constraints for which values are given
VarValue ** var
a vector of VarValue objects, there will be one for each variable in the solution ...
VariableSolution * variables
variables holds the solution information for the variables
std::string name
the name of the result the user is defining
VariableValues * values
a pointer to a VariableValues object
int idx
the index of a variable in the solution
int getSolutionNumber()
get the number of solutions.
OptimizationSolution ** solution
solution is an array of pointers to OptimizationSolution objects
ConstraintSolution * constraints
constraints holds the solution information for the constraints
ObjectiveValues * values
a pointer to an array of ObjectiveValues objects
int idx
idx is the index on a constraint
OtherVariableResult ** other
a pointer to an array of other pointer objects for variables
OSrL2Gams(struct gmoRec *gmo_)
Constructor.
int numberOfOtherVariableResults
the number of types of variable results other than the value of the variable
double value
the value of the objective indexed by idx
std::string value
value holds a general value associated with a variable, for example, rather than the value of a varia...
used for throwing exceptions.
int getVariableNumber()
Get variable number.
double value
value of dual variable on the constraint indexed by idx
int getConstraintNumber()
Get constraint number.