Otawa
0.10
|
An ILP system is a colletion of ILP constraint that may maximize or minimize some object function. More...
#include <otawa/ilp/System.h>
Classes | |
class | ConstIterator |
class | ObjTermIterator |
Public Member Functions | |
virtual | ~System (void) |
virtual Constraint * | newConstraint (Constraint::comparator_t comp, double constant=0)=0 |
Build a new constraint that may be initialized by the user. More... | |
virtual Constraint * | newConstraint (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 Var * | newVar (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 ILPPlugin * | plugin (void) |
Return the owner plugin. More... | |
virtual Var * | newVar (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... | |
An ILP system is a colletion of ILP constraint that may maximize or minimize some object function.
|
inlinevirtual |
|
pure virtual |
Add a factor to the object function.
coef | Coefficient of the factor. |
var | Variable of the factor. |
Implemented in otawa::ilp::AbstractSystem.
Referenced by otawa::etime::EdgeTimeBuilder::contributeSplit(), otawa::etime::EdgeTimeBuilder::genForOneCost(), otawa::ipet::CachePenaltiesObjectFunctionBuilder::processBB(), otawa::ipet::BasicObjectFunctionBuilder::processBB(), otawa::tsim::TimeDeltaObjectFunctionModifier::processBB(), otawa::dcache::WCETFunctionBuilder::processBB(), otawa::branch::ConsBuilder::processBB(), otawa::tsim::Delta::processBBPath(), otawa::cat::CATConstraintBuilder::processLBlockSet(), otawa::ccg::ConstraintBuilder::processLBlockSet(), otawa::EdgeCAT2ConstraintBuilder::processWorkSpace(), and otawa::CAT2ConstraintBuilder::processWorkSpace().
|
pure virtual |
Implemented in otawa::ilp::AbstractSystem.
Referenced by dumpLPSolve().
|
pure virtual |
Count the number of constraints in the system.
Implemented in otawa::ilp::AbstractSystem.
|
pure virtual |
Count the number of variables in the system.
Implemented in otawa::ilp::AbstractSystem.
|
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.
out | Used output. |
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.
out | Used output. |
fmt | Used format |
References otawa::ilp::CPLEX, otawa::ilp::DEFAULT, dumpCPlex(), dumpLPSolve(), dumpMOSEK(), dumpSystem(), otawa::ilp::LP_SOLVE, and otawa::ilp::MOSEK.
void otawa::ilp::System::dumpCPlex | ( | elm::io::OutStream & | out = elm::io::out | ) |
Dump system in CPlex format.
_out | Output stream to use. |
References _, otawa::ilp::Constraint::EQ, otawa::ilp::Constraint::GE, elm::genstruct::HashTable< K, T, H >::get(), otawa::ilp::Constraint::GT, elm::genstruct::HashTable< K, T, H >::hasKey(), otawa::ilp::Constraint::LE, otawa::ilp::Constraint::LT, out, elm::genstruct::HashTable< K, T, H >::put(), and otawa::sign().
Referenced by dump().
void otawa::ilp::System::dumpLPSolve | ( | elm::io::OutStream & | out = elm::io::out | ) |
Dump in LPSolve format.
_out | Output stream. |
References elm::avl::Set< T, C >::add(), otawa::ilp::Var::BIN, otawa::ilp::Constraint::comparator(), otawa::ilp::Constraint::constant(), constraints(), cout, otawa::ilp::Var::FLOAT, otawa::ilp::Var::INT, otawa::ilp::Constraint::label(), otawa::sem::neg(), out, and otawa::ilp::Constraint::terms().
Referenced by dump().
void otawa::ilp::System::dumpMOSEK | ( | elm::io::OutStream & | out = elm::io::out | ) |
Dump in MOSEK format.
_out | Output stream. |
References _, otawa::ilp::Constraint::EQ, otawa::ilp::Constraint::GE, elm::genstruct::HashTable< K, T, H >::get(), otawa::ilp::Constraint::GT, elm::genstruct::HashTable< K, T, H >::hasKey(), otawa::ilp::Constraint::LE, otawa::ilp::Constraint::LT, out, elm::genstruct::HashTable< K, T, H >::put(), and otawa::sign().
Referenced by dump().
|
pure virtual |
Dump the solution textually to the given output.
out | Stream to output to (default to cout). |
Implemented in otawa::ilp::AbstractSystem.
Referenced by dump().
|
virtual |
Dump the system in text format (as a default, call exportLP).
out | Stream to dump to (default to cout). |
References exportLP().
Referenced by dump().
|
pure virtual |
Export the system to the given output using the LP format (lp_solve).
out | Stream 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.
fmt | Used format |
References otawa::ilp::CPLEX, otawa::ilp::DEFAULT, otawa::ilp::LP_SOLVE, and otawa::ilp::MOSEK.
|
virtual |
Get the message of the last error.
Referenced by otawa::ipet::WCETComputation::processWorkSpace().
|
pure virtual |
Build a new constraint that may be initialized by the user.
As the ILP system manage the memory of the constraint, the constraint must never be deleted by the user.
comp | Comparator used (one of Constraint::LT, LE, EQ, GT, GE). |
constant | Constant value. |
Implemented in otawa::ilp::AbstractSystem.
Referenced by otawa::ipet::ConstraintLoader::addConstraint(), otawa::ccg::ConstraintBuilder::addConstraintHeader(), otawa::etime::EdgeTimeBuilder::contributeSplit(), otawa::etime::StandardEventBuilder::handleVariableBranchPred(), otawa::etime::EventCollector::make(), otawa::ilp::model::operator()(), otawa::ipet::CachePenaltiesObjectFunctionBuilder::processBB(), otawa::branch::OnlyConsBuilder::processBB(), otawa::ipet::FlowFactConstraintBuilder::processBB(), otawa::tsim::Delta::processBBPath(), otawa::cat::CATConstraintBuilder::processLBlockSet(), otawa::ccg::ConstraintBuilder::processLBlockSet(), otawa::EdgeCAT2ConstraintBuilder::processWorkSpace(), otawa::CAT2OnlyConstraintBuilder::processWorkSpace(), and otawa::dcache::CatConstraintBuilder::processWorkSpace().
|
pure virtual |
Implemented in otawa::ilp::AbstractSystem.
Implemented in otawa::ilp::AbstractSystem.
Referenced by otawa::etime::EdgeTimeBuilder::contributeSplit(), otawa::tsim::BBPath::getVar(), otawa::etime::StandardEventBuilder::handleVariableBranchPred(), otawa::ipet::CachePenaltiesObjectFunctionBuilder::processBB(), otawa::branch::OnlyConsBuilder::processBB(), otawa::cat::CATConstraintBuilder::processLBlockSet(), otawa::ccg::ConstraintBuilder::processLBlockSet(), otawa::EdgeCAT2ConstraintBuilder::processWorkSpace(), otawa::CAT2OnlyConstraintBuilder::processWorkSpace(), and otawa::dcache::CatConstraintBuilder::processWorkSpace().
|
pure virtual |
Build a new variable with the given type.
type | Type of the variable. |
name | Variable name. |
Implemented in otawa::ilp::AbstractSystem.
|
pure virtual |
Implemented in otawa::ilp::AbstractSystem.
|
virtual |
Return the owner plugin.
As a default, return null.
Referenced by otawa::ipet::WCETComputation::processWorkSpace().
|
pure virtual |
Solve the ILP system.
ws | If passed (default to null), the given workspace is used to test if the computation is cancelled in order to stop the solver. |
Referenced by otawa::ipet::WCETComputation::processWorkSpace(), and solve().
|
virtual |
|
pure virtual |
Return the value of the optimized object function.
Referenced by otawa::ipet::WCETComputation::processWorkSpace().
|
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.
var | Variable whose value is looked for. |
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().