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

- File List
- File Members

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

Go to the documentation of this file.

    00001 // Copyright (C) 2002, International Business Machines
    00002 // Corporation and others.  All Rights Reserved.
    00003 #ifndef ClpPrimalColumnSteepest_H
    00004 #define ClpPrimalColumnSteepest_H
    00005
    00006 #include "ClpPrimalColumnPivot.hpp"
    00007 #include <bitset>
    00008
    00009 //#############################################################################
    00010 class CoinIndexedVector;
    00011
    00012
    00020 class ClpPrimalColumnSteepest : public ClpPrimalColumnPivot {
    00021
    00022 public:
    00023
    00025
    00026
    00034   virtual int pivotColumn(CoinIndexedVector * updates,
    00035                           CoinIndexedVector * spareRow1,
    00036                           CoinIndexedVector * spareRow2,
    00037                           CoinIndexedVector * spareColumn1,
    00038                           CoinIndexedVector * spareColumn2);
    00040   int pivotColumnOldMethod(CoinIndexedVector * updates,
    00041                           CoinIndexedVector * spareRow1,
    00042                           CoinIndexedVector * spareRow2,
    00043                           CoinIndexedVector * spareColumn1,
    00044                           CoinIndexedVector * spareColumn2);
    00046   void justDjs(CoinIndexedVector * updates,
    00047                CoinIndexedVector * spareRow1,
    00048                CoinIndexedVector * spareRow2,
    00049                CoinIndexedVector * spareColumn1,
    00050                CoinIndexedVector * spareColumn2);
    00052   int partialPricing(CoinIndexedVector * updates,
    00053                      CoinIndexedVector * spareRow2,
    00054                      int numberWanted,
    00055                      int numberLook);
    00057   void djsAndDevex(CoinIndexedVector * updates,
    00058                CoinIndexedVector * spareRow1,
    00059                CoinIndexedVector * spareRow2,
    00060                CoinIndexedVector * spareColumn1,
    00061                CoinIndexedVector * spareColumn2);
    00063   void djsAndSteepest(CoinIndexedVector * updates,
    00064                CoinIndexedVector * spareRow1,
    00065                CoinIndexedVector * spareRow2,
    00066                CoinIndexedVector * spareColumn1,
    00067                CoinIndexedVector * spareColumn2);
    00069   void djsAndDevex2(CoinIndexedVector * updates,
    00070                CoinIndexedVector * spareRow1,
    00071                CoinIndexedVector * spareRow2,
    00072                CoinIndexedVector * spareColumn1,
    00073                CoinIndexedVector * spareColumn2);
    00075   void djsAndSteepest2(CoinIndexedVector * updates,
    00076                CoinIndexedVector * spareRow1,
    00077                CoinIndexedVector * spareRow2,
    00078                CoinIndexedVector * spareColumn1,
    00079                CoinIndexedVector * spareColumn2);
    00081   void justDevex(CoinIndexedVector * updates,
    00082                CoinIndexedVector * spareRow1,
    00083                CoinIndexedVector * spareRow2,
    00084                CoinIndexedVector * spareColumn1,
    00085                CoinIndexedVector * spareColumn2);
    00087   void justSteepest(CoinIndexedVector * updates,
    00088                CoinIndexedVector * spareRow1,
    00089                CoinIndexedVector * spareRow2,
    00090                CoinIndexedVector * spareColumn1,
    00091                CoinIndexedVector * spareColumn2);
    00093   void transposeTimes2(const CoinIndexedVector * pi1, CoinIndexedVector * dj1,
    00094                        const CoinIndexedVector * pi2, CoinIndexedVector * dj2,
    00095                        CoinIndexedVector * spare,double scaleFactor);
    00096
    00098   virtual void updateWeights(CoinIndexedVector * input);
    00099
    00101   void checkAccuracy(int sequence,double relativeTolerance,
    00102                      CoinIndexedVector * rowArray1,
    00103                      CoinIndexedVector * rowArray2);
    00104
    00106   void initializeWeights();
    00107
    00109   virtual void saveWeights(ClpSimplex * model,int mode);
    00111   virtual void unrollWeights();
    00113   virtual void clearArrays();
    00115   virtual bool looksOptimal() const;
    00117   virtual void maximumPivotsChanged();
    00119
    00122
    00123   inline int mode() const
    00124     { return mode_;}
    00128   virtual int numberSprintColumns(int & numberIterations) const;
    00130   virtual void switchOffSprint();
    00131
    00133
    00136   enum Persistence {
    00137     normal = 0x00, // create (if necessary) and destroy
    00138     keep = 0x01 // create (if necessary) and leave
    00139   };
    00140
    00142
    00143
    00151   ClpPrimalColumnSteepest(int mode=3);
    00152
    00154   ClpPrimalColumnSteepest(const ClpPrimalColumnSteepest &);
    00155
    00157   ClpPrimalColumnSteepest & operator=(const ClpPrimalColumnSteepest& rhs);
    00158
    00160   virtual ~ClpPrimalColumnSteepest ();
    00161
    00163   virtual ClpPrimalColumnPivot * clone(bool copyData = true) const;
    00164
    00166
    00168
    00171   inline bool reference(int i) const {
    00172     return ((reference_[i>>5]>>(i&31))&1)!=0;
    00173   }
    00174   inline void setReference(int i,bool trueFalse) {
    00175     unsigned int & value = reference_[i>>5];
    00176     int bit = i&31;
    00177     if (trueFalse)
    00178       value |= (1<<bit);
    00179     else
    00180       value &= ~(1<<bit);
    00181   }
    00183   inline void setPersistence(Persistence life)
    00184   { persistence_ = life;}
    00185   inline Persistence persistence() const
    00186   { return persistence_ ;}
    00187
    00189   //---------------------------------------------------------------------------
    00190
    00191 private:
    00193   // Update weight
    00194   double devex_;
    00196   double * weights_;
    00198   CoinIndexedVector * infeasible_;
    00200   CoinIndexedVector * alternateWeights_;
    00202   double * savedWeights_;
    00203   // Array for exact devex to say what is in reference framework
    00204   unsigned int * reference_;
    00210   int state_;
    00223   int mode_;
    00225   Persistence persistence_;
    00227   int numberSwitched_;
    00228   // This is pivot row (or pivot sequence round re-factorization)
    00229   int pivotSequence_;
    00230   // This is saved pivot sequence
    00231   int savedPivotSequence_;
    00232   // This is saved outgoing variable
    00233   int savedSequenceOut_;
    00234   // Iteration when last rectified
    00235   int lastRectified_;
    00236   // Size of factorization at invert (used to decide algorithm)
    00237   int sizeFactorization_;
    00239 };
    00240
    00241 #endif