10 #define _MP_model_hpp_
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);
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;
Semantic representation of a constraint in a Math Program.
Semantic representation of a linear constraint.
Symbolic representation of a linear expression.
This is the anchor point for all constructs in a FlopC++ model.
MP_model(OsiSolverInterface *s, Messenger *m=new NormalMessenger)
Constructs an MP_model from an OsiSolverInterface *.
OsiSolverInterface * Solver
OsiSolverInterface * operator->()
allows access to the OsiSolverInterface *
void maximize(const MP_expression &obj)
Binds the data and calls the solver to maximize the parameter obj objective expression.
Messenger * getMessenger()
Gets the current messenger.
void attach(OsiSolverInterface *solver=NULL)
attaches the symantic representation of a model and data to a particular OsiSolverInterface
void addRow(const Constraint &c)
Adds a constraint to the MP_model.
void add(MP_variable *v)
Adds a variable to the MP_model.
MP_status
Reflects the state of the solution from solve()
@ ABANDONED
if solve is called and solver abandons the problem (time?, iter limit?)
@ OPTIMAL
if the solve method is called and the optimal solution found.
@ PRIMAL_INFEASIBLE
if solve is called and solver finds model primal infeasible.
@ SOLVER_ONLY
A solver is placed in the constructor, but it is not yet attached or solved.
@ ATTACHED
A solver is attached, but not yet solved.
@ DUAL_INFEASIBLE
if solve is called and solver finds the model dual infeasible.
@ DETACHED
No solver is attached.
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...
MP_model & add(MP_constraint &c)
Adds a constrataint block to the model.
void silent()
used to silence FlopC++
void verbose()
used to help understanding and debugging FlopC++'s behavior.
MP_direction
used when calling the solve() method.
const double * rowActivity
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".
static MP_model * getCurrentModel()
Can be used to get the current model.
static MP_model & getDefaultModel()
Can be used to get the default model.
void setSolver(OsiSolverInterface *s)
allows for replacement of the solver used.
void detach()
detaches an OsiSolverInterface object from the model.
void minimize(const MP_expression &obj)
Binds the data and calls the solver to minimize the parameter obj objective expression.
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.
const double * reducedCost
void setObjective(const MP_expression &o)
sets the "current objective" to the parameter o
void minimize()
Binds the data and calls the solver to minimize the current objective expression.
MP_status getStatus() const
Returns the current status of the model-solver interaction.
Representation of a set for indexing into some other construct.
Symantic representation of a variable.
Inteface for hooking up to internal flopc++ message handling.
virtual void logMessage(int level, const char *const msg)
Internal use: used when Normal output is selected.
Internal use: used when Verbose output is selected.
All flopc++ code is contained within the flopc namespace.
std::ostream & operator<<(std::ostream &os, const MP_model::MP_status &condition)
allows print of result from call to solve();