Otawa  0.10
otawa::ilp::System Class Referenceabstract

An ILP system is a colletion of ILP constraint that may maximize or minimize some object function. More...

#include <otawa/ilp/System.h>

Inheritance diagram for otawa::ilp::System:
otawa::ilp::AbstractSystem

Classes

class  ConstIterator
 
class  ObjTermIterator
 

Public Member Functions

virtual ~System (void)
 
virtual ConstraintnewConstraint (Constraint::comparator_t comp, double constant=0)=0
 Build a new constraint that may be initialized by the user. More...
 
virtual ConstraintnewConstraint (const string &label, Constraint::comparator_t comp, double constant=0)=0
 
virtual bool solve (WorkSpace *ws=0)=0
 Solve the ILP system. More...
 
virtual void addObjectFunction (double coef, Var *var=0)=0
 Add a factor to the object function. More...
 
virtual double valueOf (Var *var)=0
 This method can only be called after the resolution of the system and returns the value of a variable. More...
 
virtual double value (void)=0
 Return the value of the optimized object function. More...
 
virtual VarnewVar (const string &name="")=0
 
virtual int countVars (void)=0
 Count the number of variables in the system. More...
 
virtual int countConstraints (void)=0
 Count the number of constraints in the system. More...
 
virtual
elm::datastruct::IteratorInst
< ilp::Constraint * > * 
constraints (void)=0
 
virtual
elm::datastruct::IteratorInst
< ilp::Constraint::Term > * 
objTerms (void)=0
 
virtual void exportLP (io::Output &out=elm::cout)=0
 Export the system to the given output using the LP format (lp_solve). More...
 
virtual void dumpSystem (io::Output &out=elm::cout)
 Dump the system in text format (as a default, call exportLP). More...
 
virtual void dumpSolution (io::Output &out=elm::cout)=0
 Dump the solution textually to the given output. More...
 
virtual void dump (elm::io::OutStream &out=elm::io::out)
 Dump the system to the given output. More...
 
virtual bool solve (WorkSpace *ws, otawa::Monitor &mon)
 Solve the ILP system in the given workspace using the given monitor to output logs. More...
 
virtual string lastErrorMessage (void)
 Get the message of the last error. More...
 
virtual ILPPluginplugin (void)
 Return the owner plugin. More...
 
virtual VarnewVar (Var::type_t type, const string &name="")=0
 Build a new variable with the given type. More...
 
bool hasDump (format_t fmt)
 Tests if it is possible to dump in the given format. More...
 
void dump (format_t fmt, elm::io::OutStream &out=elm::io::out)
 Dump the system to the given output and format. More...
 
void dumpLPSolve (elm::io::OutStream &out=elm::io::out)
 Dump in LPSolve format. More...
 
void dumpCPlex (elm::io::OutStream &out=elm::io::out)
 Dump system in CPlex format. More...
 
void dumpMOSEK (elm::io::OutStream &out=elm::io::out)
 Dump in MOSEK format. More...
 

Detailed Description

An ILP system is a colletion of ILP constraint that may maximize or minimize some object function.

Constructor & Destructor Documentation

virtual otawa::ilp::System::~System ( void  )
inlinevirtual

Member Function Documentation

virtual elm::datastruct::IteratorInst<ilp::Constraint*>* otawa::ilp::System::constraints ( void  )
pure virtual

Implemented in otawa::ilp::AbstractSystem.

Referenced by dumpLPSolve().

int otawa::ilp::System::countConstraints ( void  )
pure virtual

Count the number of constraints in the system.

Returns
Constraint count.

Implemented in otawa::ilp::AbstractSystem.

int otawa::ilp::System::countVars ( void  )
pure virtual

Count the number of variables in the system.

Returns
Variable count.

Implemented in otawa::ilp::AbstractSystem.

void otawa::ilp::System::dump ( elm::io::OutStream out = elm::io::out)
virtual

Dump the system to the given output.

The dumping format depends upon the actual used ILP engine. Usually, it is compatible with other tools of the ILP engine.

Parameters
outUsed output.
Deprecated:
Use dumpSystem() and dumpSolution() instead.

References dumpSolution(), and dumpSystem().

Referenced by otawa::ilp::AbstractSystem::exportLP(), and otawa::ilp::Output::processWorkSpace().

