OBOE 0.1
Accpm::QpGenerator Class Reference

#include <QpGenerator.h>

List of all members.

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 AccpmVectorgetQueryPoint () 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 AccpmVectorgetRhs () const
virtual const AccpmVectorgetCurrentX () const
virtual const AccpmVectorgetCurrentZ () const
virtual const AccpmVectorgetCutType () 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

Detailed Description

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().


Constructor & Destructor Documentation

Accpm::QpGenerator::QpGenerator ( )

References _oracleTime, and _timer.

Accpm::QpGenerator::~QpGenerator ( ) [virtual]

References _manager, _method, and _param.


Member Function Documentation

int Accpm::QpGenerator::getActiveCuts ( const AccpmGenMatrix *&  cuts) const [virtual]
Returns:
The cuts(columns) stored in OBOE. This is the preferred way of getting the cuts as this returns a reference and does not need a copy of the cuts to be retunred. This function provides all the cuts "active" internally in OBOE. The cuts typically are given by the user via the Oracle::eval() function, but some of the cuts might be removed internally and hence are not active in OBOE. One typical reason for removing a cut would be the Filter parameter, which would remove a duplicate cut generated by the Oracle. There could be other strategies for removing cuts. The getActiveCuts() function enables the user to get a handle to the cuts which reflect the internal cuts in OBOE.

References _manager, and Accpm::Manager::getActiveCuts().

int Accpm::QpGenerator::getActiveCuts ( AccpmGenMatrix cuts) const [virtual]
Returns:
The cuts(columns) stored in OBOE

References _manager, and Accpm::Manager::getActiveCuts().

const AccpmVector * Accpm::QpGenerator::getCurrentX ( ) const [virtual]
Returns:
The current dual variables, x, associated with the formulation.

References _manager, and Accpm::Manager::getCurrentX().

const AccpmVector & Accpm::QpGenerator::getCurrentZ ( ) const [virtual]
Returns:
The epigraph variable, z.

References _manager, and Accpm::Manager::getCurrentZ().

const AccpmVector & Accpm::QpGenerator::getCutType ( ) const [virtual]
Returns:
A vector of cut indices to identify feasibility and optimality cuts. The feasibility cuts have a 0 and optimality cuts have i in the vector, where i is the index of the subproblem for which the cut was generated. For problems with NumSubProblems = 1, it returns 1 for optimality cuts. Basically, it returns the information provided by the user in the info matrix in the call to the Oracle::eval() function, the only difference is that the getCutType() function retunrs this information only for the active cuts. The indexing of the cut is with reference to the cuts returned by QpGenerator::getActiveCuts function.

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]
double Accpm::QpGenerator::getObjLB ( void  ) const [virtual]
Returns:
The objective lower bound reached so far.

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]
Returns:
The objective upper bound reached so far.

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]
Returns:
The Optimal objective value. This is a valid value only at the end of successful termination of OBOE i.e QpGenerator::run() returns a status of 2.

References _manager, _param, Accpm::Manager::getObjUB(), and Accpm::Parameters::getOptType().

const AccpmVector * Accpm::QpGenerator::getQueryPoint ( ) const [virtual]
Returns:
The query point at the current iteration.

References _manager, and Accpm::Manager::getCurrentY().

double Accpm::QpGenerator::getRelativeGap ( ) const [virtual]
Returns:
The current relative gap which is computed as: (getObjUB() - getObjLB())/|getObjUB()|;

References _manager, and Accpm::Manager::getRelativeGap().

const AccpmVector & Accpm::QpGenerator::getRhs ( ) const [virtual]
Returns:
The right-hand side values with respect to the current cuts returned by the getActiveCuts function. In other words it returns the vector c in the formulation of the constraints: Aty - Etz <= c where A represents the cuts(columns).

References _manager, and Accpm::Manager::getRhsCoef().

void Accpm::QpGenerator::init ( Parameters param,
Oracle oracle = 0 
) [virtual]
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]
void Accpm::QpGenerator::printHeader ( std::ostream &  s = std::cout) const [virtual]
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.

Returns:
It can have the following return values:

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.


Member Data Documentation

Referenced by init(), run(), and ~QpGenerator().

double Accpm::QpGenerator::_oracleTime [protected]

Referenced by output(), QpGenerator(), and run().

Referenced by output(), and QpGenerator().


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