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

- File List
- File Members

# /home/coin/SVN-release/Cgl-0.52.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;}
    00272
    00274
    00275 #define CLP_PROGRESS 5
    00276   //#define CLP_PROGRESS_WEIGHT 10
    00278
    00279   double objective_[CLP_PROGRESS];
    00281   double infeasibility_[CLP_PROGRESS];
    00283   double realInfeasibility_[CLP_PROGRESS];
    00284 #ifdef CLP_PROGRESS_WEIGHT
    00286   double objectiveWeight_[CLP_PROGRESS_WEIGHT];
    00288   double infeasibilityWeight_[CLP_PROGRESS_WEIGHT];
    00290   double realInfeasibilityWeight_[CLP_PROGRESS_WEIGHT];
    00292   double drop_;
    00294   double best_;
    00295 #endif
    00297   double initialWeight_;
    00298 #define CLP_CYCLE 12
    00300   //double obj_[CLP_CYCLE];
    00301   int in_[CLP_CYCLE];
    00302   int out_[CLP_CYCLE];
    00303   char way_[CLP_CYCLE];
    00305   ClpSimplex * model_;
    00307   int numberInfeasibilities_[CLP_PROGRESS];
    00309   int iterationNumber_[CLP_PROGRESS];
    00310 #ifdef CLP_PROGRESS_WEIGHT
    00312   int numberInfeasibilitiesWeight_[CLP_PROGRESS_WEIGHT];
    00314   int iterationNumberWeight_[CLP_PROGRESS_WEIGHT];
    00315 #endif
    00317   int numberTimes_;
    00319   int numberBadTimes_;
    00321   int oddState_;
    00322
    00323 };
    00324 #endif