GamsBCH Class Reference

Interface to GAMS BCH facility. More...

#include <GamsBCH.hpp>

Collaboration diagram for GamsBCH:

Collaboration graph
[legend]
List of all members.

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

GamsHandlergams
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...

Detailed Description

Interface to GAMS BCH facility.

Definition at line 24 of file GamsBCH.hpp.


Constructor & Destructor Documentation

GamsBCH::GamsBCH ( GamsHandler gams_,
GamsDictionary gamsdict,
GamsOptions opt 
)

Constructor that also reads the BCH parameters from a GamsOptions object.

Parameters:
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.

Parameters:
gams_ A GAMS handler.
gamsdict A GAMS dictionary.

GamsBCH::~GamsBCH (  ) 

Destructor.


Member Function Documentation

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.

Returns:
>0 on success, <0 on failure: -1 if writing the incumbent failed, -2 if the incumbent reporter failed, -3 if the incumbent checker failed; 1 if the incumbent is accepted, 2 if the incumbent is rejected

void GamsBCH::setupParameters ( GamsOptions opt  ) 

Reads the BCH parameters from a GamsOptions object.

Parameters:
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 
)

void GamsBCH::set_userkeep ( bool  userkeep_  )  [inline]

Definition at line 141 of file GamsBCH.hpp.

References userkeep.

void GamsBCH::set_usercutcall ( const char *  usercutcall  ) 

void GamsBCH::set_usercutfreq ( int  usercutfreq  )  [inline]

Definition at line 144 of file GamsBCH.hpp.

References cutfreq.

void GamsBCH::set_usercutinterval ( int  usercutinterval  )  [inline]

Definition at line 145 of file GamsBCH.hpp.

References cutinterval.

void GamsBCH::set_usercutmult ( int  usercutmult  )  [inline]

Definition at line 146 of file GamsBCH.hpp.

References cutmult.

void GamsBCH::set_usercutfirst ( int  usercutfirst  )  [inline]

Definition at line 147 of file GamsBCH.hpp.

References cutfirst.

void GamsBCH::set_usercutnewint ( bool  usercutnewint  )  [inline]

Definition at line 148 of file GamsBCH.hpp.

References cutnewint.

void GamsBCH::set_userheurcall ( const char *  userheurcall  ) 

void GamsBCH::set_userheurfreq ( int  userheurfreq  )  [inline]

Definition at line 151 of file GamsBCH.hpp.

References heurfreq.

void GamsBCH::set_userheurinterval ( int  userheurinterval  )  [inline]

Definition at line 152 of file GamsBCH.hpp.

References heurinterval.

void GamsBCH::set_userheurmult ( int  userheurmult  )  [inline]

Definition at line 153 of file GamsBCH.hpp.

References heurmult.

void GamsBCH::set_userheurfirst ( int  userheurfirst  )  [inline]

Definition at line 154 of file GamsBCH.hpp.

References heurfirst.

void GamsBCH::set_userheurnewint ( bool  userheurnewint  )  [inline]

Definition at line 155 of file GamsBCH.hpp.

References heurnewint.

void GamsBCH::set_userheurobjfirst ( int  userheurobjfirst  )  [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  ) 

const char* GamsBCH::get_usercutcall (  )  [inline]

Definition at line 161 of file GamsBCH.hpp.

References cutcall.

bool GamsBCH::get_usercutnewint (  )  const [inline]

Definition at line 162 of file GamsBCH.hpp.

References cutnewint.

const char* GamsBCH::get_userheurcall (  )  [inline]

Definition at line 164 of file GamsBCH.hpp.

References heurcall.

bool GamsBCH::get_userheurnewint (  )  const [inline]

Definition at line 165 of file GamsBCH.hpp.

References heurnewint.

void GamsBCH::setLogLevel ( int  loglevel_  )  [inline]

Level of output created by GamsBCH handler.

Parameters:
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]

Accumulated number of BCH calls.

Definition at line 174 of file GamsBCH.hpp.

References ncalls.

int GamsBCH::getNumCuts (  )  const [inline]

Accumulated number of created cuts.

Definition at line 177 of file GamsBCH.hpp.

References ncuts.

int GamsBCH::getNumSols (  )  const [inline]

Accumulated number of solutions.

Definition at line 180 of file GamsBCH.hpp.

References nsols.

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()

Returns:
True if there is no incumbent checker or if the incumbent checker accepts the solution. False if an incumbent checker rejects the solution.

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.

Returns:
True, if everything worked fine (even though we might not have found cuts), false if something went wrong.

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.

Parameters:
x Space to store a solution.
objvalue A double to store objective value of new solution.
Returns:
True, if a point has been found, false otherwise.


Member Data Documentation

GamsHandler& GamsBCH::gams [private]

Definition at line 51 of file GamsBCH.hpp.

Referenced by getNumCols().

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]

Definition at line 72 of file GamsBCH.hpp.

Referenced by set_userkeep().

int GamsBCH::heurfreq [private]

Definition at line 74 of file GamsBCH.hpp.

Referenced by set_userheurfreq().

int GamsBCH::heurinterval [private]

Definition at line 75 of file GamsBCH.hpp.

Referenced by set_userheurinterval().

int GamsBCH::heurmult [private]

Definition at line 76 of file GamsBCH.hpp.

Referenced by set_userheurmult().

int GamsBCH::heurfirst [private]

Definition at line 77 of file GamsBCH.hpp.

Referenced by set_userheurfirst().

bool GamsBCH::heurnewint [private]

Definition at line 78 of file GamsBCH.hpp.

Referenced by get_userheurnewint(), and set_userheurnewint().

int GamsBCH::heurobjfirst [private]

Definition at line 79 of file GamsBCH.hpp.

Referenced by set_userheurobjfirst().

char GamsBCH::heurcall[1024] [private]

Definition at line 80 of file GamsBCH.hpp.

Referenced by get_userheurcall().

char GamsBCH::cutcall[1024] [private]

Definition at line 82 of file GamsBCH.hpp.

Referenced by get_usercutcall().

int GamsBCH::cutfreq [private]

Definition at line 83 of file GamsBCH.hpp.

Referenced by set_usercutfreq().

int GamsBCH::cutinterval [private]

Definition at line 84 of file GamsBCH.hpp.

Referenced by set_usercutinterval().

int GamsBCH::cutmult [private]

Definition at line 85 of file GamsBCH.hpp.

Referenced by set_usercutmult().

int GamsBCH::cutfirst [private]

Definition at line 86 of file GamsBCH.hpp.

Referenced by set_usercutfirst().

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]

Definition at line 98 of file GamsBCH.hpp.

Referenced by getNumCalls().

int GamsBCH::ncuts [private]

Definition at line 99 of file GamsBCH.hpp.

Referenced by getNumCuts().

int GamsBCH::nsols [private]

Definition at line 100 of file GamsBCH.hpp.

Referenced by getNumSols().

int GamsBCH::loglevel [private]

Definition at line 102 of file GamsBCH.hpp.

Referenced by setLogLevel().


The documentation for this class was generated from the following file:
Generated on Tue Dec 30 03:01:28 2008 for GAMSlinks by  doxygen 1.4.7