#include <BlisConGenerator.h>
Inheritance diagram for BlisConGenerator:
Public Member Functions | |
Constructors and destructors | |
BlisConGenerator () | |
Default constructor. | |
BlisConGenerator (BlisModel *model, CglCutGenerator *generator, const char *name=NULL, int strategy=0, bool normal=true, bool atSolution=false, bool infeasible=false) | |
Useful constructor. | |
BlisConGenerator (const BlisConGenerator &) | |
Copy constructor. | |
BlisConGenerator & | operator= (const BlisConGenerator &rhs) |
Assignment operator. | |
~BlisConGenerator () | |
Destructor. | |
Generate Cons | |
bool | generateCons (OsiCuts &cs, bool fullScan) |
Generate cons for the client model. | |
Gets and sets | |
void | refreshModel (BlisModel *model) |
Set the client model. | |
const char * | name () const |
return name of generator. | |
void | setStrategy (int value) |
Set the con generation strategy. | |
int | strategy () 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 () |
Cpu time used. | |
void | addTime (double t) |
Increase Cpu time used. | |
int | calls () |
Number called. | |
void | addCalls (int n=1) |
Increase the number of called. | |
int | noConsCalls () |
Number called and no cons found. | |
void | addNoConsCalls (int n=1) |
Increase the number of no cons called. | |
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. | |
BlisConGenerator & | operator= (const BlisConGenerator &rhs) |
Assignment operator. | |
virtual | ~BlisConGenerator () |
Destructor. | |
Generate Constraints | |
virtual bool | generateConstraints (BcpsConstraintPool &conPool) |
Generate cons for the client model. | |
Gets and sets | |
BlisModel * | getModel () |
Get a pointer to the 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 | |
BlisModel * | model_ |
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. | |
Private Attributes | |
BlisModel * | model_ |
The client model. | |
CglCutGenerator * | generator_ |
The CglCutGenerator object. | |
int | strategy_ |
When to call CglCutGenerator::generateCuts routine. | |
char * | 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. |
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 57 of file BlisConGenerator.h.
BlisConGenerator::BlisConGenerator | ( | ) | [inline] |
BlisConGenerator::BlisConGenerator | ( | BlisModel * | model, | |
CglCutGenerator * | generator, | |||
const char * | name = NULL , |
|||
int | strategy = 0 , |
|||
bool | normal = true , |
|||
bool | atSolution = false , |
|||
bool | infeasible = false | |||
) |
Useful constructor.
BlisConGenerator::BlisConGenerator | ( | const BlisConGenerator & | ) |
Copy constructor.
BlisConGenerator::~BlisConGenerator | ( | ) | [inline] |
BlisConGenerator::BlisConGenerator | ( | ) | [inline] |
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::BlisConGenerator | ( | const BlisConGenerator & | ) |
Copy constructor.
virtual BlisConGenerator::~BlisConGenerator | ( | ) | [inline, virtual] |
BlisConGenerator& BlisConGenerator::operator= | ( | const BlisConGenerator & | rhs | ) |
Assignment operator.
bool BlisConGenerator::generateCons | ( | OsiCuts & | cs, | |
bool | fullScan | |||
) |
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
.
If fullScan
is true, the generator is obliged to call the CGL generateCuts
routine. Otherwise, it is free to make a local decision. The current implementation uses strategy_
to decide.
The routine returns true if reoptimisation is needed (because the state of the solver interface has been modified).
void BlisConGenerator::refreshModel | ( | BlisModel * | model | ) |
Set the client model.
In addition to setting the client model, refreshModel also calls the refreshSolver
method of the CglCutGenerator object.
const char* BlisConGenerator::name | ( | ) | const [inline] |
void BlisConGenerator::setStrategy | ( | int | value | ) | [inline] |
Set the con generation strategy.
Definition at line 188 of file BlisConGenerator.h.
References strategy_.
int BlisConGenerator::strategy | ( | ) | const [inline] |
Get the con generation interval.
Definition at line 191 of file BlisConGenerator.h.
References strategy_.
bool BlisConGenerator::normal | ( | ) | const [inline] |
Get whether the con generator should be called in the normal place.
Definition at line 194 of file BlisConGenerator.h.
References normal_.
void BlisConGenerator::setNormal | ( | bool | value | ) | [inline] |
Set whether the con generator should be called in the normal place.
Definition at line 197 of file BlisConGenerator.h.
References normal_.
bool BlisConGenerator::atSolution | ( | ) | const [inline] |
Get whether the con generator should be called when a solution is found.
Definition at line 201 of file BlisConGenerator.h.
References atSolution_.
void BlisConGenerator::setAtSolution | ( | bool | value | ) | [inline] |
Set whether the con generator should be called when a solution is found.
Definition at line 205 of file BlisConGenerator.h.
References atSolution_.
bool BlisConGenerator::whenInfeasible | ( | ) | const [inline] |
Get whether the con generator should be called when the subproblem is found to be infeasible.
Definition at line 209 of file BlisConGenerator.h.
References whenInfeasible_.
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 213 of file BlisConGenerator.h.
References whenInfeasible_.
CglCutGenerator* BlisConGenerator::generator | ( | ) | const [inline] |
Get the CglCutGenerator
bound to this BlisConGenerator
.
Definition at line 216 of file BlisConGenerator.h.
References generator_.
int BlisConGenerator::numConsGenerated | ( | ) | [inline] |
Get number of generated cons.
Definition at line 219 of file BlisConGenerator.h.
References numConsGenerated_.
void BlisConGenerator::addNumConsGenerated | ( | int | n | ) | [inline] |
Increase the number of generated cons.
Definition at line 222 of file BlisConGenerator.h.
References numConsGenerated_.
int BlisConGenerator::numConsUsed | ( | ) | [inline] |
Get number of used cons.
Definition at line 225 of file BlisConGenerator.h.
References numConsUsed_.
void BlisConGenerator::addNumConsUsed | ( | int | n | ) | [inline] |
Increase the number of generated cons.
Definition at line 228 of file BlisConGenerator.h.
References numConsUsed_.
double BlisConGenerator::time | ( | ) | [inline] |
void BlisConGenerator::addTime | ( | double | t | ) | [inline] |
int BlisConGenerator::calls | ( | ) | [inline] |
void BlisConGenerator::addCalls | ( | int | n = 1 |
) | [inline] |
Increase the number of called.
Definition at line 240 of file BlisConGenerator.h.
References calls_.
int BlisConGenerator::noConsCalls | ( | ) | [inline] |
Number called and no cons found.
Definition at line 243 of file BlisConGenerator.h.
References noConsCalls_.
void BlisConGenerator::addNoConsCalls | ( | int | n = 1 |
) | [inline] |
Increase the number of no cons called.
Definition at line 246 of file BlisConGenerator.h.
References noConsCalls_.
BlisConGenerator& BlisConGenerator::operator= | ( | const BlisConGenerator & | rhs | ) |
Assignment operator.
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).
Reimplemented in VrpCutGenerator.
BlisModel* BlisConGenerator::getModel | ( | ) | [inline] |
void BlisConGenerator::setModel | ( | BlisModel * | m | ) | [inline] |
void BlisConGenerator::refreshModel | ( | BlisModel * | model | ) |
Refresh the model.
void BlisConGenerator::setName | ( | const char * | str | ) | [inline] |
std::string BlisConGenerator::name | ( | ) | const [inline] |
void BlisConGenerator::setStrategy | ( | BlisCutStrategy | value | ) | [inline] |
Set the con generation strategy.
Definition at line 197 of file BlisConGenerator.h.
References strategy_.
BlisCutStrategy BlisConGenerator::strategy | ( | ) | const [inline] |
Get the con generation interval.
Definition at line 200 of file BlisConGenerator.h.
References strategy_.
void BlisConGenerator::setCutGenerationFreq | ( | int | freq | ) | [inline] |
Set the con generation strategy.
Definition at line 203 of file BlisConGenerator.h.
References cutGenerationFrequency_.
int BlisConGenerator::cutGenerationFreq | ( | ) | const [inline] |
Get the con generation interval.
Definition at line 206 of file BlisConGenerator.h.
References cutGenerationFrequency_.
bool BlisConGenerator::normal | ( | ) | const [inline] |
Get whether the con generator should be called in the normal place.
Definition at line 209 of file BlisConGenerator.h.
References normal_.
void BlisConGenerator::setNormal | ( | bool | value | ) | [inline] |
Set whether the con generator should be called in the normal place.
Definition at line 212 of file BlisConGenerator.h.
References normal_.
bool BlisConGenerator::atSolution | ( | ) | const [inline] |
Get whether the con generator should be called when a solution is found.
Definition at line 216 of file BlisConGenerator.h.
References atSolution_.
void BlisConGenerator::setAtSolution | ( | bool | value | ) | [inline] |
Set whether the con generator should be called when a solution is found.
Definition at line 220 of file BlisConGenerator.h.
References atSolution_.
bool BlisConGenerator::whenInfeasible | ( | ) | const [inline] |
Get whether the con generator should be called when the subproblem is found to be infeasible.
Definition at line 224 of file BlisConGenerator.h.
References whenInfeasible_.
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 228 of file BlisConGenerator.h.
References whenInfeasible_.
CglCutGenerator* BlisConGenerator::generator | ( | ) | const [inline] |
Get the CglCutGenerator
bound to this BlisConGenerator
.
Definition at line 231 of file BlisConGenerator.h.
References generator_.
int BlisConGenerator::numConsGenerated | ( | ) | [inline] |
Get number of generated cons.
Definition at line 234 of file BlisConGenerator.h.
References numConsGenerated_.
void BlisConGenerator::addNumConsGenerated | ( | int | n | ) | [inline] |
Increase the number of generated cons.
Definition at line 237 of file BlisConGenerator.h.
References numConsGenerated_.
int BlisConGenerator::numConsUsed | ( | ) | [inline] |
Get number of used cons.
Definition at line 240 of file BlisConGenerator.h.
References numConsUsed_.
void BlisConGenerator::addNumConsUsed | ( | int | n | ) | [inline] |
Increase the number of generated cons.
Definition at line 243 of file BlisConGenerator.h.
References numConsUsed_.
double BlisConGenerator::time | ( | ) | const [inline] |
void BlisConGenerator::addTime | ( | double | t | ) | [inline] |
int BlisConGenerator::calls | ( | ) | const [inline] |
void BlisConGenerator::addCalls | ( | int | n = 1 |
) | [inline] |
Increase the number of called.
Definition at line 255 of file BlisConGenerator.h.
References calls_.
int BlisConGenerator::noConsCalls | ( | ) | const [inline] |
Number called and no cons found.
Definition at line 258 of file BlisConGenerator.h.
References noConsCalls_.
void BlisConGenerator::addNoConsCalls | ( | int | n = 1 |
) | [inline] |
Increase the number of no cons called.
Definition at line 261 of file BlisConGenerator.h.
References noConsCalls_.
BlisModel* BlisConGenerator::model_ [private] |
The client model.
Reimplemented in VrpCutGenerator.
Definition at line 61 of file BlisConGenerator.h.
Referenced by getModel(), and setModel().
CglCutGenerator* BlisConGenerator::generator_ [private] |
The CglCutGenerator object.
Definition at line 64 of file BlisConGenerator.h.
Referenced by generator(), and ~BlisConGenerator().
int BlisConGenerator::strategy_ [private] |
When to call CglCutGenerator::generateCuts routine.
-2: disable -1: just root 0: automatically decided by BLIS any positive integer: the node interval between the call
Definition at line 76 of file BlisConGenerator.h.
Referenced by setStrategy(), and strategy().
char* BlisConGenerator::name_ [private] |
Name of generator.
Definition at line 79 of file BlisConGenerator.h.
Referenced by BlisConGenerator(), name(), setName(), and ~BlisConGenerator().
bool BlisConGenerator::normal_ [private] |
Whether to call the generator in the normal place.
Definition at line 82 of file BlisConGenerator.h.
Referenced by normal(), and setNormal().
bool BlisConGenerator::atSolution_ [private] |
Whether to call the generator when a new solution is found.
Definition at line 85 of file BlisConGenerator.h.
Referenced by atSolution(), and setAtSolution().
bool BlisConGenerator::whenInfeasible_ [private] |
Whether to call generator when a subproblem is found to be infeasible.
Definition at line 89 of file BlisConGenerator.h.
Referenced by setWhenInfeasible(), and whenInfeasible().
int BlisConGenerator::numConsGenerated_ [private] |
Number of cons generated.
Definition at line 96 of file BlisConGenerator.h.
Referenced by addNumConsGenerated(), and numConsGenerated().
int BlisConGenerator::numConsUsed_ [private] |
Number of cons used.
Definition at line 99 of file BlisConGenerator.h.
Referenced by addNumConsUsed(), and numConsUsed().
double BlisConGenerator::time_ [private] |
int BlisConGenerator::calls_ [private] |
The times of calling this generator.
Definition at line 105 of file BlisConGenerator.h.
Referenced by addCalls(), and calls().
int BlisConGenerator::noConsCalls_ [private] |
The times of calling this generator and no cons found.
Definition at line 108 of file BlisConGenerator.h.
Referenced by addNoConsCalls(), and noConsCalls().
BlisModel* BlisConGenerator::model_ [protected] |
The client model.
Reimplemented in VrpCutGenerator.
Definition at line 62 of file BlisConGenerator.h.
CglCutGenerator* BlisConGenerator::generator_ [protected] |
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 77 of file BlisConGenerator.h.
int BlisConGenerator::cutGenerationFrequency_ [protected] |
The frequency of calls to the cut generator.
Definition at line 80 of file BlisConGenerator.h.
Referenced by cutGenerationFreq(), and setCutGenerationFreq().
std::string BlisConGenerator::name_ [protected] |