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

- File List
- File Members

# /home/coin/SVN-release/Bcps-0.91.0/Clp/src/ClpSolve.hpp

Go to the documentation of this file.

    00001 // Copyright (C) 2003, International Business Machines
    00002 // Corporation and others.  All Rights Reserved.
    00003
    00004 /*
    00005    Authors
    00006
    00007    John Forrest
    00008
    00009  */
    00010 #ifndef ClpSolve_H
    00011 #define ClpSolve_H
    00012
    00019 class ClpSolve  {
    00020
    00021 public:
    00022
    00024   enum SolveType {
    00025     useDual=0,
    00026     usePrimal,
    00027     usePrimalorSprint,
    00028     useBarrier,
    00029     useBarrierNoCross,
    00030     automatic,
    00031     notImplemented
    00032   };
    00033   enum PresolveType {
    00034     presolveOn=0,
    00035     presolveOff,
    00036     presolveNumber,
    00037     presolveNumberCost
    00038   };
    00039
    00042
    00043   ClpSolve (  );
    00045   ClpSolve ( SolveType method, PresolveType presolveType,
    00046              int numberPasses, int options[6],
    00047              int extraInfo[6], int independentOptions[3]);
    00049   void generateCpp(FILE * fp);
    00051   ClpSolve(const ClpSolve &);
    00053     ClpSolve & operator=(const ClpSolve & rhs);
    00055    ~ClpSolve (  );
    00057
    00102   void setSpecialOption(int which,int value,int extraInfo=-1);
    00103   int getSpecialOption(int which) const;
    00104
    00106   void setSolveType(SolveType method, int extraInfo=-1);
    00107   SolveType getSolveType();
    00108
    00109   // Presolve types
    00110   void setPresolveType(PresolveType amount, int extraInfo=-1);
    00111   PresolveType getPresolveType();
    00112   int getPresolvePasses() const;
    00114   int getExtraInfo(int which) const;
    00117   void setInfeasibleReturn(bool trueFalse);
    00118   inline bool infeasibleReturn() const
    00119   { return independentOptions_[0]!=0;}
    00121   inline bool doDual() const
    00122   { return (independentOptions_[1]&1)==0;}
    00123   inline void setDoDual(bool doDual)
    00124   { if (doDual) independentOptions_[1]  &= ~1; else independentOptions_[1] |= 1;}
    00126   inline bool doSingleton() const
    00127   { return (independentOptions_[1]&2)==0;}
    00128   inline void setDoSingleton(bool doSingleton)
    00129   { if (doSingleton) independentOptions_[1]  &= ~2; else independentOptions_[1] |= 2;}
    00131   inline bool doDoubleton() const
    00132   { return (independentOptions_[1]&4)==0;}
    00133   inline void setDoDoubleton(bool doDoubleton)
    00134   { if (doDoubleton) independentOptions_[1]  &= ~4; else independentOptions_[1] |= 4;}
    00136   inline bool doTripleton() const
    00137   { return (independentOptions_[1]&8)==0;}
    00138   inline void setDoTripleton(bool doTripleton)
    00139   { if (doTripleton) independentOptions_[1]  &= ~8; else independentOptions_[1] |= 8;}
    00141   inline bool doTighten() const
    00142   { return (independentOptions_[1]&16)==0;}
    00143   inline void setDoTighten(bool doTighten)
    00144   { if (doTighten) independentOptions_[1]  &= ~16; else independentOptions_[1] |= 16;}
    00146   inline bool doForcing() const
    00147   { return (independentOptions_[1]&32)==0;}
    00148   inline void setDoForcing(bool doForcing)
    00149   { if (doForcing) independentOptions_[1]  &= ~32; else independentOptions_[1] |= 32;}
    00151   inline bool doImpliedFree() const
    00152   { return (independentOptions_[1]&64)==0;}
    00153   inline void setDoImpliedFree(bool doImpliedfree)
    00154   { if (doImpliedfree) independentOptions_[1]  &= ~64; else independentOptions_[1] |= 64;}
    00156   inline bool doDupcol() const
    00157   { return (independentOptions_[1]&128)==0;}
    00158   inline void setDoDupcol(bool doDupcol)
    00159   { if (doDupcol) independentOptions_[1]  &= ~128; else independentOptions_[1] |= 128;}
    00161   inline bool doDuprow() const
    00162   { return (independentOptions_[1]&256)==0;}
    00163   inline void setDoDuprow(bool doDuprow)
    00164   { if (doDuprow) independentOptions_[1]  &= ~256; else independentOptions_[1] |= 256;}
    00166   inline bool doSingletonColumn() const
    00167   { return (independentOptions_[1]&512)==0;}
    00168   inline void setDoSingletonColumn(bool doSingleton)
    00169   { if (doSingleton) independentOptions_[1]  &= ~512; else independentOptions_[1] |= 512;}
    00171   inline int presolveActions() const
    00172   { return independentOptions_[1]&0xffff;}
    00173   inline void setPresolveActions(int action)
    00174   { independentOptions_[1]  = (independentOptions_[1]&0xffff0000)|(action&0xffff);}
    00176   inline int substitution() const
    00177   { return independentOptions_[2];}
    00178   inline void setSubstitution(int value)
    00179   { independentOptions_[2] = value;}
    00181
    00183 private:
    00184
    00188
    00189   SolveType method_;
    00191   PresolveType presolveType_;
    00193   int numberPasses_;
    00195   int options_[7];
    00197   int extraInfo_[7];
    00203   int independentOptions_[3];
    00205 };
    00206
    00208 class ClpSimplexProgress {
    00209
    00210 public:
    00211
    00212
    00215
    00216     ClpSimplexProgress (  );
    00217
    00219     ClpSimplexProgress ( ClpSimplex * model );
    00220
    00222   ClpSimplexProgress(const ClpSimplexProgress &);
    00223
    00225     ClpSimplexProgress & operator=(const ClpSimplexProgress & rhs);
    00227    ~ClpSimplexProgress (  );
    00229    void reset();
    00231     void fillFromModel ( ClpSimplex * model );
    00232
    00234
    00240     int looping (  );
    00242   void startCheck();
    00244   int cycle(int in, int out,int wayIn,int wayOut);
    00245
    00247   double lastObjective(int back=1) const;
    00249   void setInfeasibility(double value);
    00251   double lastInfeasibility(int back=1) const;
    00253   void modifyObjective(double value);
    00255   int lastIterationNumber(int back=1) const;
    00257   void clearIterationNumbers();
    00259   inline void newOddState()
    00260   { oddState_= - oddState_-1;}
    00261   inline void endOddState()
    00262   { oddState_=abs(oddState_);}
    00263   inline void clearOddState()
    00264   { oddState_=0;}
    00265   inline int oddState() const
    00266   { return oddState_;}
    00268   inline int badTimes() const
    00269   { return numberBadTimes_;}
    00270   inline void clearBadTimes()
    00271   { numberBadTimes_=0;}
    00273   inline int reallyBadTimes() const
    00274   { return numberReallyBadTimes_;}
    00275   inline void incrementReallyBadTimes()
    00276   { numberReallyBadTimes_++;}
    00278   inline int timesFlagged() const
    00279   { return numberTimesFlagged_;}
    00280   inline void clearTimesFlagged()
    00281   { numberTimesFlagged_=0;}
    00282   inline void incrementTimesFlagged()
    00283   { numberTimesFlagged_++;}
    00284
    00286
    00287 #define CLP_PROGRESS 5
    00288   //#define CLP_PROGRESS_WEIGHT 10
    00290
    00291   double objective_[CLP_PROGRESS];
    00293   double infeasibility_[CLP_PROGRESS];
    00295   double realInfeasibility_[CLP_PROGRESS];
    00296 #ifdef CLP_PROGRESS_WEIGHT
    00298   double objectiveWeight_[CLP_PROGRESS_WEIGHT];
    00300   double infeasibilityWeight_[CLP_PROGRESS_WEIGHT];
    00302   double realInfeasibilityWeight_[CLP_PROGRESS_WEIGHT];
    00304   double drop_;
    00306   double best_;
    00307 #endif
    00309   double initialWeight_;
    00310 #define CLP_CYCLE 12
    00312   //double obj_[CLP_CYCLE];
    00313   int in_[CLP_CYCLE];
    00314   int out_[CLP_CYCLE];
    00315   char way_[CLP_CYCLE];
    00317   ClpSimplex * model_;
    00319   int numberInfeasibilities_[CLP_PROGRESS];
    00321   int iterationNumber_[CLP_PROGRESS];
    00322 #ifdef CLP_PROGRESS_WEIGHT
    00324   int numberInfeasibilitiesWeight_[CLP_PROGRESS_WEIGHT];
    00326   int iterationNumberWeight_[CLP_PROGRESS_WEIGHT];
    00327 #endif
    00329   int numberTimes_;
    00331   int numberBadTimes_;
    00333   int numberReallyBadTimes_;
    00335   int numberTimesFlagged_;
    00337   int oddState_;
    00338
    00339 };
    00340 #endif