10 #define _MP_model_hpp_ 19 #include <CoinPackedVector.hpp> 20 class OsiSolverInterface;
37 virtual void logMessage(
int level,
const char *
const msg){}
40 virtual void constraintDebug(std::string name,
const std::vector<Coef>& cfs) {}
41 virtual void objectiveDebug(
const std::vector<Coef>& cfs) {}
42 virtual void statistics(
int bm,
int m,
int bn,
int n,
int nz) {}
43 virtual void generationTime(
double t) {}
54 virtual void statistics(
int bm,
int m,
int bn,
int n,
int nz);
55 virtual void generationTime(
double t);
64 virtual void constraintDebug(std::string name,
const std::vector<Coef>& cfs);
65 virtual void objectiveDebug(
const std::vector<Coef>& cfs);
191 void attach(OsiSolverInterface *solver=NULL);
239 typedef std::set<MP_variable* >::iterator varIt;
240 typedef std::set<MP_constraint* >::iterator conIt;
249 static void assemble(std::vector<Coef>& v, std::vector<Coef>& av);
252 std::set<MP_constraint *> Constraints;
253 std::set<MP_variable *> Variables;
static MP_model & getDefaultModel()
Can be used to get the default model.
A solver is placed in the constructor, but it is not yet attached or solved.
OsiSolverInterface * operator->()
allows access to the OsiSolverInterface *
if solve is called and solver abandons the problem (time?, iter limit?)
void detach()
detaches an OsiSolverInterface object from the model.
Symbolic representation of a linear expression.
MP_model(OsiSolverInterface *s, Messenger *m=new NormalMessenger)
Constructs an MP_model from an OsiSolverInterface *.
std::ostream & operator<<(std::ostream &os, const MP_model::MP_status &condition)
allows print of result from call to solve();
Messenger * getMessenger()
Gets the current messenger.
Inteface for hooking up to internal flopc++ message handling.
MP_model & add(MP_constraint &c)
Adds a constrataint block to the model.
Semantic representation of a constraint in a Math Program.
void minimize_max(MP_set &d, const MP_expression &obj)
Binds the data and calls the solver to minimize maximum value of the parameter obj objective expressi...
const double * rowActivity
MP_model::MP_status solve(const MP_model::MP_direction &dir)
calls the appropriate solving methods in the OsiSolverInterface.
void maximize()
Binds the data and calls the solver to maximize the current objective expression. ...
void verbose()
used to help understanding and debugging FlopC++'s behavior.
A solver is attached, but not yet solved.
void addRow(const Constraint &c)
Adds a constraint to the MP_model.
void setObjective(const MP_expression &o)
sets the "current objective" to the parameter o
MP_status
Reflects the state of the solution from solve()
This is the anchor point for all constructs in a FlopC++ model.
void attach(OsiSolverInterface *solver=NULL)
attaches the symantic representation of a model and data to a particular OsiSolverInterface ...
All flopc++ code is contained within the flopc namespace.
OsiSolverInterface * Solver
void minimize()
Binds the data and calls the solver to minimize the current objective expression. ...
if solve is called and solver finds model primal infeasible.
Internal use: used when Verbose output is selected.
static MP_model * getCurrentModel()
Can be used to get the current model.
void silent()
used to silence FlopC++
Symantic representation of a variable.
if solve is called and solver finds the model dual infeasible.
Representation of a set for indexing into some other construct.
MP_status getStatus() const
Returns the current status of the model-solver interaction.
const double * reducedCost
Internal use: used when Normal output is selected.
const double * solution
Accessors for the results after a call to maximize()/minimize()
double getInfinity() const
Useful for getting an appropriate value to pass in as "infinity".
if the solve method is called and the optimal solution found.
void setSolver(OsiSolverInterface *s)
allows for replacement of the solver used.
virtual void logMessage(int level, const char *const msg)
MP_direction
used when calling the solve() method.
Semantic representation of a linear constraint.