Blis 0.95.0
Loading...
Searching...
No Matches
BlisConGenerator Class Reference

Interface between Blis and Cut Generation Library. More...

#include <BlisConGenerator.h>

+ Collaboration diagram for BlisConGenerator:

Public Member Functions

Constructors and destructors
 BlisConGenerator ()
 Default constructor.
 
 BlisConGenerator (BlisModel *model, CglCutGenerator *generator, const char *name=NULL, BlisCutStrategy strategy=BlisCutStrategyAuto, int cutGenerationFrequency_=1, bool normal=true, bool atSolution=false, bool infeasible=false)
 Useful constructor.
 
 BlisConGenerator (const BlisConGenerator &)
 Copy constructor.
 
BlisConGeneratoroperator= (const BlisConGenerator &rhs)
 Assignment operator.
 
virtual ~BlisConGenerator ()
 Destructor.
 
Generate Constraints
virtual bool generateConstraints (BcpsConstraintPool &conPool)
 Generate cons for the client model.
 
Gets and sets
BlisModelgetModel ()
 Set the client model.
 
void setModel (BlisModel *m)
 Set the model.
 
void refreshModel (BlisModel *model)
 Refresh the model.
 
void setName (const char *str)
 return name of generator.
 
std::string name () const
 return name of generator.
 
void setStrategy (BlisCutStrategy value)
 Set the con generation strategy.
 
BlisCutStrategy strategy () const
 Get the con generation interval.
 
void setCutGenerationFreq (int freq)
 Set the con generation strategy.
 
int cutGenerationFreq () const
 Get the con generation interval.
 
bool normal () const
 Get whether the con generator should be called in the normal place.
 
void setNormal (bool value)
 Set whether the con generator should be called in the normal place.
 
bool atSolution () const
 Get whether the con generator should be called when a solution is found.
 
void setAtSolution (bool value)
 Set whether the con generator should be called when a solution is found.
 
bool whenInfeasible () const
 Get whether the con generator should be called when the subproblem is found to be infeasible.
 
void setWhenInfeasible (bool value)
 Set whether the con generator should be called when the subproblem is found to be infeasible.
 
CglCutGenerator * generator () const
 Get the CglCutGenerator bound to this BlisConGenerator.
 
int numConsGenerated ()
 Get number of generated cons.
 
void addNumConsGenerated (int n)
 Increase the number of generated cons.
 
int numConsUsed ()
 Get number of used cons.
 
void addNumConsUsed (int n)
 Increase the number of generated cons.
 
double time () const
 Cpu time used.
 
void addTime (double t)
 Increase Cpu time used.
 
int calls () const
 Number called.
 
void addCalls (int n=1)
 Increase the number of called.
 
int noConsCalls () const
 Number called and no cons found.
 
void addNoConsCalls (int n=1)
 Increase the number of no cons called.
 

Protected Attributes

BlisModelmodel_
 The client model.
 
CglCutGenerator * generator_
 The CglCutGenerator object.
 
BlisCutStrategy strategy_
 When to call CglCutGenerator::generateCuts routine.
 
int cutGenerationFrequency_
 The frequency of calls to the cut generator.
 
std::string name_
 Name of generator.
 
bool normal_
 Whether to call the generator in the normal place.
 
bool atSolution_
 Whether to call the generator when a new solution is found.
 
bool whenInfeasible_
 Whether to call generator when a subproblem is found to be infeasible.
 
int numConsGenerated_
 Number of cons generated.
 
int numConsUsed_
 Number of cons used.
 
double time_
 Used CPU/User time.
 
int calls_
 The times of calling this generator.
 
int noConsCalls_
 The times of calling this generator and no cons found.
 

Detailed Description

Interface between Blis and Cut Generation Library.

BlisConGenerator is intended to provide an intelligent interface between Blis and the cutting plane algorithms in the CGL. A BlisConGenerator is bound to a CglCutGenerator and to an BlisModel. It contains parameters which control when and how the generateCuts method of the CglCutGenerator will be called.

The builtin decision criteria available to use when deciding whether to generate cons are: at root, autmatic, every X nodes, when a solution is found, and when a subproblem is found to be infeasible.

Definition at line 59 of file BlisConGenerator.h.

