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

- File List
- File Members

# /home/coin/svn-release/Bcps-0.93.10/Bcps/examples/Blis/BlisConGenerator.h

Go to the documentation of this file.

    00001 /*===========================================================================*
    00002  * This file is part of the Bcps Linear 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 class BlisModel;
    00037 class OsiRowCut;
    00038 class OsiRowCutDebugger;
    00039 class CglCutGenerator;
    00040
    00041
    00042 //#############################################################################
    00043
    00056 class BlisConGenerator  {
    00057
    00058  private:
    00060     BlisModel *model_;
    00061
    00063     CglCutGenerator * generator_;
    00064
    00065     //------------------------------------------------------
    00066     // CON CONTROL
    00067     //------------------------------------------------------
    00068
    00075     int strategy_;
    00076
    00078     char * name_;
    00079
    00081     bool normal_;
    00082
    00084     bool atSolution_;
    00085
    00088     bool whenInfeasible_;
    00089
    00090     //------------------------------------------------------
    00091     // CON STATISTICS
    00092     //------------------------------------------------------
    00093
    00095     int numConsGenerated_;
    00096
    00098     int numConsUsed_;
    00099
    00101     double time_;
    00102
    00104     int calls_;
    00105
    00107     int noConsCalls_;
    00108
    00109  public:
    00110
    00114     BlisConGenerator()
    00115         :
    00116         model_(NULL),
    00117         generator_(NULL),
    00118         strategy_(-1),
    00119         name_(NULL),
    00120         normal_(true),
    00121         atSolution_(false),
    00122         whenInfeasible_(false),
    00123         numConsGenerated_(0),
    00124         numConsUsed_(0),
    00125         time_(0),
    00126         calls_(0),
    00127         noConsCalls_(0)
    00128         {}
    00129
    00131     BlisConGenerator(BlisModel * model,
    00132                      CglCutGenerator * generator,
    00133                      const char * name = NULL,
    00134                      int strategy = 0,
    00135                      bool normal = true,
    00136                      bool atSolution = false,
    00137                      bool infeasible = false);
    00138
    00140     BlisConGenerator (const BlisConGenerator &);
    00141
    00143     BlisConGenerator & operator=(const BlisConGenerator& rhs);
    00144
    00146     ~BlisConGenerator()
    00147         {
    00148             free(name_);
    00149             name_= NULL;
    00150             if (generator_) {
    00151                 delete generator_;
    00152                 generator_ = NULL;
    00153             }
    00154         }
    00156
    00172     bool generateCons(OsiCuts &cs, bool fullScan);
    00174
    00181     void refreshModel(BlisModel * model);
    00182
    00184     inline const char * name() const { return name_; }
    00185
    00187     void setStrategy(int value) { strategy_ = value; }
    00188
    00190     inline int strategy() const { return strategy_; }
    00191
    00193     inline bool normal() const { return normal_; }
    00194
    00196     inline void setNormal(bool value) { normal_ = value; }
    00197
    00200     inline bool atSolution() const { return atSolution_; }
    00201
    00204     inline void setAtSolution(bool value) { atSolution_ = value; }
    00205
    00208     inline bool whenInfeasible() const { return whenInfeasible_; }
    00209
    00212     inline void setWhenInfeasible(bool value) { whenInfeasible_ = value; }
    00213
    00215     inline CglCutGenerator * generator() const { return generator_; }
    00216
    00218     inline int numConsGenerated() { return numConsGenerated_; }
    00219
    00221     inline void addNumConsGenerated(int n) { numConsGenerated_ += n; }
    00222
    00224     inline int numConsUsed() { return numConsUsed_; }
    00225
    00227     inline void addNumConsUsed(int n) { numConsUsed_ += n; }
    00228
    00230     inline double time() { return time_; }
    00231
    00233     inline void addTime(double t) { time_ += t; }
    00234
    00236     inline int calls() { return calls_; }
    00237
    00239     inline void addCalls(int n=1) { calls_ += n; }
    00240
    00242     inline int noConsCalls() { return noConsCalls_; }
    00243
    00245     inline void addNoConsCalls(int n=1) { noConsCalls_ += n; }
    00247 };
    00248
    00249 #endif