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

- File List
- File Members

# /home/coin/SVN-release/Blis-0.92.0/Clp/src/ClpSolve.hpp

Go to the documentation of this file.

    00001 /* $Id: ClpSolve.hpp 1665 2011-01-04 17:55:54Z lou $ */
    00002 // Copyright (C) 2003, International Business Machines
    00003 // Corporation and others.  All Rights Reserved.
    00004 // This code is licensed under the terms of the Eclipse Public License (EPL).
    00005 /*
    00006    Authors
    00007
    00008    John Forrest
    00009
    00010  */
    00011 #ifndef ClpSolve_H
    00012 #define ClpSolve_H
    00013
    00020 class ClpSolve  {
    00021
    00022 public:
    00023
    00025      enum SolveType {
    00026           useDual = 0,
    00027           usePrimal,
    00028           usePrimalorSprint,
    00029           useBarrier,
    00030           useBarrierNoCross,
    00031           automatic,
    00032           notImplemented
    00033      };
    00034      enum PresolveType {
    00035           presolveOn = 0,
    00036           presolveOff,
    00037           presolveNumber,
    00038           presolveNumberCost
    00039      };
    00040
    00043
    00044      ClpSolve (  );
    00046      ClpSolve ( SolveType method, PresolveType presolveType,
    00047                 int numberPasses, int options[6],
    00048                 int extraInfo[6], int independentOptions[3]);
    00050      void generateCpp(FILE * fp);
    00052      ClpSolve(const ClpSolve &);
    00054      ClpSolve & operator=(const ClpSolve & rhs);
    00056      ~ClpSolve (  );
    00058
    00103      void setSpecialOption(int which, int value, int extraInfo = -1);
    00104      int getSpecialOption(int which) const;
    00105
    00107      void setSolveType(SolveType method, int extraInfo = -1);
    00108      SolveType getSolveType();
    00109
    00110      // Presolve types
    00111      void setPresolveType(PresolveType amount, int extraInfo = -1);
    00112      PresolveType getPresolveType();
    00113      int getPresolvePasses() const;
    00115      int getExtraInfo(int which) const;
    00118      void setInfeasibleReturn(bool trueFalse);
    00119      inline bool infeasibleReturn() const {
    00120           return independentOptions_[0] != 0;
    00121      }
    00123      inline bool doDual() const {
    00124           return (independentOptions_[1] & 1) == 0;
    00125      }
    00126      inline void setDoDual(bool doDual_) {
    00127           if (doDual_) independentOptions_[1]  &= ~1;
    00128           else independentOptions_[1] |= 1;
    00129      }
    00131      inline bool doSingleton() const {
    00132           return (independentOptions_[1] & 2) == 0;
    00133      }
    00134      inline void setDoSingleton(bool doSingleton_) {
    00135           if (doSingleton_) independentOptions_[1]  &= ~2;
    00136           else independentOptions_[1] |= 2;
    00137      }
    00139      inline bool doDoubleton() const {
    00140           return (independentOptions_[1] & 4) == 0;
    00141      }
    00142      inline void setDoDoubleton(bool doDoubleton_) {
    00143           if (doDoubleton_) independentOptions_[1]  &= ~4;
    00144           else independentOptions_[1] |= 4;
    00145      }
    00147      inline bool doTripleton() const {
    00148           return (independentOptions_[1] & 8) == 0;
    00149      }
    00150      inline void setDoTripleton(bool doTripleton_) {
    00151           if (doTripleton_) independentOptions_[1]  &= ~8;
    00152           else independentOptions_[1] |= 8;
    00153      }
    00155      inline bool doTighten() const {
    00156           return (independentOptions_[1] & 16) == 0;
    00157      }
    00158      inline void setDoTighten(bool doTighten_) {
    00159           if (doTighten_) independentOptions_[1]  &= ~16;
    00160           else independentOptions_[1] |= 16;
    00161      }
    00163      inline bool doForcing() const {
    00164           return (independentOptions_[1] & 32) == 0;
    00165      }
    00166      inline void setDoForcing(bool doForcing_) {
    00167           if (doForcing_) independentOptions_[1]  &= ~32;
    00168           else independentOptions_[1] |= 32;
    00169      }
    00171      inline bool doImpliedFree() const {
    00172           return (independentOptions_[1] & 64) == 0;
    00173      }
    00174      inline void setDoImpliedFree(bool doImpliedfree) {
    00175           if (doImpliedfree) independentOptions_[1]  &= ~64;
    00176           else independentOptions_[1] |= 64;
    00177      }
    00179      inline bool doDupcol() const {
    00180           return (independentOptions_[1] & 128) == 0;
    00181      }
    00182      inline void setDoDupcol(bool doDupcol_) {
    00183           if (doDupcol_) independentOptions_[1]  &= ~128;
    00184           else independentOptions_[1] |= 128;
    00185      }
    00187      inline bool doDuprow() const {
    00188           return (independentOptions_[1] & 256) == 0;
    00189      }
    00190      inline void setDoDuprow(bool doDuprow_) {
    00191           if (doDuprow_) independentOptions_[1]  &= ~256;
    00192           else independentOptions_[1] |= 256;
    00193      }
    00195      inline bool doSingletonColumn() const {
    00196           return (independentOptions_[1] & 512) == 0;
    00197      }
    00198      inline void setDoSingletonColumn(bool doSingleton_) {
    00199           if (doSingleton_) independentOptions_[1]  &= ~512;
    00200           else independentOptions_[1] |= 512;
    00201      }
    00203      inline int presolveActions() const {
    00204           return independentOptions_[1] & 0xffff;
    00205      }
    00206      inline void setPresolveActions(int action) {
    00207           independentOptions_[1]  = (independentOptions_[1] & 0xffff0000) | (action & 0xffff);
    00208      }
    00210      inline int substitution() const {
    00211           return independentOptions_[2];
    00212      }
    00213      inline void setSubstitution(int value) {
    00214           independentOptions_[2] = value;
    00215      }
    00217
    00219 private:
    00220
    00224
    00225      SolveType method_;
    00227      PresolveType presolveType_;
    00229      int numberPasses_;
    00231      int options_[7];
    00233      int extraInfo_[7];
    00239      int independentOptions_[3];
    00241 };
    00242
    00244 class ClpSimplexProgress {
    00245
    00246 public:
    00247
    00248
    00251
    00252      ClpSimplexProgress (  );
    00253
    00255      ClpSimplexProgress ( ClpSimplex * model );
    00256
    00258      ClpSimplexProgress(const ClpSimplexProgress &);
    00259
    00261      ClpSimplexProgress & operator=(const ClpSimplexProgress & rhs);
    00263      ~ClpSimplexProgress (  );
    00265      void reset();
    00267      void fillFromModel ( ClpSimplex * model );
    00268
    00270
    00276      int looping (  );
    00278      void startCheck();
    00280      int cycle(int in, int out, int wayIn, int wayOut);
    00281
    00283      double lastObjective(int back = 1) const;
    00285      void setInfeasibility(double value);
    00287      double lastInfeasibility(int back = 1) const;
    00289      void modifyObjective(double value);
    00291      int lastIterationNumber(int back = 1) const;
    00293      void clearIterationNumbers();
    00295      inline void newOddState() {
    00296           oddState_ = - oddState_ - 1;
    00297      }
    00298      inline void endOddState() {
    00299           oddState_ = abs(oddState_);
    00300      }
    00301      inline void clearOddState() {
    00302           oddState_ = 0;
    00303      }
    00304      inline int oddState() const {
    00305           return oddState_;
    00306      }
    00308      inline int badTimes() const {
    00309           return numberBadTimes_;
    00310      }
    00311      inline void clearBadTimes() {
    00312           numberBadTimes_ = 0;
    00313      }
    00315      inline int reallyBadTimes() const {
    00316           return numberReallyBadTimes_;
    00317      }
    00318      inline void incrementReallyBadTimes() {
    00319           numberReallyBadTimes_++;
    00320      }
    00322      inline int timesFlagged() const {
    00323           return numberTimesFlagged_;
    00324      }
    00325      inline void clearTimesFlagged() {
    00326           numberTimesFlagged_ = 0;
    00327      }
    00328      inline void incrementTimesFlagged() {
    00329           numberTimesFlagged_++;
    00330      }
    00331
    00333
    00334 #define CLP_PROGRESS 5
    00335      //#define CLP_PROGRESS_WEIGHT 10
    00337
    00338      double objective_[CLP_PROGRESS];
    00340      double infeasibility_[CLP_PROGRESS];
    00342      double realInfeasibility_[CLP_PROGRESS];
    00343 #ifdef CLP_PROGRESS_WEIGHT
    00345      double objectiveWeight_[CLP_PROGRESS_WEIGHT];
    00347      double infeasibilityWeight_[CLP_PROGRESS_WEIGHT];
    00349      double realInfeasibilityWeight_[CLP_PROGRESS_WEIGHT];
    00351      double drop_;
    00353      double best_;
    00354 #endif
    00356      double initialWeight_;
    00357 #define CLP_CYCLE 12
    00359      //double obj_[CLP_CYCLE];
    00360      int in_[CLP_CYCLE];
    00361      int out_[CLP_CYCLE];
    00362      char way_[CLP_CYCLE];
    00364      ClpSimplex * model_;
    00366      int numberInfeasibilities_[CLP_PROGRESS];
    00368      int iterationNumber_[CLP_PROGRESS];
    00369 #ifdef CLP_PROGRESS_WEIGHT
    00371      int numberInfeasibilitiesWeight_[CLP_PROGRESS_WEIGHT];
    00373      int iterationNumberWeight_[CLP_PROGRESS_WEIGHT];
    00374 #endif
    00376      int numberTimes_;
    00378      int numberBadTimes_;
    00380      int numberReallyBadTimes_;
    00382      int numberTimesFlagged_;
    00384      int oddState_;
    00385
    00386 };
    00387 #endif