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

- File List
- File Members

# /home/coin/SVN-release/Bcps-0.91.0/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 Common 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-2005, International Business Machines                  *
    00021  * Corporation, Lehigh University, Yan Xu, Ted Ralphs, Matthew Salzman and   *
    00022  * others. All Rights Reserved.                                              *
    00023  *===========================================================================*/
    00024
    00025
    00026 //#############################################################################
    00027 // This file is modified from COIN/Cbc/CbcCutGenerator.hpp
    00028 //#############################################################################
    00029
    00030
    00031 #ifndef BlisConGenerator_h_
    00032 #define BlisConGenerator_h_
    00033
    00034 #include "OsiSolverInterface.hpp"
    00035 #include "OsiCuts.hpp"
    00036
    00037 class BlisModel;
    00038 class OsiRowCut;
    00039 class OsiRowCutDebugger;
    00040 class CglCutGenerator;
    00041
    00042
    00043 //#############################################################################
    00044
    00057 class BlisConGenerator  {
    00058
    00059  private:
    00061     BlisModel *model_;
    00062
    00064     CglCutGenerator * generator_;
    00065
    00066     //------------------------------------------------------
    00067     // CON CONTROL
    00068     //------------------------------------------------------
    00069
    00076     int strategy_;
    00077
    00079     char * name_;
    00080
    00082     bool normal_;
    00083
    00085     bool atSolution_;
    00086
    00089     bool whenInfeasible_;
    00090
    00091     //------------------------------------------------------
    00092     // CON STATISTICS
    00093     //------------------------------------------------------
    00094
    00096     int numConsGenerated_;
    00097
    00099     int numConsUsed_;
    00100
    00102     double time_;
    00103
    00105     int calls_;
    00106
    00108     int noConsCalls_;
    00109
    00110  public:
    00111
    00115     BlisConGenerator()
    00116         :
    00117         model_(NULL),
    00118         generator_(NULL),
    00119         strategy_(-1),
    00120         name_(NULL),
    00121         normal_(true),
    00122         atSolution_(false),
    00123         whenInfeasible_(false),
    00124         numConsGenerated_(0),
    00125         numConsUsed_(0),
    00126         time_(0),
    00127         calls_(0),
    00128         noConsCalls_(0)
    00129         {}
    00130
    00132     BlisConGenerator(BlisModel * model,
    00133                      CglCutGenerator * generator,
    00134                      const char * name = NULL,
    00135                      int strategy = 0,
    00136                      bool normal = true,
    00137                      bool atSolution = false,
    00138                      bool infeasible = false);
    00139
    00141     BlisConGenerator (const BlisConGenerator &);
    00142
    00144     BlisConGenerator & operator=(const BlisConGenerator& rhs);
    00145
    00147     ~BlisConGenerator()
    00148         {
    00149             free(name_);
    00150             name_= NULL;
    00151             if (generator_) {
    00152                 delete generator_;
    00153                 generator_ = NULL;
    00154             }
    00155         }
    00157
    00173     bool generateCons(OsiCuts &cs, bool fullScan);
    00175
    00182     void refreshModel(BlisModel * model);
    00183
    00185     inline const char * name() const { return name_; }
    00186
    00188     void setStrategy(int value) { strategy_ = value; }
    00189
    00191     inline int strategy() const { return strategy_; }
    00192
    00194     inline bool normal() const { return normal_; }
    00195
    00197     inline void setNormal(bool value) { normal_ = value; }
    00198
    00201     inline bool atSolution() const { return atSolution_; }
    00202
    00205     inline void setAtSolution(bool value) { atSolution_ = value; }
    00206
    00209     inline bool whenInfeasible() const { return whenInfeasible_; }
    00210
    00213     inline void setWhenInfeasible(bool value) { whenInfeasible_ = value; }
    00214
    00216     inline CglCutGenerator * generator() const { return generator_; }
    00217
    00219     inline int numConsGenerated() { return numConsGenerated_; }
    00220
    00222     inline void addNumConsGenerated(int n) { numConsGenerated_ += n; }
    00223
    00225     inline int numConsUsed() { return numConsUsed_; }
    00226
    00228     inline void addNumConsUsed(int n) { numConsUsed_ += n; }
    00229
    00231     inline double time() { return time_; }
    00232
    00234     inline void addTime(double t) { time_ += t; }
    00235
    00237     inline int calls() { return calls_; }
    00238
    00240     inline void addCalls(int n=1) { calls_ += n; }
    00241
    00243     inline int noConsCalls() { return noConsCalls_; }
    00244
    00246     inline void addNoConsCalls(int n=1) { noConsCalls_ += n; }
    00248 };
    00249
    00250 #endif