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

- File List
- File Members

# /home/coin/svn-release/Alps-1.4.6/Clp/src/ClpPrimalColumnSteepest.hpp

Go to the documentation of this file.

    00001 /* $Id: ClpPrimalColumnSteepest.hpp 1665 2011-01-04 17:55:54Z lou $ */
    00002 // Copyright (C) 2002, 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 #ifndef ClpPrimalColumnSteepest_H
    00007 #define ClpPrimalColumnSteepest_H
    00008
    00009 #include "ClpPrimalColumnPivot.hpp"
    00010 #include <bitset>
    00011
    00012 //#############################################################################
    00013 class CoinIndexedVector;
    00014
    00015
    00023 class ClpPrimalColumnSteepest : public ClpPrimalColumnPivot {
    00024
    00025 public:
    00026
    00028
    00029
    00037      virtual int pivotColumn(CoinIndexedVector * updates,
    00038                              CoinIndexedVector * spareRow1,
    00039                              CoinIndexedVector * spareRow2,
    00040                              CoinIndexedVector * spareColumn1,
    00041                              CoinIndexedVector * spareColumn2);
    00043      int pivotColumnOldMethod(CoinIndexedVector * updates,
    00044                               CoinIndexedVector * spareRow1,
    00045                               CoinIndexedVector * spareRow2,
    00046                               CoinIndexedVector * spareColumn1,
    00047                               CoinIndexedVector * spareColumn2);
    00049      void justDjs(CoinIndexedVector * updates,
    00050                   CoinIndexedVector * spareRow2,
    00051                   CoinIndexedVector * spareColumn1,
    00052                   CoinIndexedVector * spareColumn2);
    00054      int partialPricing(CoinIndexedVector * updates,
    00055                         CoinIndexedVector * spareRow2,
    00056                         int numberWanted,
    00057                         int numberLook);
    00059      void djsAndDevex(CoinIndexedVector * updates,
    00060                       CoinIndexedVector * spareRow2,
    00061                       CoinIndexedVector * spareColumn1,
    00062                       CoinIndexedVector * spareColumn2);
    00064      void djsAndSteepest(CoinIndexedVector * updates,
    00065                          CoinIndexedVector * spareRow2,
    00066                          CoinIndexedVector * spareColumn1,
    00067                          CoinIndexedVector * spareColumn2);
    00069      void djsAndDevex2(CoinIndexedVector * updates,
    00070                        CoinIndexedVector * spareRow2,
    00071                        CoinIndexedVector * spareColumn1,
    00072                        CoinIndexedVector * spareColumn2);
    00074      void djsAndSteepest2(CoinIndexedVector * updates,
    00075                           CoinIndexedVector * spareRow2,
    00076                           CoinIndexedVector * spareColumn1,
    00077                           CoinIndexedVector * spareColumn2);
    00079      void justDevex(CoinIndexedVector * updates,
    00080                     CoinIndexedVector * spareRow2,
    00081                     CoinIndexedVector * spareColumn1,
    00082                     CoinIndexedVector * spareColumn2);
    00084      void justSteepest(CoinIndexedVector * updates,
    00085                        CoinIndexedVector * spareRow2,
    00086                        CoinIndexedVector * spareColumn1,
    00087                        CoinIndexedVector * spareColumn2);
    00089      void transposeTimes2(const CoinIndexedVector * pi1, CoinIndexedVector * dj1,
    00090                           const CoinIndexedVector * pi2, CoinIndexedVector * dj2,
    00091                           CoinIndexedVector * spare, double scaleFactor);
    00092
    00094      virtual void updateWeights(CoinIndexedVector * input);
    00095
    00097      void checkAccuracy(int sequence, double relativeTolerance,
    00098                         CoinIndexedVector * rowArray1,
    00099                         CoinIndexedVector * rowArray2);
    00100
    00102      void initializeWeights();
    00103
    00112      virtual void saveWeights(ClpSimplex * model, int mode);
    00114      virtual void unrollWeights();
    00116      virtual void clearArrays();
    00118      virtual bool looksOptimal() const;
    00120      virtual void maximumPivotsChanged();
    00122
    00125
    00126      inline int mode() const {
    00127           return mode_;
    00128      }
    00132      virtual int numberSprintColumns(int & numberIterations) const;
    00134      virtual void switchOffSprint();
    00135
    00137
    00140      enum Persistence {
    00141           normal = 0x00, // create (if necessary) and destroy
    00142           keep = 0x01 // create (if necessary) and leave
    00143      };
    00144
    00146
    00147
    00155      ClpPrimalColumnSteepest(int mode = 3);
    00156
    00158      ClpPrimalColumnSteepest(const ClpPrimalColumnSteepest & rhs);
    00159
    00161      ClpPrimalColumnSteepest & operator=(const ClpPrimalColumnSteepest& rhs);
    00162
    00164      virtual ~ClpPrimalColumnSteepest ();
    00165
    00167      virtual ClpPrimalColumnPivot * clone(bool copyData = true) const;
    00168
    00170
    00172
    00175      inline bool reference(int i) const {
    00176           return ((reference_[i>>5] >> (i & 31)) & 1) != 0;
    00177      }
    00178      inline void setReference(int i, bool trueFalse) {
    00179           unsigned int & value = reference_[i>>5];
    00180           int bit = i & 31;
    00181           if (trueFalse)
    00182                value |= (1 << bit);
    00183           else
    00184                value &= ~(1 << bit);
    00185      }
    00187      inline void setPersistence(Persistence life) {
    00188           persistence_ = life;
    00189      }
    00190      inline Persistence persistence() const {
    00191           return persistence_ ;
    00192      }
    00193
    00195      //---------------------------------------------------------------------------
    00196
    00197 private:
    00199      // Update weight
    00200      double devex_;
    00202      double * weights_;
    00204      CoinIndexedVector * infeasible_;
    00206      CoinIndexedVector * alternateWeights_;
    00208      double * savedWeights_;
    00209      // Array for exact devex to say what is in reference framework
    00210      unsigned int * reference_;
    00216      int state_;
    00229      int mode_;
    00231      Persistence persistence_;
    00233      int numberSwitched_;
    00234      // This is pivot row (or pivot sequence round re-factorization)
    00235      int pivotSequence_;
    00236      // This is saved pivot sequence
    00237      int savedPivotSequence_;
    00238      // This is saved outgoing variable
    00239      int savedSequenceOut_;
    00240      // Iteration when last rectified
    00241      int lastRectified_;
    00242      // Size of factorization at invert (used to decide algorithm)
    00243      int sizeFactorization_;
    00245 };
    00246
    00247 #endif