#include <GamsBCH.hpp>
Collaboration diagram for GamsBCH:
Public Member Functions | |
GamsBCH (GamsHandler &gams_, GamsDictionary &gamsdict, GamsOptions &opt) | |
Constructor that also reads the BCH parameters from a GamsOptions object. | |
GamsBCH (GamsHandler &gams_, GamsDictionary &gamsdict) | |
Constructor that initialize BCH data only. | |
~GamsBCH () | |
Destructor. | |
void | setupParameters (GamsOptions &opt) |
Reads the BCH parameters from a GamsOptions object. | |
void | set_userjobid (const char *userjobid) |
Sets the users job id. | |
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. | |
int | getNumCalls () const |
Accumulated number of BCH calls. | |
int | getNumCuts () const |
Accumulated number of created cuts. | |
int | getNumSols () const |
Accumulated number of solutions. | |
int | getNumCols () const |
The number of columns expected by GamsBCH. | |
void | printParameters () const |
void | setGlobalBounds (const double *lb_, const double *ub_) |
You should call this method after the constructor. | |
void | setNodeSolution (const double *x_, double objval_, const double *lb_, const double *ub_) |
Sets the solution and bounds of the current node. | |
bool | setIncumbentSolution (const double *x_, double objval_) |
Informs BCH about the current incumbent. | |
bool | doCuts () |
Returns true if generateCuts should be called, otherwise false. | |
bool | generateCuts (std::vector< Cut > &cuts) |
Calls the GAMS cut generator. | |
bool | doHeuristic (double bestbnd, double curobj) |
Returns true if runHeuristic should be called, otherwise false. | |
bool | runHeuristic (double *x, double &objvalue) |
Calls the GAMS heuristic. | |
Private Member Functions | |
void | init () |
int | reportIncumbent () |
Writes the incumbent to the file specified in gdxnameinc and calls the incumbent reporting callback, if specified. | |
Private Attributes | |
GamsHandler & | gams |
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 |
Classes | |
class | Cut |
Structure to store a Cut generated by a Gams BCH cut generator. More... |
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.
void GamsBCH::init | ( | ) | [private] |
int GamsBCH::reportIncumbent | ( | ) | [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 | ) |
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 | |||
) |
void GamsBCH::set_userkeep | ( | bool | userkeep_ | ) | [inline] |
void GamsBCH::set_usercutcall | ( | const char * | usercutcall | ) |
void GamsBCH::set_usercutfreq | ( | int | usercutfreq | ) | [inline] |
void GamsBCH::set_usercutinterval | ( | int | usercutinterval | ) | [inline] |
void GamsBCH::set_usercutmult | ( | int | usercutmult | ) | [inline] |
void GamsBCH::set_usercutfirst | ( | int | usercutfirst | ) | [inline] |
void GamsBCH::set_usercutnewint | ( | bool | usercutnewint | ) | [inline] |
void GamsBCH::set_userheurcall | ( | const char * | userheurcall | ) |
void GamsBCH::set_userheurfreq | ( | int | userheurfreq | ) | [inline] |
void GamsBCH::set_userheurinterval | ( | int | userheurinterval | ) | [inline] |
void GamsBCH::set_userheurmult | ( | int | userheurmult | ) | [inline] |
void GamsBCH::set_userheurfirst | ( | int | userheurfirst | ) | [inline] |
void GamsBCH::set_userheurnewint | ( | bool | userheurnewint | ) | [inline] |
void GamsBCH::set_userheurobjfirst | ( | int | userheurobjfirst | ) | [inline] |
void GamsBCH::set_userincbcall | ( | const char * | userincbcall | ) |
void GamsBCH::set_userincbicall | ( | const char * | userincbicall | ) |
const char* GamsBCH::get_usercutcall | ( | ) | [inline] |
bool GamsBCH::get_usercutnewint | ( | ) | const [inline] |
const char* GamsBCH::get_userheurcall | ( | ) | [inline] |
bool GamsBCH::get_userheurnewint | ( | ) | const [inline] |
void GamsBCH::setLogLevel | ( | int | loglevel_ | ) | [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.
int GamsBCH::getNumCalls | ( | ) | const [inline] |
int GamsBCH::getNumCuts | ( | ) | const [inline] |
int GamsBCH::getNumSols | ( | ) | const [inline] |
int GamsBCH::getNumCols | ( | ) | const [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. |
GamsHandler& GamsBCH::gams [private] |
struct dictRec* GamsBCH::dict [private] |
Definition at line 53 of file GamsBCH.hpp.
double* GamsBCH::node_x [private] |
Definition at line 56 of file GamsBCH.hpp.
double* GamsBCH::node_lb [private] |
Definition at line 58 of file GamsBCH.hpp.
double* GamsBCH::node_ub [private] |
Definition at line 60 of file GamsBCH.hpp.
bool GamsBCH::have_incumbent [private] |
Definition at line 62 of file GamsBCH.hpp.
bool GamsBCH::new_incumbent [private] |
Definition at line 63 of file GamsBCH.hpp.
double GamsBCH::incumbent_value [private] |
Definition at line 64 of file GamsBCH.hpp.
double* GamsBCH::incumbent [private] |
Definition at line 66 of file GamsBCH.hpp.
double* GamsBCH::global_lb [private] |
Definition at line 68 of file GamsBCH.hpp.
double* GamsBCH::global_ub [private] |
Definition at line 70 of file GamsBCH.hpp.
bool GamsBCH::userkeep [private] |
int GamsBCH::heurfreq [private] |
int GamsBCH::heurinterval [private] |
int GamsBCH::heurmult [private] |
int GamsBCH::heurfirst [private] |
bool GamsBCH::heurnewint [private] |
Definition at line 78 of file GamsBCH.hpp.
Referenced by get_userheurnewint(), and set_userheurnewint().
int GamsBCH::heurobjfirst [private] |
char GamsBCH::heurcall[1024] [private] |
char GamsBCH::cutcall[1024] [private] |
int GamsBCH::cutfreq [private] |
int GamsBCH::cutinterval [private] |
int GamsBCH::cutmult [private] |
int GamsBCH::cutfirst [private] |
bool GamsBCH::cutnewint [private] |
Definition at line 87 of file GamsBCH.hpp.
Referenced by get_usercutnewint(), and set_usercutnewint().
char GamsBCH::incbcall[1024] [private] |
Definition at line 89 of file GamsBCH.hpp.
char GamsBCH::incbicall[1024] [private] |
Definition at line 90 of file GamsBCH.hpp.
char GamsBCH::userjobid[1024] [private] |
Definition at line 92 of file GamsBCH.hpp.
char GamsBCH::gdxname[1024] [private] |
Definition at line 94 of file GamsBCH.hpp.
char GamsBCH::gdxnameinc[1024] [private] |
Definition at line 95 of file GamsBCH.hpp.
char GamsBCH::usergdxin[1024] [private] |
Definition at line 96 of file GamsBCH.hpp.
int GamsBCH::ncalls [private] |
int GamsBCH::ncuts [private] |
int GamsBCH::nsols [private] |
int GamsBCH::loglevel [private] |