Constructor & Destructor Documentation

◆ BlisConGenerator() [1/3]

BlisConGenerator::BlisConGenerator ( )
inline

Default constructor.

Definition at line 120 of file BlisConGenerator.h.

◆ BlisConGenerator() [2/3]

BlisConGenerator::BlisConGenerator ( BlisModel * model,
CglCutGenerator * generator,
const char * name = NULL,
BlisCutStrategy strategy = BlisCutStrategyAuto,
int cutGenerationFrequency_ = 1,
bool normal = true,
bool atSolution = false,
bool infeasible = false )

Useful constructor.

◆ BlisConGenerator() [3/3]

BlisConGenerator::BlisConGenerator ( const BlisConGenerator & )

Copy constructor.

◆ ~BlisConGenerator()

virtual BlisConGenerator::~BlisConGenerator ( )
inlinevirtual

Destructor.

Definition at line 153 of file BlisConGenerator.h.

Member Function Documentation

◆ operator=()

BlisConGenerator & BlisConGenerator::operator= ( const BlisConGenerator & rhs)

Assignment operator.

◆ generateConstraints()

virtual bool BlisConGenerator::generateConstraints ( BcpsConstraintPool & conPool)
virtual

Generate cons for the client model.

Evaluate the state of the client model and decide whether to generate cons. The generated cons are inserted into and returned in the collection of cons cs.

The routine returns true if reoptimisation is needed (because the state of the solver interface has been modified).

◆ getModel()

BlisModel * BlisConGenerator::getModel ( )
inline

Set the client model.

In addition to setting the client model, refreshModel also calls the refreshSolver method of the CglCutGenerator object. Get a pointer to the model

Definition at line 183 of file BlisConGenerator.h.

◆ setModel()

void BlisConGenerator::setModel ( BlisModel * m)
inline

Set the model.

Definition at line 186 of file BlisConGenerator.h.

◆ refreshModel()

void BlisConGenerator::refreshModel ( BlisModel * model)

Refresh the model.

◆ setName()

void BlisConGenerator::setName ( const char * str)
inline

return name of generator.

Definition at line 192 of file BlisConGenerator.h.

◆ name()

std::string BlisConGenerator::name ( ) const
inline

return name of generator.

Definition at line 195 of file BlisConGenerator.h.

◆ setStrategy()

void BlisConGenerator::setStrategy ( BlisCutStrategy value)
inline

Set the con generation strategy.

Definition at line 198 of file BlisConGenerator.h.

◆ strategy()

BlisCutStrategy BlisConGenerator::strategy ( ) const
inline

Get the con generation interval.

Definition at line 201 of file BlisConGenerator.h.

◆ setCutGenerationFreq()

void BlisConGenerator::setCutGenerationFreq ( int freq)
inline

Set the con generation strategy.

Definition at line 204 of file BlisConGenerator.h.

◆ cutGenerationFreq()

int BlisConGenerator::cutGenerationFreq ( ) const
inline

Get the con generation interval.

Definition at line 207 of file BlisConGenerator.h.

◆ normal()

bool BlisConGenerator::normal ( ) const
inline

Get whether the con generator should be called in the normal place.

Definition at line 210 of file BlisConGenerator.h.

◆ setNormal()

void BlisConGenerator::setNormal ( bool value)
inline

Set whether the con generator should be called in the normal place.

Definition at line 213 of file BlisConGenerator.h.

◆ atSolution()

bool BlisConGenerator::atSolution ( ) const
inline

Get whether the con generator should be called when a solution is found.

Definition at line 217 of file BlisConGenerator.h.

◆ setAtSolution()

void BlisConGenerator::setAtSolution ( bool value)
inline

Set whether the con generator should be called when a solution is found.

Definition at line 221 of file BlisConGenerator.h.

◆ whenInfeasible()

bool BlisConGenerator::whenInfeasible ( ) const
inline

Get whether the con generator should be called when the subproblem is found to be infeasible.

Definition at line 225 of file BlisConGenerator.h.

◆ setWhenInfeasible()

void BlisConGenerator::setWhenInfeasible ( bool value)
inline

Set whether the con generator should be called when the subproblem is found to be infeasible.

Definition at line 229 of file BlisConGenerator.h.

◆ generator()

