24 #include "OSInstance.h"
37 #include "OsiClpSolverInterface.hpp"
38 #include "OsiCbcSolverInterface.hpp"
39 #include "CbcModel.hpp"
51 cout <<
"Start Building the Model" << endl;
77 osinstance->
addObjective(-1,
"objfunction",
"max", 0.0, 1.0, objcoeff);
124 double *
values =
new double[ 8];
125 int *indexes =
new int[ 8];
126 int *starts =
new int[ 5];
148 cout <<
"Call setLinearConstraintCoefficients" << endl;
150 indexes, 0, 7, starts, 0, 4);
151 cout <<
"End Building the Model" << endl;
155 cout << osilwriter->
writeOSiL( osinstance);
157 cout <<
"Done writing the Model" << endl;
164 std::cout << solver->
osrl << std::endl;
182 std::cout << solver->
osrl << std::endl;
199 std::cout << solver->
osrl << std::endl;
210 cout <<
"Done with garbage collection" << endl;
216 std::cout << eclass.
errormsg << std::endl;
bool addVariable(int index, std::string name, double lowerBound, double upperBound, char type)
add a variable.
bool setLinearConstraintCoefficients(int numberOfValues, bool isColumnMajor, double *values, int valuesBegin, int valuesEnd, int *indexes, int indexesBegin, int indexesEnd, int *starts, int startsBegin, int startsEnd)
set linear constraint coefficients
std::string osrl
osrl holds the solution or result of the model
ObjValue ** obj
obj is a pointer to an array of ObjValue objects that give an index and objective function value for ...
std::string errormsg
errormsg is the error that is causing the exception to be thrown
int main(int argc, char *argv[])
ObjCoef ** coef
coef is pointer to an array of ObjCoef object pointers
OptimizationResult * optimization
optimization holds the fifth child of the OSResult specified by the OSrL Schema.
OSResult * osresult
osresult holds the solution or result of the model in-memory as an OSResult object ...
double getOptimalObjValue(int objIdx, int solIdx)
Get one solution's optimal objective value.
ObjectiveSolution * objectives
objectives holds the solution information for the objectives
virtual void buildSolverInstance()
The implementation of the corresponding virtual function.
bool bObjectivesModified
bObjectivesModified is true if the objective function data has been modified.
bool setConstraintNumber(int number)
set the number of constraints.
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
Variable ** var
Here we define a pointer to an array of var pointers.
double value
value is the value of the objective function coefficient corresponding to the variable with index idx...
bool setObjectiveNumber(int number)
set the number of objectives.
bool addConstraint(int index, std::string name, double lowerBound, double upperBound, double constant)
add a constraint.
bool addObjective(int index, std::string name, std::string maxOrMin, double constant, double weight, SparseVector *objectiveCoefficients)
add an objective.
double ub
ub corresponds to the optional attribute that holds the variable upper bound.
a sparse vector data structure
Variables * variables
variables is a pointer to a Variables object
OSInstance * osinstance
osinstance holds the problem instance in-memory as an OSInstance object
InstanceData * instanceData
A pointer to an InstanceData object.
OptimizationSolution ** solution
solution is an array of pointers to OptimizationSolution objects
ObjectiveValues * values
a pointer to an array of ObjectiveValues objects
Objective ** obj
coef is pointer to an array of ObjCoef object pointers
std::string sSolverName
sSolverName is the name of the Coin solver used, e.g.
bool setInstanceSource(std::string source)
set the instance source.
bool setInstanceDescription(std::string description)
set the instance description.
std::string writeOSiL(const OSInstance *theosinstance)
create an osil string from an OSInstance object
Objectives * objectives
objectives is a pointer to a Objectives object
Implements a solve method for the Coin solvers.
double * values
values holds a double array of nonzero values.
bool bVariablesModified
bVariablesModified is true if the variables data has been modified.
int * indexes
indexes holds an integer array of indexes whose corresponding values are nonzero. ...
double value
the value of the objective indexed by idx
bool setVariableNumber(int number)
set the number of variables.
The in-memory representation of an OSiL instance..
class used to make it easy to read and write files.
virtual void solve()
The implementation of the corresponding virtual function.
used for throwing exceptions.
Take an OSInstance object and write a string that validates against the OSiL schema.