• Main Page
  • Classes
  • Files
  • File List
  • File Members

/build/buildd/clp-1.11.1/Clp/src/ClpSolve.hpp

Go to the documentation of this file.
00001 /* $Id: ClpSolve.hpp 1461 2009-11-06 19:06:43Z stefan $ */
00002 // Copyright (C) 2003, International Business Machines
00003 // Corporation and others.  All Rights Reserved.
00004 
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;}
00122   inline bool doDual() const
00123   { return (independentOptions_[1]&1)==0;}
00124   inline void setDoDual(bool doDual_)
00125   { if (doDual_) independentOptions_[1]  &= ~1; else independentOptions_[1] |= 1;}
00127   inline bool doSingleton() const
00128   { return (independentOptions_[1]&2)==0;}
00129   inline void setDoSingleton(bool doSingleton_)
00130   { if (doSingleton_) independentOptions_[1]  &= ~2; else independentOptions_[1] |= 2;}
00132   inline bool doDoubleton() const
00133   { return (independentOptions_[1]&4)==0;}
00134   inline void setDoDoubleton(bool doDoubleton_)
00135   { if (doDoubleton_) independentOptions_[1]  &= ~4; else independentOptions_[1] |= 4;}
00137   inline bool doTripleton() const
00138   { return (independentOptions_[1]&8)==0;}
00139   inline void setDoTripleton(bool doTripleton_)
00140   { if (doTripleton_) independentOptions_[1]  &= ~8; else independentOptions_[1] |= 8;}
00142   inline bool doTighten() const
00143   { return (independentOptions_[1]&16)==0;}
00144   inline void setDoTighten(bool doTighten_)
00145   { if (doTighten_) independentOptions_[1]  &= ~16; else independentOptions_[1] |= 16;}
00147   inline bool doForcing() const
00148   { return (independentOptions_[1]&32)==0;}
00149   inline void setDoForcing(bool doForcing_)
00150   { if (doForcing_) independentOptions_[1]  &= ~32; else independentOptions_[1] |= 32;}
00152   inline bool doImpliedFree() const
00153   { return (independentOptions_[1]&64)==0;}
00154   inline void setDoImpliedFree(bool doImpliedfree)
00155   { if (doImpliedfree) independentOptions_[1]  &= ~64; else independentOptions_[1] |= 64;}
00157   inline bool doDupcol() const
00158   { return (independentOptions_[1]&128)==0;}
00159   inline void setDoDupcol(bool doDupcol_)
00160   { if (doDupcol_) independentOptions_[1]  &= ~128; else independentOptions_[1] |= 128;}
00162   inline bool doDuprow() const
00163   { return (independentOptions_[1]&256)==0;}
00164   inline void setDoDuprow(bool doDuprow_)
00165   { if (doDuprow_) independentOptions_[1]  &= ~256; else independentOptions_[1] |= 256;}
00167   inline bool doSingletonColumn() const
00168   { return (independentOptions_[1]&512)==0;}
00169   inline void setDoSingletonColumn(bool doSingleton_)
00170   { if (doSingleton_) independentOptions_[1]  &= ~512; else independentOptions_[1] |= 512;}
00172   inline int presolveActions() const
00173   { return independentOptions_[1]&0xffff;}
00174   inline void setPresolveActions(int action)
00175   { independentOptions_[1]  = (independentOptions_[1]&0xffff0000)|(action&0xffff);}
00177   inline int substitution() const
00178   { return independentOptions_[2];}
00179   inline void setSubstitution(int value)
00180   { independentOptions_[2] = value;}
00182 
00184 private:
00185 
00189 
00190   SolveType method_;
00192   PresolveType presolveType_;
00194   int numberPasses_;
00196   int options_[7];
00198   int extraInfo_[7];
00204   int independentOptions_[3];
00206 };
00207 
00209 class ClpSimplexProgress {
00210 
00211 public:
00212 
00213 
00216 
00217     ClpSimplexProgress (  );
00218 
00220     ClpSimplexProgress ( ClpSimplex * model );
00221 
00223   ClpSimplexProgress(const ClpSimplexProgress &);
00224 
00226     ClpSimplexProgress & operator=(const ClpSimplexProgress & rhs);
00228    ~ClpSimplexProgress (  );
00230    void reset();
00232     void fillFromModel ( ClpSimplex * model );
00233 
00235 
00241     int looping (  );
00243   void startCheck();
00245   int cycle(int in, int out,int wayIn,int wayOut); 
00246 
00248   double lastObjective(int back=1) const;
00250   void setInfeasibility(double value);
00252   double lastInfeasibility(int back=1) const;
00254   void modifyObjective(double value);
00256   int lastIterationNumber(int back=1) const;
00258   void clearIterationNumbers();
00260   inline void newOddState()
00261   { oddState_= - oddState_-1;}
00262   inline void endOddState()
00263   { oddState_=abs(oddState_);}
00264   inline void clearOddState() 
00265   { oddState_=0;}
00266   inline int oddState() const
00267   { return oddState_;}
00269   inline int badTimes() const
00270   { return numberBadTimes_;}
00271   inline void clearBadTimes()
00272   { numberBadTimes_=0;}
00274   inline int reallyBadTimes() const
00275   { return numberReallyBadTimes_;}
00276   inline void incrementReallyBadTimes()
00277   { numberReallyBadTimes_++;}
00279   inline int timesFlagged() const
00280   { return numberTimesFlagged_;}
00281   inline void clearTimesFlagged()
00282   { numberTimesFlagged_=0;}
00283   inline void incrementTimesFlagged()
00284   { numberTimesFlagged_++;}
00285 
00287 
00288 #define CLP_PROGRESS 5
00289   //#define CLP_PROGRESS_WEIGHT 10
00291 
00292   double objective_[CLP_PROGRESS];
00294   double infeasibility_[CLP_PROGRESS];
00296   double realInfeasibility_[CLP_PROGRESS];
00297 #ifdef CLP_PROGRESS_WEIGHT
00298 
00299   double objectiveWeight_[CLP_PROGRESS_WEIGHT];
00301   double infeasibilityWeight_[CLP_PROGRESS_WEIGHT];
00303   double realInfeasibilityWeight_[CLP_PROGRESS_WEIGHT];
00305   double drop_;
00307   double best_;
00308 #endif
00309 
00310   double initialWeight_;
00311 #define CLP_CYCLE 12
00312 
00313   //double obj_[CLP_CYCLE];
00314   int in_[CLP_CYCLE];
00315   int out_[CLP_CYCLE];
00316   char way_[CLP_CYCLE];
00318   ClpSimplex * model_;
00320   int numberInfeasibilities_[CLP_PROGRESS];
00322   int iterationNumber_[CLP_PROGRESS];
00323 #ifdef CLP_PROGRESS_WEIGHT
00324 
00325   int numberInfeasibilitiesWeight_[CLP_PROGRESS_WEIGHT];
00327   int iterationNumberWeight_[CLP_PROGRESS_WEIGHT];
00328 #endif
00329 
00330   int numberTimes_;
00332   int numberBadTimes_;
00334   int numberReallyBadTimes_;
00336   int numberTimesFlagged_;
00338   int oddState_;
00340 };
00341 #endif

Generated on Fri Aug 20 2010 06:29:29 by  doxygen 1.7.1