CglCutGenerator * BlisConGenerator::generator ( ) const
inline

Get the CglCutGenerator bound to this BlisConGenerator.

Definition at line 232 of file BlisConGenerator.h.

◆ numConsGenerated()

int BlisConGenerator::numConsGenerated ( )
inline

Get number of generated cons.

Definition at line 235 of file BlisConGenerator.h.

◆ addNumConsGenerated()

void BlisConGenerator::addNumConsGenerated ( int n)
inline

Increase the number of generated cons.

Definition at line 238 of file BlisConGenerator.h.

◆ numConsUsed()

int BlisConGenerator::numConsUsed ( )
inline

Get number of used cons.

Definition at line 241 of file BlisConGenerator.h.

◆ addNumConsUsed()

void BlisConGenerator::addNumConsUsed ( int n)
inline

Increase the number of generated cons.

Definition at line 244 of file BlisConGenerator.h.

◆ time()

double BlisConGenerator::time ( ) const
inline

Cpu time used.

Definition at line 247 of file BlisConGenerator.h.

◆ addTime()

void BlisConGenerator::addTime ( double t)
inline

Increase Cpu time used.

Definition at line 250 of file BlisConGenerator.h.

◆ calls()

int BlisConGenerator::calls ( ) const
inline

Number called.

Definition at line 253 of file BlisConGenerator.h.

◆ addCalls()

void BlisConGenerator::addCalls ( int n = 1)
inline

Increase the number of called.

Definition at line 256 of file BlisConGenerator.h.

◆ noConsCalls()

int BlisConGenerator::noConsCalls ( ) const
inline

Number called and no cons found.

Definition at line 259 of file BlisConGenerator.h.

◆ addNoConsCalls()

void BlisConGenerator::addNoConsCalls ( int n = 1)
inline

Increase the number of no cons called.

Definition at line 262 of file BlisConGenerator.h.

Member Data Documentation

◆ model_

BlisModel* BlisConGenerator::model_
protected

The client model.

Definition at line 63 of file BlisConGenerator.h.

◆ generator_

CglCutGenerator* BlisConGenerator::generator_
protected

The CglCutGenerator object.

Definition at line 66 of file BlisConGenerator.h.

◆ strategy_

BlisCutStrategy BlisConGenerator::strategy_
protected

When to call CglCutGenerator::generateCuts routine.

BlisCutStrategyNone: disable BlisCutStrategyRoot: just root BlisCutStrategyAuto: automatically decided by BLIS BlisCutStrategyPeriodic: Generate every 't' nodes

Definition at line 78 of file BlisConGenerator.h.

◆ cutGenerationFrequency_

int BlisConGenerator::cutGenerationFrequency_
protected

The frequency of calls to the cut generator.

Definition at line 81 of file BlisConGenerator.h.

◆ name_

std::string BlisConGenerator::name_
protected

Name of generator.

Definition at line 84 of file BlisConGenerator.h.

◆ normal_

bool BlisConGenerator::normal_
protected

Whether to call the generator in the normal place.

Definition at line 87 of file BlisConGenerator.h.

◆ atSolution_

bool BlisConGenerator::atSolution_
protected

Whether to call the generator when a new solution is found.

Definition at line 90 of file BlisConGenerator.h.

◆ whenInfeasible_

bool BlisConGenerator::whenInfeasible_
protected

Whether to call generator when a subproblem is found to be infeasible.

Definition at line 94 of file BlisConGenerator.h.

◆ numConsGenerated_

int BlisConGenerator::numConsGenerated_
protected

Number of cons generated.

Definition at line 101 of file BlisConGenerator.h.

◆ numConsUsed_

int BlisConGenerator::numConsUsed_
protected

Number of cons used.

Definition at line 104 of file BlisConGenerator.h.

◆ time_

double BlisConGenerator::time_
protected

Used CPU/User time.

Definition at line 107 of file BlisConGenerator.h.

◆ calls_

int BlisConGenerator::calls_
protected

The times of calling this generator.

Definition at line 110 of file BlisConGenerator.h.

◆ noConsCalls_

int BlisConGenerator::noConsCalls_
protected

The times of calling this generator and no cons found.

Definition at line 113 of file BlisConGenerator.h.


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