GAMSlinks
0.4
|
Interface to GAMS BCH facility. More...
#include <GamsBCH.hpp>
Classes | |
class | Cut |
Structure to store a Cut generated by a Gams BCH cut generator. More... | |
Public Member Functions | |
GamsBCH (GamsHandler &gams_, GamsDictionary &gamsdict, GamsOptions &opt) | |
Constructor that also reads the BCH parameters from a GamsOptions object. More... | |
GamsBCH (GamsHandler &gams_, GamsDictionary &gamsdict) | |
Constructor that initialize BCH data only. More... | |
~GamsBCH () | |
Destructor. More... | |
void | setupParameters (GamsOptions &opt) |
Reads the BCH parameters from a GamsOptions object. More... | |
void | set_userjobid (const char *userjobid) |
Sets the users job id. More... | |
void | set_usergdxname (const char *usergdxname, const char *usergdxprefix=NULL) |
void | set_usergdxnameinc (const char *usergdxnameinc, const char *usergdxprefix=NULL) |
void | set_usergdxin (const char *usergdxin_, const char *usergdxprefix=NULL) |
void | set_userkeep (bool userkeep_) |
void | set_usercutcall (const char *usercutcall) |
void | set_usercutfreq (int usercutfreq) |
void | set_usercutinterval (int usercutinterval) |
void | set_usercutmult (int usercutmult) |
void | set_usercutfirst (int usercutfirst) |
void | set_usercutnewint (bool usercutnewint) |
void | set_userheurcall (const char *userheurcall) |
void | set_userheurfreq (int userheurfreq) |
void | set_userheurinterval (int userheurinterval) |
void | set_userheurmult (int userheurmult) |
void | set_userheurfirst (int userheurfirst) |
void | set_userheurnewint (bool userheurnewint) |
void | set_userheurobjfirst (int userheurobjfirst) |
void | set_userincbcall (const char *userincbcall) |
void | set_userincbicall (const char *userincbicall) |
const char * | get_usercutcall () |
bool | get_usercutnewint () const |
const char * | get_userheurcall () |
bool | get_userheurnewint () const |
void | setLogLevel (int loglevel_) |
Level of output created by GamsBCH handler. More... | |
int | getNumCalls () const |
Accumulated number of BCH calls. More... | |
int | getNumCuts () const |
Accumulated number of created cuts. More... | |
int | getNumSols () const |
Accumulated number of solutions. More... | |
int | getNumCols () const |
The number of columns expected by GamsBCH. More... | |
void | printParameters () const |
void | setGlobalBounds (const double *lb_, const double *ub_) |
You should call this method after the constructor. More... | |
void | setNodeSolution (const double *x_, double objval_, const double *lb_, const double *ub_) |
Sets the solution and bounds of the current node. More... | |
bool | setIncumbentSolution (const double *x_, double objval_) |
Informs BCH about the current incumbent. More... | |
bool | doCuts () |
Returns true if generateCuts should be called, otherwise false. More... | |
bool | generateCuts (std::vector< Cut > &cuts) |
Calls the GAMS cut generator. More... | |
bool | doHeuristic (double bestbnd, double curobj) |
Returns true if runHeuristic should be called, otherwise false. More... | |
bool | runHeuristic (double *x, double &objvalue) |
Calls the GAMS heuristic. More... | |
Private Member Functions | |
void | init () |
int | reportIncumbent () |
Writes the incumbent to the file specified in gdxnameinc and calls the incumbent reporting callback, if specified. More... | |
Private Attributes | |
GamsHandler & | gams |
struct dictRec * | dict |
double * | node_x |
double * | node_lb |
double * | node_ub |
bool | have_incumbent |
bool | new_incumbent |
double | incumbent_value |
double * | incumbent |
double * | global_lb |
double * | global_ub |
bool | userkeep |
int | heurfreq |
int | heurinterval |
int | heurmult |
int | heurfirst |
bool | heurnewint |
int | heurobjfirst |
char | heurcall [1024] |
char | cutcall [1024] |
int | cutfreq |
int | cutinterval |
int | cutmult |
int | cutfirst |
bool | cutnewint |
char | incbcall [1024] |
char | incbicall [1024] |
char | userjobid [1024] |
char | gdxname [1024] |
char | gdxnameinc [1024] |
char | usergdxin [1024] |
int | ncalls |
int | ncuts |
int | nsols |
int | loglevel |
Interface to GAMS BCH facility.
Definition at line 24 of file GamsBCH.hpp.
GamsBCH::GamsBCH | ( | GamsHandler & | gams_, |
GamsDictionary & | gamsdict, | ||
GamsOptions & | opt | ||
) |
Constructor that also reads the BCH parameters from a GamsOptions object.
gams_ | A GAMS handler. |
gamsdict | A GAMS dictionary. |
opt | A GAMS options object. |
GamsBCH::GamsBCH | ( | GamsHandler & | gams_, |
GamsDictionary & | gamsdict | ||
) |
Constructor that initialize BCH data only.
Parameters need to be set by the user using the set_... methods below.
gams_ | A GAMS handler. |
gamsdict | A GAMS dictionary. |
GamsBCH::~GamsBCH | ( | ) |
Destructor.
|
private |
|
private |
Writes the incumbent to the file specified in gdxnameinc and calls the incumbent reporting callback, if specified.
Does nothing if there is no new incumbent.
void GamsBCH::setupParameters | ( | GamsOptions & | opt | ) |
Reads the BCH parameters from a GamsOptions object.
opt | A GAMS options object. |
void GamsBCH::set_userjobid | ( | const char * | userjobid | ) |
Sets the users job id.
If used, then it must be called before the other parameter set methods.
void GamsBCH::set_usergdxname | ( | const char * | usergdxname, |
const char * | usergdxprefix = NULL |
||
) |
void GamsBCH::set_usergdxnameinc | ( | const char * | usergdxnameinc, |
const char * | usergdxprefix = NULL |
||
) |
void GamsBCH::set_usergdxin | ( | const char * | usergdxin_, |
const char * | usergdxprefix = NULL |
||
) |
|
inline |
Definition at line 141 of file GamsBCH.hpp.
References userkeep.
void GamsBCH::set_usercutcall | ( | const char * | usercutcall | ) |
|
inline |
Definition at line 144 of file GamsBCH.hpp.
References cutfreq.
|
inline |
Definition at line 145 of file GamsBCH.hpp.
References cutinterval.
|
inline |
Definition at line 146 of file GamsBCH.hpp.
References cutmult.
|
inline |
Definition at line 147 of file GamsBCH.hpp.
References cutfirst.
|
inline |
Definition at line 148 of file GamsBCH.hpp.
References cutnewint.
void GamsBCH::set_userheurcall | ( | const char * | userheurcall | ) |
|
inline |
Definition at line 151 of file GamsBCH.hpp.
References heurfreq.
|
inline |
Definition at line 152 of file GamsBCH.hpp.
References heurinterval.
|
inline |
Definition at line 153 of file GamsBCH.hpp.
References heurmult.
|
inline |
Definition at line 154 of file GamsBCH.hpp.
References heurfirst.
|
inline |
Definition at line 155 of file GamsBCH.hpp.
References heurnewint.
|
inline |
Definition at line 156 of file GamsBCH.hpp.
References heurobjfirst.
void GamsBCH::set_userincbcall | ( | const char * | userincbcall | ) |
void GamsBCH::set_userincbicall | ( | const char * | userincbicall | ) |
|
inline |
Definition at line 161 of file GamsBCH.hpp.
References cutcall.
|
inline |
Definition at line 162 of file GamsBCH.hpp.
References cutnewint.
|
inline |
Definition at line 164 of file GamsBCH.hpp.
References heurcall.
|
inline |
Definition at line 165 of file GamsBCH.hpp.
References heurnewint.
|
inline |
Level of output created by GamsBCH handler.
loglevel_ | 0 turns off all output, 1 prints a status line for each BCH call, 2 might print more. |
Definition at line 170 of file GamsBCH.hpp.
References loglevel.
|
inline |
|
inline |
|
inline |
|
inline |
The number of columns expected by GamsBCH.
For debugging purposes.
Definition at line 185 of file GamsBCH.hpp.
References gams, and GamsHandler::getColCount().
void GamsBCH::printParameters | ( | ) | const |
void GamsBCH::setGlobalBounds | ( | const double * | lb_, |
const double * | ub_ | ||
) |
You should call this method after the constructor.
void GamsBCH::setNodeSolution | ( | const double * | x_, |
double | objval_, | ||
const double * | lb_, | ||
const double * | ub_ | ||
) |
Sets the solution and bounds of the current node.
Should be called before generateCuts() and runHeuristics().
bool GamsBCH::setIncumbentSolution | ( | const double * | x_, |
double | objval_ | ||
) |
Informs BCH about the current incumbent.
Should be called before generateCuts() and runHeuristics(). Checks whether the objective value changed, and does nothing if its the same. If it does and an incumbent reporter or checking program is specified, calls reportIncumbent()
bool GamsBCH::doCuts | ( | ) |
Returns true if generateCuts should be called, otherwise false.
You should call this method before generateCuts().
bool GamsBCH::generateCuts | ( | std::vector< Cut > & | cuts | ) |
Calls the GAMS cut generator.
Note, that you need to set the solution of the current nodes relaxation with. Note, that you should call this method only if doCuts() returned true.
bool GamsBCH::doHeuristic | ( | double | bestbnd, |
double | curobj | ||
) |
Returns true if runHeuristic should be called, otherwise false.
You should call this method before doHeuristic().
bool GamsBCH::runHeuristic | ( | double * | x, |
double & | objvalue | ||
) |
Calls the GAMS heuristic.
x | Space to store a solution. |
objvalue | A double to store objective value of new solution. |
|
private |
Definition at line 51 of file GamsBCH.hpp.
Referenced by getNumCols().
|
private |
Definition at line 53 of file GamsBCH.hpp.
|
private |
Definition at line 56 of file GamsBCH.hpp.
|
private |
Definition at line 58 of file GamsBCH.hpp.
|
private |
Definition at line 60 of file GamsBCH.hpp.
|
private |
Definition at line 62 of file GamsBCH.hpp.
|
private |
Definition at line 63 of file GamsBCH.hpp.
|
private |
Definition at line 64 of file GamsBCH.hpp.
|
private |
Definition at line 66 of file GamsBCH.hpp.
|
private |
Definition at line 68 of file GamsBCH.hpp.
|
private |
Definition at line 70 of file GamsBCH.hpp.
|
private |
Definition at line 72 of file GamsBCH.hpp.
Referenced by set_userkeep().
|
private |
Definition at line 74 of file GamsBCH.hpp.
Referenced by set_userheurfreq().
|
private |
Definition at line 75 of file GamsBCH.hpp.
Referenced by set_userheurinterval().
|
private |
Definition at line 76 of file GamsBCH.hpp.
Referenced by set_userheurmult().
|
private |
Definition at line 77 of file GamsBCH.hpp.
Referenced by set_userheurfirst().
|
private |
Definition at line 78 of file GamsBCH.hpp.
Referenced by get_userheurnewint(), and set_userheurnewint().
|
private |
Definition at line 79 of file GamsBCH.hpp.
Referenced by set_userheurobjfirst().
|
private |
Definition at line 80 of file GamsBCH.hpp.
Referenced by get_userheurcall().
|
private |
Definition at line 82 of file GamsBCH.hpp.
Referenced by get_usercutcall().
|
private |
Definition at line 83 of file GamsBCH.hpp.
Referenced by set_usercutfreq().
|
private |
Definition at line 84 of file GamsBCH.hpp.
Referenced by set_usercutinterval().
|
private |
Definition at line 85 of file GamsBCH.hpp.
Referenced by set_usercutmult().
|
private |
Definition at line 86 of file GamsBCH.hpp.
Referenced by set_usercutfirst().
|
private |
Definition at line 87 of file GamsBCH.hpp.
Referenced by get_usercutnewint(), and set_usercutnewint().
|
private |
Definition at line 89 of file GamsBCH.hpp.
|
private |
Definition at line 90 of file GamsBCH.hpp.
|
private |
Definition at line 92 of file GamsBCH.hpp.
|
private |
Definition at line 94 of file GamsBCH.hpp.
|
private |
Definition at line 95 of file GamsBCH.hpp.
|
private |
Definition at line 96 of file GamsBCH.hpp.
|
private |
Definition at line 98 of file GamsBCH.hpp.
Referenced by getNumCalls().
|
private |
Definition at line 99 of file GamsBCH.hpp.
Referenced by getNumCuts().
|
private |
Definition at line 100 of file GamsBCH.hpp.
Referenced by getNumSols().
|
private |
Definition at line 102 of file GamsBCH.hpp.
Referenced by setLogLevel().