OBOE 0.1
|
#include <QpGenerator.h>
Public Member Functions | |
QpGenerator () | |
virtual | ~QpGenerator () |
virtual void | init (Parameters *param, Oracle *oracle=0) |
virtual int | run () |
virtual void | terminate () |
virtual void | output (std::ostream &os) |
virtual void | printHeader (std::ostream &s=std::cout) const |
virtual void | printIteration (const AccpmVector &val, const AccpmVector &val2, const AccpmGenMatrix &subGrad, const AccpmGenMatrix &subProblemIndex, std::ostream &os=std::cout) const |
virtual const AccpmVector * | getQueryPoint () const |
virtual double | getOptimalObj () const |
virtual double | getObjUB () const |
virtual double | getObjLB () const |
virtual double | getRelativeGap () const |
virtual int | getNumCuts () const |
virtual int | getActiveCuts (const AccpmGenMatrix *&cuts) const |
virtual int | getActiveCuts (AccpmGenMatrix &cuts) const |
virtual const AccpmVector & | getRhs () const |
virtual const AccpmVector * | getCurrentX () const |
virtual const AccpmVector & | getCurrentZ () const |
virtual const AccpmVector & | getCutType () const |
virtual ExitCode | getExitCode () const |
virtual void | save (const char *fileName) const |
virtual void | load (const char *fileName) |
Protected Attributes | |
Parameters * | _param |
Manager * | _manager |
Method * | _method |
Timer | _timer |
double | _oracleTime |
The class responsible for generating query points. It serves as the main interface to the User code, which implements the Oracle functionality.
QpGenerator is initiliazed by providing it a parameter file, the format for which is described in ProblemInput/param.oboe. It is also given handle to an oracle, which is the concrete Oracle created by the user for their specific application.
Once, initialized, the quiery points are generated by subsequent calls to run().
Accpm::QpGenerator::QpGenerator | ( | ) |
References _oracleTime, and _timer.
int Accpm::QpGenerator::getActiveCuts | ( | const AccpmGenMatrix *& | cuts | ) | const [virtual] |
References _manager, and Accpm::Manager::getActiveCuts().
int Accpm::QpGenerator::getActiveCuts | ( | AccpmGenMatrix & | cuts | ) | const [virtual] |
References _manager, and Accpm::Manager::getActiveCuts().
const AccpmVector * Accpm::QpGenerator::getCurrentX | ( | ) | const [virtual] |
References _manager, and Accpm::Manager::getCurrentX().
const AccpmVector & Accpm::QpGenerator::getCurrentZ | ( | ) | const [virtual] |
References _manager, and Accpm::Manager::getCurrentZ().
const AccpmVector & Accpm::QpGenerator::getCutType | ( | ) | const [virtual] |
References _manager, and Accpm::Manager::getSubProblemIndex().
ExitCode Accpm::QpGenerator::getExitCode | ( | ) | const [virtual] |
Return the status after an iteration. An exit code of value ITERATING means everything is okay and more iterations need to be performed till convergence.
References _manager, and Accpm::Manager::getExitCode().
int Accpm::QpGenerator::getNumCuts | ( | ) | const [virtual] |
References _manager, and Accpm::Manager::getNumCuts().
double Accpm::QpGenerator::getObjLB | ( | void | ) | const [virtual] |
References _manager, _param, Accpm::Manager::getObjLB(), Accpm::Manager::getObjUB(), Accpm::Parameters::getOptType(), and Accpm::OPT_MAX.
Referenced by printIteration().
double Accpm::QpGenerator::getObjUB | ( | void | ) | const [virtual] |
References _manager, _param, Accpm::Manager::getObjLB(), Accpm::Manager::getObjUB(), Accpm::Parameters::getOptType(), and Accpm::OPT_MAX.
Referenced by printIteration().
double Accpm::QpGenerator::getOptimalObj | ( | ) | const [virtual] |
References _manager, _param, Accpm::Manager::getObjUB(), and Accpm::Parameters::getOptType().
const AccpmVector * Accpm::QpGenerator::getQueryPoint | ( | ) | const [virtual] |
References _manager, and Accpm::Manager::getCurrentY().
double Accpm::QpGenerator::getRelativeGap | ( | ) | const [virtual] |
References _manager, and Accpm::Manager::getRelativeGap().
const AccpmVector & Accpm::QpGenerator::getRhs | ( | ) | const [virtual] |
References _manager, and Accpm::Manager::getRhsCoef().
void Accpm::QpGenerator::init | ( | Parameters * | param, |
Oracle * | oracle = 0 |
||
) | [virtual] |
References _manager, _method, _param, Accpm::Parameters::getStringParameter(), and Accpm::Parameters::setOracle().
void Accpm::QpGenerator::load | ( | const char * | fileName | ) | [virtual] |
Load the state of the QpGenerator object from fileName which would have been saved by a previous call to save. This requires the use of serailialization library provided by boost. Refer --with-serialization option when configuring the system.
Ensure that the QpGenerator object is initialized via init() call prior to laoding the internal state via the load() call.
void Accpm::QpGenerator::output | ( | std::ostream & | os | ) | [virtual] |
Display some useful statistics for the iterations at the end of the run.
References _manager, _oracleTime, _param, _timer, Accpm::Manager::getBestY(), Accpm::Parameters::getIntParameter(), Accpm::Manager::getNumInnerIterations(), Accpm::Manager::getNumOuterIteration(), and Accpm::Manager::output().
void Accpm::QpGenerator::printHeader | ( | std::ostream & | s = std::cout | ) | const [virtual] |
References _manager, _param, Accpm::Parameters::getIntParameter(), and Accpm::Manager::getNumOuterIteration().
Referenced by run().
void Accpm::QpGenerator::printIteration | ( | const AccpmVector & | val, |
const AccpmVector & | val2, | ||
const AccpmGenMatrix & | subGrad, | ||
const AccpmGenMatrix & | subProblemIndex, | ||
std::ostream & | os = std::cout |
||
) | const [virtual] |
References _manager, _param, AccpmLADotProd(), Accpm::Parameters::getB(), Accpm::Manager::getCurrentY(), Accpm::Parameters::getIntParameter(), Accpm::Manager::getNumInnerIterations(), Accpm::Manager::getNumOuterIteration(), getObjLB(), getObjUB(), Accpm::Parameters::getPi(), Accpm::Manager::getRelativeGap(), Accpm::Manager::isCurrentPointFeasible(), and Accpm::AccpmVector::sum().
Referenced by run().
int Accpm::QpGenerator::run | ( | ) | [virtual] |
Each call to run() generates the next query point.
Typically this function is put in a while loop: while(run() == 0) {
// User Code
}
This method internally calls the eval() function of the Oracle to compute the query point.
0 on success.
1 If the number of outer iterations equals the MaxOuterIteration value.
2 RelativeGap has converged according to the tolerance criterion controlled by parameter tolerance.
3 If the user requests termination by giving a non-zero return value for the eval() function.
References _manager, _method, _oracleTime, _param, Accpm::Oracle::computesBound(), Accpm::OracleFunction::eval(), Accpm::Manager::getCurrentY(), Accpm::Manager::getExitCode(), Accpm::Oracle::getF1(), Accpm::Oracle::getF2(), Accpm::Parameters::getIntParameter(), Accpm::Manager::getNumOuterIteration(), Accpm::Oracle::getObjectiveFunctionBound(), Accpm::Manager::getObjLB(), Accpm::Parameters::getOptType(), Accpm::Parameters::getOracle(), Accpm::Manager::isCurrentPointFeasible(), Accpm::MAX_OUTER_ITERATIONS, printHeader(), printIteration(), Accpm::RELATIVE_GAP_REACHED, Accpm::Method::run(), Accpm::Manager::setExitCode(), Accpm::Manager::update1(), Accpm::Manager::update2(), Accpm::Manager::updateLB(), Accpm::Manager::updatePreviousPhase2(), and Accpm::USER_STOP.
void Accpm::QpGenerator::save | ( | const char * | fileName | ) | const [virtual] |
Save the state of the QpGenerator object to be able to re-start in future, if desired. The state is saved in fileName. This requires the use of serialization library provided by boost. Refer --with-serialization option when configuring the system.
Saves the internal structures for the QpGenerator object. Note that it only saves its own internal structures, the internals of the Parameters and Oracle are not saved with this command.
void Accpm::QpGenerator::terminate | ( | ) | [virtual] |
Clean-up and shutdown of the QpGenerator object.
Manager* Accpm::QpGenerator::_manager [protected] |
Method* Accpm::QpGenerator::_method [protected] |
Referenced by init(), run(), and ~QpGenerator().
double Accpm::QpGenerator::_oracleTime [protected] |
Referenced by output(), QpGenerator(), and run().
Parameters* Accpm::QpGenerator::_param [protected] |
Referenced by getObjLB(), getObjUB(), getOptimalObj(), init(), output(), printHeader(), printIteration(), run(), and ~QpGenerator().
Timer Accpm::QpGenerator::_timer [protected] |
Referenced by output(), and QpGenerator().