This is the anchor point for all constructs in a FlopC++ model. More...
#include <MP_model.hpp>
Public Types | |
enum | MP_direction { MINIMIZE = 1, MAXIMIZE = -1 } |
used when calling the solve() method. More... | |
enum | MP_status { OPTIMAL, PRIMAL_INFEASIBLE, DUAL_INFEASIBLE, ABANDONED, SOLVER_ONLY, ATTACHED, DETACHED } |
Reflects the state of the solution from solve(). More... | |
Public Member Functions | |
MP_model (OsiSolverInterface *s, Messenger *m=new NormalMessenger) | |
Constructs an MP_model from an OsiSolverInterface *. | |
~MP_model () | |
MP_status | getStatus () const |
Returns the current status of the model-solver interaction. | |
void | silent () |
used to silence FlopC++ | |
void | verbose () |
used to help understanding and debugging FlopC++'s behavior. | |
void | setSolver (OsiSolverInterface *s) |
allows for replacement of the solver used. | |
OsiSolverInterface * | operator-> () |
allows access to the OsiSolverInterface * | |
MP_model & | add (MP_constraint &constraint) |
Adds a constrataint block to the model. | |
void | maximize () |
Binds the data and calls the solver to maximize the current objective expression. | |
void | maximize (const MP_expression &obj) |
Binds the data and calls the solver to maximize the parameter obj objective expression. | |
void | minimize () |
Binds the data and calls the solver to minimize the current objective expression. | |
void | minimize (const MP_expression &obj) |
Binds the data and calls the solver to minimize the parameter obj objective expression. | |
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 expression. | |
void | setObjective (const MP_expression &o) |
sets the "current objective" to the parameter o | |
void | attach (OsiSolverInterface *solver=0) |
attaches the symantic representation of a model and data to a particular OsiSolverInterface | |
void | detach () |
detaches an OsiSolverInterface object from the model. | |
MP_model::MP_status | solve (const MP_model::MP_direction &dir) |
calls the appropriate solving methods in the OsiSolverInterface. | |
double | getInfinity () const |
Accessors for the results after a call to maximize()/minimize(). | |
void | add (MP_variable *v) |
Adds a variable to the MP_model. | |
void | addRow (const Constraint &constraint) |
Adds a constraint to the MP_model. | |
Messenger * | getMessenger () |
Gets the current messenger. | |
Static Public Member Functions | |
static MP_model & | getDefaultModel () |
Can be used to get the default model. | |
static MP_model * | getCurrentModel () |
Can be used to get the current model. | |
Public Attributes | |
OsiSolverInterface * | Solver |
Private Types | |
typedef std::set< MP_variable * > ::iterator | varIt |
typedef std::set < MP_constraint * >::iterator | conIt |
Private Member Functions | |
MP_model (const MP_model &) | |
MP_model & | operator= (const MP_model &) |
void | add (MP_constraint *constraint) |
Static Private Member Functions | |
static void | assemble (vector< MP::Coef > &v, vector< MP::Coef > &av) |
Private Attributes | |
Messenger * | messenger |
MP_expression | Objective |
set< MP_constraint * > | Constraints |
set< MP_variable * > | Variables |
int | m |
int | n |
int | nz |
int * | Cst |
int * | Clg |
int * | Rnr |
double * | Elm |
double * | bl |
double * | bu |
double * | c |
double * | l |
double * | u |
MP_status | mSolverState |
Static Private Attributes | |
static MP_model & | default_model |
static MP_model * | current_model |
Friends | |
class | MP_constraint |
This is the anchor point for all constructs in a FlopC++ model.
The constructors take an OsiSolverInterface, and (optionally) a replacemente for the Messenger class. There are some built-in changes to the verbosity for output.
The main methods to use are:
Definition at line 90 of file MP_model.hpp.
typedef std::set<MP_variable* >::iterator flopc::MP_model::varIt [private] |
Definition at line 234 of file MP_model.hpp.
typedef std::set<MP_constraint* >::iterator flopc::MP_model::conIt [private] |
Definition at line 235 of file MP_model.hpp.
used when calling the solve() method.
Definition at line 94 of file MP_model.hpp.
Reflects the state of the solution from solve().
Definition at line 98 of file MP_model.hpp.
flopc::MP_model::MP_model | ( | OsiSolverInterface * | s, | |
Messenger * | m = new NormalMessenger | |||
) |
Constructs an MP_model from an OsiSolverInterface *.
flopc::MP_model::~MP_model | ( | ) |
flopc::MP_model::MP_model | ( | const MP_model & | ) | [private] |
MP_status flopc::MP_model::getStatus | ( | ) | const [inline] |
Returns the current status of the model-solver interaction.
This method will return the current understanding of the model in regard to the solver's state.
Definition at line 129 of file MP_model.hpp.
void flopc::MP_model::silent | ( | ) | [inline] |
used to silence FlopC++
Definition at line 133 of file MP_model.hpp.
void flopc::MP_model::verbose | ( | ) | [inline] |
used to help understanding and debugging FlopC++'s behavior.
Definition at line 138 of file MP_model.hpp.
void flopc::MP_model::setSolver | ( | OsiSolverInterface * | s | ) | [inline] |
allows for replacement of the solver used.
Definition at line 144 of file MP_model.hpp.
OsiSolverInterface* flopc::MP_model::operator-> | ( | ) | [inline] |
allows access to the OsiSolverInterface *
Definition at line 149 of file MP_model.hpp.
MP_model& flopc::MP_model::add | ( | MP_constraint & | constraint | ) |
Adds a constrataint block to the model.
void flopc::MP_model::maximize | ( | ) |
Binds the data and calls the solver to maximize the current objective expression.
void flopc::MP_model::maximize | ( | const MP_expression & | obj | ) |
Binds the data and calls the solver to maximize the parameter obj objective expression.
void flopc::MP_model::minimize | ( | ) |
Binds the data and calls the solver to minimize the current objective expression.
void flopc::MP_model::minimize | ( | const MP_expression & | obj | ) |
Binds the data and calls the solver to minimize the parameter obj objective expression.
void flopc::MP_model::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 expression.
void flopc::MP_model::setObjective | ( | const MP_expression & | o | ) |
sets the "current objective" to the parameter o
void flopc::MP_model::attach | ( | OsiSolverInterface * | solver = 0 |
) |
attaches the symantic representation of a model and data to a particular OsiSolverInterface
void flopc::MP_model::detach | ( | ) |
detaches an OsiSolverInterface object from the model.
In essence, this will clean up any intermediate storage. A model may then be attached to another solverInterface.
MP_model::MP_status flopc::MP_model::solve | ( | const MP_model::MP_direction & | dir | ) |
calls the appropriate solving methods in the OsiSolverInterface.
double flopc::MP_model::getInfinity | ( | ) | const |
Accessors for the results after a call to maximize()/minimize().
should these be private with accessors? What if not set yet?
what if not a complete result? What if only one LP in the IP?
Useful for getting an appropriate value to pass in as "infinity"
void flopc::MP_model::add | ( | MP_variable * | v | ) |
Adds a variable to the MP_model.
void flopc::MP_model::addRow | ( | const Constraint & | constraint | ) |
Adds a constraint to the MP_model.
static MP_model& flopc::MP_model::getDefaultModel | ( | ) | [static] |
Can be used to get the default model.
static MP_model* flopc::MP_model::getCurrentModel | ( | ) | [static] |
Can be used to get the current model.
Messenger* flopc::MP_model::getMessenger | ( | ) | [inline] |
Gets the current messenger.
Definition at line 230 of file MP_model.hpp.
static void flopc::MP_model::assemble | ( | vector< MP::Coef > & | v, | |
vector< MP::Coef > & | av | |||
) | [static, private] |
void flopc::MP_model::add | ( | MP_constraint * | constraint | ) | [private] |
friend class MP_constraint [friend] |
Definition at line 91 of file MP_model.hpp.
MP_model& flopc::MP_model::default_model [static, private] |
Definition at line 236 of file MP_model.hpp.
MP_model* flopc::MP_model::current_model [static, private] |
Definition at line 237 of file MP_model.hpp.
Messenger* flopc::MP_model::messenger [private] |
Definition at line 241 of file MP_model.hpp.
MP_expression flopc::MP_model::Objective [private] |
Definition at line 246 of file MP_model.hpp.
set<MP_constraint *> flopc::MP_model::Constraints [private] |
Definition at line 247 of file MP_model.hpp.
set<MP_variable *> flopc::MP_model::Variables [private] |
Definition at line 248 of file MP_model.hpp.
Definition at line 251 of file MP_model.hpp.
int flopc::MP_model::m [private] |
Definition at line 253 of file MP_model.hpp.
int flopc::MP_model::n [private] |
Definition at line 254 of file MP_model.hpp.
int flopc::MP_model::nz [private] |
Definition at line 255 of file MP_model.hpp.
int* flopc::MP_model::Cst [private] |
Definition at line 256 of file MP_model.hpp.
int* flopc::MP_model::Clg [private] |
Definition at line 257 of file MP_model.hpp.
int* flopc::MP_model::Rnr [private] |
Definition at line 258 of file MP_model.hpp.
double* flopc::MP_model::Elm [private] |
Definition at line 259 of file MP_model.hpp.
double* flopc::MP_model::bl [private] |
Definition at line 260 of file MP_model.hpp.
double* flopc::MP_model::bu [private] |
Definition at line 261 of file MP_model.hpp.
double* flopc::MP_model::c [private] |
Definition at line 262 of file MP_model.hpp.
double* flopc::MP_model::l [private] |
Definition at line 263 of file MP_model.hpp.
double* flopc::MP_model::u [private] |
Definition at line 264 of file MP_model.hpp.
MP_status flopc::MP_model::mSolverState [private] |
Definition at line 265 of file MP_model.hpp.