List of all members | Public Member Functions | Protected Member Functions | Private Member Functions
ipo::ExternalOracle Class Reference

Detailed Description

An oracle that uses an external program. It calls a wrapper with the following arguments, followed by additional parameters which define the instance. All lists are delimited by whitespace or newline.

#include <ipo/external_oracle.h>

+ Inheritance diagram for ipo::ExternalOracle:

Public Member Functions

 ExternalOracle (const std::string &name, const std::string &program, const std::string &instance, const std::shared_ptr< OracleBase > &nextOracle=NULL, std::size_t maxInfeasibleIterations=4, double initialM=16)
 Creates an instance associated to nextOracle. More...
 
virtual ~ExternalOracle ()
 Destructor. More...
 
- Public Member Functions inherited from ipo::FaceOracleBase
virtual ~FaceOracleBase ()
 
virtual void setFace (const LinearConstraint &newFace)
 Restricts the oracle to the face defined by newFace. More...
 
- Public Member Functions inherited from ipo::OracleBase
const std::string & name () const
 Returns the name of the oracle. More...
 
const Spacespace () const
 Returns the ambient space. More...
 
std::size_t heuristicLevel () const
 Returns the heuristic level of this oracle. More...
 
void maximize (OracleResult &result, const soplex::VectorRational &objective, const ObjectiveBound &objectiveBound=ObjectiveBound(), std::size_t minHeuristic=0, std::size_t maxHeuristic=std::numeric_limits< std::size_t >::max())
 Runs the oracle to maximize the dense rational objective. More...
 
void maximize (OracleResult &result, const Vector &objective, const ObjectiveBound &objectiveBound=ObjectiveBound(), std::size_t minHeuristic=0, std::size_t maxHeuristic=std::numeric_limits< std::size_t >::max())
 Runs the oracle to maximize the sparse rational objective. More...
 

Protected Member Functions

virtual std::size_t maximizeImplementation (OracleResult &result, const soplex::VectorRational &objective, const ObjectiveBound &objectiveBound, std::size_t minHeuristic, std::size_t maxHeuristic, bool &sort, bool &checkDups)
 Oracle's implementation to maximize the dense rational objective. More...
 
- Protected Member Functions inherited from ipo::FaceOracleBase
 FaceOracleBase (const std::string &name, const std::shared_ptr< OracleBase > &nextOracle=NULL, std::size_t maxInfeasibleIterations=4, double initialM=16)
 Constructs an oracle with given name, optionally associated to nextOracle. More...
 
void initializeSpace (const Space &space)
 Initializes datastructures that require the oracle's ambient space. More...
 
virtual std::size_t maximizeController (OracleResult &result, const soplex::VectorRational &objective, const ObjectiveBound &objectiveBound, std::size_t maxHeuristic, std::size_t minHeuristic, bool &sort, bool &checkDups)
 Wrapper method that calls the oracle's implementation. More...
 
virtual const LinearConstraintcurrentFace ()
 Returns the current face. More...
 
- Protected Member Functions inherited from ipo::OracleBase
 OracleBase (const std::string &name, const std::shared_ptr< OracleBase > &nextOracle=NULL)
 Constructs an oracle with given name, optionally associated to nextOracle. More...
 
void initializeSpace (const Space &space)
 Initializes datastructures that require the oracle's ambient space. More...
 

Private Member Functions

Vector parseSolution (std::stringstream &stream)
 Parses the output of the external program. More...
 
void call (const std::string &parameters, std::stringstream &output)
 Calls the external program. More...
 

Constructor & Destructor Documentation

ipo::ExternalOracle::ExternalOracle ( const std::string &  name,
const std::string &  program,
const std::string &  instance,
const std::shared_ptr< OracleBase > &  nextOracle = NULL,
std::size_t  maxInfeasibleIterations = 4,
double  initialM = 16 
)

Creates an instance associated to nextOracle together with a temporary working directory.

Parameters
nameName of the oracle.
programLocation of the external program.
instanceSpecification of the instance.
nextOracleNext oracle to forward calls to.
maxInfeasibleIterationsMaximum number of iterations before (heuristically) checking if the face is empty.
initialMInitial value of $ M $.
virtual ipo::ExternalOracle::~ExternalOracle ( )
virtual

Destructor. It removes the temporary directory created in the constructor.

Member Function Documentation

virtual std::size_t ipo::ExternalOracle::maximizeImplementation ( OracleResult result,
const soplex::VectorRational &  objective,
const ObjectiveBound &  objectiveBound,
std::size_t  minHeuristic,
std::size_t  maxHeuristic,
bool &  sort,
bool &  checkDups 
)
protectedvirtual

This method is called by maximizeController() and contains the implementation of the oracle.

Parameters
resultAfter the call, contains the oracle's answer.
objectiveObjective vector $ c \in \mathbb{Q}^n $ to be maximized.
objectiveBoundObjective value $ \gamma $ that should be exceeded.
sortSet this variable to true if points must be sorted.
checkDupsSet this variable to true if points or rays must be checked for duplicates.

For requirements on the behavior, see Detailed Description of OracleBase.

Implements ipo::OracleBase.

Vector ipo::ExternalOracle::parseSolution ( std::stringstream &  stream)
private

Parses the output of the external program.

void ipo::ExternalOracle::call ( const std::string &  parameters,
std::stringstream &  output 
)
private

Calls the external program with arguments as specified in the class description. The current directory is the temporary one created in the constructor.