- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# /home/coin/svn-release/Blis-0.94.1/Blis/src/BlisConGenerator.h

Go to the documentation of this file.

    00001 /*===========================================================================*
    00002  * This file is part of the BiCePS Linear Integer Solver (BLIS).             *
    00003  *                                                                           *
    00004  * BLIS is distributed under the Eclipse Public License as part of the       *
    00005  * COIN-OR repository (http://www.coin-or.org).                              *
    00006  *                                                                           *
    00007  * Authors:                                                                  *
    00008  *                                                                           *
    00009  *          Yan Xu, Lehigh University                                        *
    00010  *          Ted Ralphs, Lehigh University                                    *
    00011  *                                                                           *
    00012  * Conceptual Design:                                                        *
    00013  *                                                                           *
    00014  *          Yan Xu, Lehigh University                                        *
    00015  *          Ted Ralphs, Lehigh University                                    *
    00016  *          Laszlo Ladanyi, IBM T.J. Watson Research Center                  *
    00017  *          Matthew Saltzman, Clemson University                             *
    00018  *                                                                           *
    00019  *                                                                           *
    00020  * Copyright (C) 2001-2013, Lehigh University, Yan Xu, and Ted Ralphs.       *
    00021  * All Rights Reserved.                                                      *
    00022  *===========================================================================*/
    00023
    00024
    00025 //#############################################################################
    00026 // This file is modified from COIN/Cbc/CbcCutGenerator.hpp
    00027 //#############################################################################
    00028
    00029
    00030 #ifndef BlisConGenerator_h_
    00031 #define BlisConGenerator_h_
    00032
    00033 #include "OsiSolverInterface.hpp"
    00034 #include "OsiCuts.hpp"
    00035
    00036
    00037 class BlisModel;
    00038
    00039 class OsiRowCut;
    00040 class OsiRowCutDebugger;
    00041 class CglCutGenerator;
    00042
    00043
    00044 //#############################################################################
    00045
    00058 class BlisConGenerator  {
    00059
    00060 protected:
    00062     BlisModel *model_;
    00063
    00065     CglCutGenerator * generator_;
    00066
    00067     //------------------------------------------------------
    00068     // CON CONTROL
    00069     //------------------------------------------------------
    00070
    00077     BlisCutStrategy strategy_;
    00078
    00080     int cutGenerationFrequency_;
    00081
    00083     std::string name_;
    00084
    00086     bool normal_;
    00087
    00089     bool atSolution_;
    00090
    00093     bool whenInfeasible_;
    00094
    00095     //------------------------------------------------------
    00096     // CON STATISTICS
    00097     //------------------------------------------------------
    00098
    00100     int numConsGenerated_;
    00101
    00103     int numConsUsed_;
    00104
    00106     double time_;
    00107
    00109     int calls_;
    00110
    00112     int noConsCalls_;
    00113
    00114  public:
    00115
    00119     BlisConGenerator()
    00120         :
    00121         model_(NULL),
    00122         generator_(NULL),
    00123         strategy_(BlisCutStrategyAuto),
    00124         cutGenerationFrequency_(1),
    00125         normal_(true),
    00126         atSolution_(false),
    00127         whenInfeasible_(false),
    00128         numConsGenerated_(0),
    00129         numConsUsed_(0),
    00130         time_(0),
    00131         calls_(0),
    00132         noConsCalls_(0)
    00133         { name_ = "UNKNOWN"; }
    00134
    00136     BlisConGenerator(BlisModel * model,
    00137                      CglCutGenerator * generator,
    00138                      const char * name = NULL,
    00139                      BlisCutStrategy strategy = BlisCutStrategyAuto,
    00140                      int cutGenerationFrequency_ = 1,
    00141                      bool normal = true,
    00142                      bool atSolution = false,
    00143                      bool infeasible = false);
    00144
    00146     BlisConGenerator (const BlisConGenerator &);
    00147
    00149     BlisConGenerator & operator=(const BlisConGenerator& rhs);
    00150
    00152     virtual ~BlisConGenerator()
    00153         {
    00154             if (generator_) {
    00155                 delete generator_;
    00156                 generator_ = NULL;
    00157             }
    00158         }
    00160
    00172     virtual bool generateConstraints(BcpsConstraintPool &conPool);
    00174
    00182     inline BlisModel *getModel() { return model_; }
    00183
    00185     inline void setModel(BlisModel *m) { model_ = m; }
    00186
    00188     void refreshModel(BlisModel * model);
    00189
    00191     void setName(const char *str) { name_ = str; }
    00192
    00194     inline std::string name() const { return name_; }
    00195
    00197     void setStrategy(BlisCutStrategy value) { strategy_ = value; }
    00198
    00200     inline BlisCutStrategy strategy() const { return strategy_; }
    00201
    00203     void setCutGenerationFreq(int freq) { cutGenerationFrequency_ = freq; }
    00204
    00206     inline int cutGenerationFreq() const { return cutGenerationFrequency_; }
    00207
    00209     inline bool normal() const { return normal_; }
    00210
    00212     inline void setNormal(bool value) { normal_ = value; }
    00213
    00216     inline bool atSolution() const { return atSolution_; }
    00217
    00220     inline void setAtSolution(bool value) { atSolution_ = value; }
    00221
    00224     inline bool whenInfeasible() const { return whenInfeasible_; }
    00225
    00228     inline void setWhenInfeasible(bool value) { whenInfeasible_ = value; }
    00229
    00231     inline CglCutGenerator * generator() const { return generator_; }
    00232
    00234     inline int numConsGenerated() { return numConsGenerated_; }
    00235
    00237     inline void addNumConsGenerated(int n) { numConsGenerated_ += n; }
    00238
    00240     inline int numConsUsed() { return numConsUsed_; }
    00241
    00243     inline void addNumConsUsed(int n) { numConsUsed_ += n; }
    00244
    00246     inline double time() const { return time_; }
    00247
    00249     inline void addTime(double t) { time_ += t; }
    00250
    00252     inline int calls() const { return calls_; }
    00253
    00255     inline void addCalls(int n=1) { calls_ += n; }
    00256
    00258     inline int noConsCalls() const { return noConsCalls_; }
    00259
    00261     inline void addNoConsCalls(int n=1) { noConsCalls_ += n; }
    00263 };
    00264
    00265 #endif