void otawa::ilp::System::dump ( format_t  fmt,
elm::io::OutStream out = elm::io::out 
)

Dump the system to the given output and format.

Parameters
outUsed output.
fmtUsed format

References otawa::ilp::CPLEX, otawa::ilp::DEFAULT, dumpCPlex(), dumpLPSolve(), dumpMOSEK(), dumpSystem(), otawa::ilp::LP_SOLVE, and otawa::ilp::MOSEK.

void otawa::ilp::System::dumpSolution ( io::Output out = elm::cout)
pure virtual

Dump the solution textually to the given output.

Parameters
outStream to output to (default to cout).

Implemented in otawa::ilp::AbstractSystem.

Referenced by dump().

void otawa::ilp::System::dumpSystem ( io::Output out = elm::cout)
virtual

Dump the system in text format (as a default, call exportLP).

Parameters
outStream to dump to (default to cout).

References exportLP().

Referenced by dump().

void otawa::ilp::System::exportLP ( io::Output out = elm::cout)
pure virtual

Export the system to the given output using the LP format (lp_solve).

Parameters
outStream to export to (default to cout).

Implemented in otawa::ilp::AbstractSystem.

Referenced by dumpSystem().

bool otawa::ilp::System::hasDump ( format_t  fmt)

Tests if it is possible to dump in the given format.

Parameters
fmtUsed format
Returns
Boolean

References otawa::ilp::CPLEX, otawa::ilp::DEFAULT, otawa::ilp::LP_SOLVE, and otawa::ilp::MOSEK.

string otawa::ilp::System::lastErrorMessage ( void  )
virtual

Get the message of the last error.

Since
1.2.0 ILP interface.
Returns
Last error message.

Referenced by otawa::ipet::WCETComputation::processWorkSpace().

virtual Constraint* otawa::ilp::System::newConstraint ( const string label,
Constraint::comparator_t  comp,
double  constant = 0 
)
pure virtual

Implemented in otawa::ilp::AbstractSystem.

Var * otawa::ilp::System::newVar ( Var::type_t  type,
const string name = "" 
)
pure virtual

Build a new variable with the given type.

Parameters
typeType of the variable.
nameVariable name.
Returns
Built variable.
Since
ILP 1.2.0

Implemented in otawa::ilp::AbstractSystem.

virtual elm::datastruct::IteratorInst<ilp::Constraint::Term>* otawa::ilp::System::objTerms ( void  )
pure virtual

Implemented in otawa::ilp::AbstractSystem.

ILPPlugin * otawa::ilp::System::plugin ( void  )
virtual

Return the owner plugin.

As a default, return null.

Returns
Owner plugin.

Referenced by otawa::ipet::WCETComputation::processWorkSpace().

boolean otawa::ilp::System::solve ( WorkSpace ws = 0)
pure virtual

Solve the ILP system.

Parameters
wsIf passed (default to null), the given workspace is used to test if the computation is cancelled in order to stop the solver.
Returns
True if the resolution is succesful or false else (mainly due to lack of constraint).

Referenced by otawa::ipet::WCETComputation::processWorkSpace(), and solve().

bool otawa::ilp::System::solve ( WorkSpace ws,
otawa::Monitor mon 
)
virtual

Solve the ILP system in the given workspace using the given monitor to output logs.

The workspace may be used to support cancellation or progression in user interface.

Parameters
wsCurrent workspace.
monMonitor to use.

References solve().

double otawa::ilp::System::value ( void  )
pure virtual

Return the value of the optimized object function.

Returns
Object function optimum.

Referenced by otawa::ipet::WCETComputation::processWorkSpace().

double otawa::ilp::System::valueOf ( Var var)
pure virtual

This method can only be called after the resolution of the system and returns the value of a variable.

It is an error to pass a variable not involved in the system.

Parameters
varVariable whose value is looked for.
Returns
Value of the variable.

Referenced by otawa::display::ILPSystemDisplayer::displayVar(), otawa::ilp::AbstractSystem::dumpSolution(), otawa::ilp::Var::eval(), otawa::ilp::Expression::eval(), otawa::ipet::WCETCountRecorder::processBB(), otawa::BBRatioDisplayer::processBB(), otawa::BBRatioDisplayer::processCFG(), and otawa::display::ILPSystemDisplayer::processWorkSpace().


The documentation for this class was generated from the following files: