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

- File List
- File Members

# /home/coin/svn-release/Blis-0.94.1/Clp/src/ClpSolve.hpp

Go to the documentation of this file.

    00001 /* $Id: ClpSolve.hpp 2078 2015-01-05 12:39:49Z forrest $ */
    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           tryDantzigWolfe,
    00033           tryBenders,
    00034           notImplemented
    00035      };
    00036      enum PresolveType {
    00037           presolveOn = 0,
    00038           presolveOff,
    00039           presolveNumber,
    00040           presolveNumberCost
    00041      };
    00042
    00045
    00046      ClpSolve (  );
    00048      ClpSolve ( SolveType method, PresolveType presolveType,
    00049                 int numberPasses, int options[6],
    00050                 int extraInfo[6], int independentOptions[3]);
    00052      void generateCpp(FILE * fp);
    00054      ClpSolve(const ClpSolve &);
    00056      ClpSolve & operator=(const ClpSolve & rhs);
    00058      ~ClpSolve (  );
    00060
    00105      void setSpecialOption(int which, int value, int extraInfo = -1);
    00106      int getSpecialOption(int which) const;
    00107
    00109      void setSolveType(SolveType method, int extraInfo = -1);
    00110      SolveType getSolveType();
    00111
    00112      // Presolve types
    00113      void setPresolveType(PresolveType amount, int extraInfo = -1);
    00114      PresolveType getPresolveType();
    00115      int getPresolvePasses() const;
    00117      int getExtraInfo(int which) const;
    00120      void setInfeasibleReturn(bool trueFalse);
    00121      inline bool infeasibleReturn() const {
    00122           return independentOptions_[0] != 0;
    00123      }
    00125      inline bool doDual() const {
    00126           return (independentOptions_[1] & 1) == 0;
    00127      }
    00128      inline void setDoDual(bool doDual_) {
    00129           if (doDual_) independentOptions_[1]  &= ~1;
    00130           else independentOptions_[1] |= 1;
    00131      }
    00133      inline bool doSingleton() const {
    00134           return (independentOptions_[1] & 2) == 0;
    00135      }
    00136      inline void setDoSingleton(bool doSingleton_) {
    00137           if (doSingleton_) independentOptions_[1]  &= ~2;
    00138           else independentOptions_[1] |= 2;
    00139      }
    00141      inline bool doDoubleton() const {
    00142           return (independentOptions_[1] & 4) == 0;
    00143      }
    00144      inline void setDoDoubleton(bool doDoubleton_) {
    00145           if (doDoubleton_) independentOptions_[1]  &= ~4;
    00146           else independentOptions_[1] |= 4;
    00147      }
    00149      inline bool doTripleton() const {
    00150           return (independentOptions_[1] & 8) == 0;
    00151      }
    00152      inline void setDoTripleton(bool doTripleton_) {
    00153           if (doTripleton_) independentOptions_[1]  &= ~8;
    00154           else independentOptions_[1] |= 8;
    00155      }
    00157      inline bool doTighten() const {
    00158           return (independentOptions_[1] & 16) == 0;
    00159      }
    00160      inline void setDoTighten(bool doTighten_) {
    00161           if (doTighten_) independentOptions_[1]  &= ~16;
    00162           else independentOptions_[1] |= 16;
    00163      }
    00165      inline bool doForcing() const {
    00166           return (independentOptions_[1] & 32) == 0;
    00167      }
    00168      inline void setDoForcing(bool doForcing_) {
    00169           if (doForcing_) independentOptions_[1]  &= ~32;
    00170           else independentOptions_[1] |= 32;
    00171      }
    00173      inline bool doImpliedFree() const {
    00174           return (independentOptions_[1] & 64) == 0;
    00175      }
    00176      inline void setDoImpliedFree(bool doImpliedfree) {
    00177           if (doImpliedfree) independentOptions_[1]  &= ~64;
    00178           else independentOptions_[1] |= 64;
    00179      }
    00181      inline bool doDupcol() const {
    00182           return (independentOptions_[1] & 128) == 0;
    00183      }
    00184      inline void setDoDupcol(bool doDupcol_) {
    00185           if (doDupcol_) independentOptions_[1]  &= ~128;
    00186           else independentOptions_[1] |= 128;
    00187      }
    00189      inline bool doDuprow() const {
    00190           return (independentOptions_[1] & 256) == 0;
    00191      }
    00192      inline void setDoDuprow(bool doDuprow_) {
    00193           if (doDuprow_) independentOptions_[1]  &= ~256;
    00194           else independentOptions_[1] |= 256;
    00195      }
    00197      inline bool doSingletonColumn() const {
    00198           return (independentOptions_[1] & 512) == 0;
    00199      }
    00200      inline void setDoSingletonColumn(bool doSingleton_) {
    00201           if (doSingleton_) independentOptions_[1]  &= ~512;
    00202           else independentOptions_[1] |= 512;
    00203      }
    00205      inline bool doKillSmall() const {
    00206           return (independentOptions_[1] & 8192) == 0;
    00207      }
    00208      inline void setDoKillSmall(bool doKill) {
    00209           if (doKill) independentOptions_[1]  &= ~8192;
    00210           else independentOptions_[1] |= 8192;
    00211      }
    00213      inline int presolveActions() const {
    00214           return independentOptions_[1] & 0xffff;
    00215      }
    00216      inline void setPresolveActions(int action) {
    00217           independentOptions_[1]  = (independentOptions_[1] & 0xffff0000) | (action & 0xffff);
    00218      }
    00220      inline int substitution() const {
    00221           return independentOptions_[2];
    00222      }
    00223      inline void setSubstitution(int value) {
    00224           independentOptions_[2] = value;
    00225      }
    00226      inline void setIndependentOption(int type,int value) {
    00227           independentOptions_[type]  = value;
    00228      }
    00229      inline int independentOption(int type) const {
    00230           return independentOptions_[type];
    00231      }
    00233
    00235 private:
    00236
    00240
    00241      SolveType method_;
    00243      PresolveType presolveType_;
    00245      int numberPasses_;
    00247      int options_[7];
    00249      int extraInfo_[7];
    00256      int independentOptions_[3];
    00258 };
    00259
    00261 class ClpSimplexProgress {
    00262
    00263 public:
    00264
    00265
    00268
    00269      ClpSimplexProgress (  );
    00270
    00272      ClpSimplexProgress ( ClpSimplex * model );
    00273
    00275      ClpSimplexProgress(const ClpSimplexProgress &);
    00276
    00278      ClpSimplexProgress & operator=(const ClpSimplexProgress & rhs);
    00280      ~ClpSimplexProgress (  );
    00282      void reset();
    00284      void fillFromModel ( ClpSimplex * model );
    00285
    00287
    00293      int looping (  );
    00295      void startCheck();
    00297      int cycle(int in, int out, int wayIn, int wayOut);
    00298
    00300      double lastObjective(int back = 1) const;
    00302      void setInfeasibility(double value);
    00304      double lastInfeasibility(int back = 1) const;
    00306      int numberInfeasibilities(int back = 1) const;
    00308      void modifyObjective(double value);
    00310      int lastIterationNumber(int back = 1) const;
    00312      void clearIterationNumbers();
    00314      inline void newOddState() {
    00315           oddState_ = - oddState_ - 1;
    00316      }
    00317      inline void endOddState() {
    00318           oddState_ = abs(oddState_);
    00319      }
    00320      inline void clearOddState() {
    00321           oddState_ = 0;
    00322      }
    00323      inline int oddState() const {
    00324           return oddState_;
    00325      }
    00327      inline int badTimes() const {
    00328           return numberBadTimes_;
    00329      }
    00330      inline void clearBadTimes() {
    00331           numberBadTimes_ = 0;
    00332      }
    00334      inline int reallyBadTimes() const {
    00335           return numberReallyBadTimes_;
    00336      }
    00337      inline void incrementReallyBadTimes() {
    00338           numberReallyBadTimes_++;
    00339      }
    00341      inline int timesFlagged() const {
    00342           return numberTimesFlagged_;
    00343      }
    00344      inline void clearTimesFlagged() {
    00345           numberTimesFlagged_ = 0;
    00346      }
    00347      inline void incrementTimesFlagged() {
    00348           numberTimesFlagged_++;
    00349      }
    00350
    00352
    00353 #define CLP_PROGRESS 5
    00354      //#define CLP_PROGRESS_WEIGHT 10
    00356
    00357      double objective_[CLP_PROGRESS];
    00359      double infeasibility_[CLP_PROGRESS];
    00361      double realInfeasibility_[CLP_PROGRESS];
    00362 #ifdef CLP_PROGRESS_WEIGHT
    00364      double objectiveWeight_[CLP_PROGRESS_WEIGHT];
    00366      double infeasibilityWeight_[CLP_PROGRESS_WEIGHT];
    00368      double realInfeasibilityWeight_[CLP_PROGRESS_WEIGHT];
    00370      double drop_;
    00372      double best_;
    00373 #endif
    00375      double initialWeight_;
    00376 #define CLP_CYCLE 12
    00378      //double obj_[CLP_CYCLE];
    00379      int in_[CLP_CYCLE];
    00380      int out_[CLP_CYCLE];
    00381      char way_[CLP_CYCLE];
    00383      ClpSimplex * model_;
    00385      int numberInfeasibilities_[CLP_PROGRESS];
    00387      int iterationNumber_[CLP_PROGRESS];
    00388 #ifdef CLP_PROGRESS_WEIGHT
    00390      int numberInfeasibilitiesWeight_[CLP_PROGRESS_WEIGHT];
    00392      int iterationNumberWeight_[CLP_PROGRESS_WEIGHT];
    00393 #endif
    00395      int numberTimes_;
    00397      int numberBadTimes_;
    00399      int numberReallyBadTimes_;
    00401      int numberTimesFlagged_;
    00403      int oddState_;
    00404
    00405 };
    00406
    00407 #include "ClpConfig.h"
    00408 #if CLP_HAS_ABC
    00409 #include "AbcCommon.hpp"
    00411 class AbcSimplexProgress : public ClpSimplexProgress {
    00412
    00413 public:
    00414
    00415
    00418
    00419      AbcSimplexProgress (  );
    00420
    00422      AbcSimplexProgress ( ClpSimplex * model );
    00423
    00425      AbcSimplexProgress(const AbcSimplexProgress &);
    00426
    00428      AbcSimplexProgress & operator=(const AbcSimplexProgress & rhs);
    00430      ~AbcSimplexProgress (  );
    00431
    00433
    00439      int looping (  );
    00440
    00442
    00444 };
    00445 #endif
    00446 #endif