ClpSolve.hpp

Go to the documentation of this file.
00001 /* $Id: ClpSolve.hpp 1928 2013-04-06 12:54:16Z stefan $ */
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 bool doKillSmall() const {
00204           return (independentOptions_[1] & 1024) == 0;
00205      }
00206      inline void setDoKillSmall(bool doKill) {
00207           if (doKill) independentOptions_[1]  &= ~1024;
00208           else independentOptions_[1] |= 1024;
00209      }
00211      inline int presolveActions() const {
00212           return independentOptions_[1] & 0xffff;
00213      }
00214      inline void setPresolveActions(int action) {
00215           independentOptions_[1]  = (independentOptions_[1] & 0xffff0000) | (action & 0xffff);
00216      }
00218      inline int substitution() const {
00219           return independentOptions_[2];
00220      }
00221      inline void setSubstitution(int value) {
00222           independentOptions_[2] = value;
00223      }
00225 
00227 private:
00228 
00232 
00233      SolveType method_;
00235      PresolveType presolveType_;
00237      int numberPasses_;
00239      int options_[7];
00241      int extraInfo_[7];
00247      int independentOptions_[3];
00249 };
00250 
00252 class ClpSimplexProgress {
00253 
00254 public:
00255 
00256 
00259 
00260      ClpSimplexProgress (  );
00261 
00263      ClpSimplexProgress ( ClpSimplex * model );
00264 
00266      ClpSimplexProgress(const ClpSimplexProgress &);
00267 
00269      ClpSimplexProgress & operator=(const ClpSimplexProgress & rhs);
00271      ~ClpSimplexProgress (  );
00273      void reset();
00275      void fillFromModel ( ClpSimplex * model );
00276 
00278 
00284      int looping (  );
00286      void startCheck();
00288      int cycle(int in, int out, int wayIn, int wayOut);
00289 
00291      double lastObjective(int back = 1) const;
00293      void setInfeasibility(double value);
00295      double lastInfeasibility(int back = 1) const;
00297      void modifyObjective(double value);
00299      int lastIterationNumber(int back = 1) const;
00301      void clearIterationNumbers();
00303      inline void newOddState() {
00304           oddState_ = - oddState_ - 1;
00305      }
00306      inline void endOddState() {
00307           oddState_ = abs(oddState_);
00308      }
00309      inline void clearOddState() {
00310           oddState_ = 0;
00311      }
00312      inline int oddState() const {
00313           return oddState_;
00314      }
00316      inline int badTimes() const {
00317           return numberBadTimes_;
00318      }
00319      inline void clearBadTimes() {
00320           numberBadTimes_ = 0;
00321      }
00323      inline int reallyBadTimes() const {
00324           return numberReallyBadTimes_;
00325      }
00326      inline void incrementReallyBadTimes() {
00327           numberReallyBadTimes_++;
00328      }
00330      inline int timesFlagged() const {
00331           return numberTimesFlagged_;
00332      }
00333      inline void clearTimesFlagged() {
00334           numberTimesFlagged_ = 0;
00335      }
00336      inline void incrementTimesFlagged() {
00337           numberTimesFlagged_++;
00338      }
00339 
00341 
00342 #define CLP_PROGRESS 5
00343      //#define CLP_PROGRESS_WEIGHT 10
00345 
00346      double objective_[CLP_PROGRESS];
00348      double infeasibility_[CLP_PROGRESS];
00350      double realInfeasibility_[CLP_PROGRESS];
00351 #ifdef CLP_PROGRESS_WEIGHT
00353      double objectiveWeight_[CLP_PROGRESS_WEIGHT];
00355      double infeasibilityWeight_[CLP_PROGRESS_WEIGHT];
00357      double realInfeasibilityWeight_[CLP_PROGRESS_WEIGHT];
00359      double drop_;
00361      double best_;
00362 #endif
00364      double initialWeight_;
00365 #define CLP_CYCLE 12
00367      //double obj_[CLP_CYCLE];
00368      int in_[CLP_CYCLE];
00369      int out_[CLP_CYCLE];
00370      char way_[CLP_CYCLE];
00372      ClpSimplex * model_;
00374      int numberInfeasibilities_[CLP_PROGRESS];
00376      int iterationNumber_[CLP_PROGRESS];
00377 #ifdef CLP_PROGRESS_WEIGHT
00379      int numberInfeasibilitiesWeight_[CLP_PROGRESS_WEIGHT];
00381      int iterationNumberWeight_[CLP_PROGRESS_WEIGHT];
00382 #endif
00384      int numberTimes_;
00386      int numberBadTimes_;
00388      int numberReallyBadTimes_;
00390      int numberTimesFlagged_;
00392      int oddState_;
00393 
00394 };
00395 
00396 #include "ClpConfig.h"
00397 #if CLP_HAS_ABC
00398 #include "AbcCommon.hpp"
00400 class AbcSimplexProgress : public ClpSimplexProgress {
00401 
00402 public:
00403 
00404 
00407 
00408      AbcSimplexProgress (  );
00409 
00411      AbcSimplexProgress ( ClpSimplex * model );
00412 
00414      AbcSimplexProgress(const AbcSimplexProgress &);
00415 
00417      AbcSimplexProgress & operator=(const AbcSimplexProgress & rhs);
00419      ~AbcSimplexProgress (  );
00420 
00422 
00428      int looping (  );
00429 
00431 
00433 };
00434 #endif
00435 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 23 Nov 2013 for Clp by  doxygen 1.6.1