# AbcPrimalColumnSteepest.hpp

Go to the documentation of this file.

    00001 /* $Id: AbcPrimalColumnSteepest.hpp 1910 2013-01-27 02:00:13Z stefan $ */
    00002 // Copyright (C) 2002, International Business Machines
    00003 // Corporation and others, Copyright (C) 2012, FasterCoin.  All Rights Reserved.
    00004 // This code is licensed under the terms of the Eclipse Public License (EPL).
    00005
    00006 #ifndef AbcPrimalColumnSteepest_H
    00007 #define AbcPrimalColumnSteepest_H
    00008
    00009 #include "AbcPrimalColumnPivot.hpp"
    00010 #include <bitset>
    00011
    00012 //#############################################################################
    00013 class CoinIndexedVector;
    00014
    00015
    00023 class AbcPrimalColumnSteepest : public AbcPrimalColumnPivot {
    00024
    00025 public:
    00026
    00028
    00029
    00037      virtual int pivotColumn(CoinPartitionedVector * updates,
    00038                              CoinPartitionedVector * spareRow2,
    00039                              CoinPartitionedVector * spareColumn1);
    00041      void justDjs(CoinIndexedVector * updates,
    00042                   CoinIndexedVector * spareColumn1);
    00044      int partialPricing(CoinIndexedVector * updates,
    00045                         int numberWanted,
    00046                         int numberLook);
    00048      void djsAndDevex(CoinIndexedVector * updates,
    00049                       CoinIndexedVector * spareRow2,
    00050                       CoinIndexedVector * spareColumn1);
    00052      void djsAndDevex2(CoinIndexedVector * updates,
    00053                        CoinIndexedVector * spareColumn1);
    00055      void justDevex(CoinIndexedVector * updates,
    00056                     CoinIndexedVector * spareColumn1);
    00064      int doSteepestWork(CoinPartitionedVector * updates,
    00065                         CoinPartitionedVector * spareRow2,
    00066                         CoinPartitionedVector * spareColumn1,
    00067                         int type);
    00068
    00070      virtual void updateWeights(CoinIndexedVector * input);
    00071
    00073      void checkAccuracy(int sequence, double relativeTolerance,
    00074                         CoinIndexedVector * rowArray1);
    00075
    00077      void initializeWeights();
    00078
    00087      virtual void saveWeights(AbcSimplex * model, int mode);
    00089      virtual void unrollWeights();
    00091      virtual void clearArrays();
    00093      virtual bool looksOptimal() const;
    00095      virtual void maximumPivotsChanged();
    00097
    00100
    00101      inline int mode() const {
    00102           return mode_;
    00103      }
    00105
    00108      enum Persistence {
    00109           normal = 0x00, // create (if necessary) and destroy
    00110           keep = 0x01 // create (if necessary) and leave
    00111      };
    00112
    00114
    00115
    00123      AbcPrimalColumnSteepest(int mode = 3);
    00124
    00126      AbcPrimalColumnSteepest(const AbcPrimalColumnSteepest & rhs);
    00127
    00129      AbcPrimalColumnSteepest & operator=(const AbcPrimalColumnSteepest& rhs);
    00130
    00132      virtual ~AbcPrimalColumnSteepest ();
    00133
    00135      virtual AbcPrimalColumnPivot * clone(bool copyData = true) const;
    00136
    00138
    00140
    00143      inline bool reference(int i) const {
    00144           return ((reference_[i>>5] >> (i & 31)) & 1) != 0;
    00145      }
    00146      inline void setReference(int i, bool trueFalse) {
    00147           unsigned int & value = reference_[i>>5];
    00148           int bit = i & 31;
    00149           if (trueFalse)
    00150                value |= (1 << bit);
    00151           else
    00152                value &= ~(1 << bit);
    00153      }
    00155      inline void setPersistence(Persistence life) {
    00156           persistence_ = life;
    00157      }
    00158      inline Persistence persistence() const {
    00159           return persistence_ ;
    00160      }
    00161
    00163      //---------------------------------------------------------------------------
    00164
    00165 private:
    00167      // Update weight
    00168      double devex_;
    00170      double * weights_;
    00172      CoinIndexedVector * infeasible_;
    00174      CoinIndexedVector * alternateWeights_;
    00176      double * savedWeights_;
    00177      // Array for exact devex to say what is in reference framework
    00178      unsigned int * reference_;
    00184      int state_;
    00197      int mode_;
    00199      Persistence persistence_;
    00201      int numberSwitched_;
    00202      // This is pivot row (or pivot sequence round re-factorization)
    00203      int pivotSequence_;
    00204      // This is saved pivot sequence
    00205      int savedPivotSequence_;
    00206      // This is saved outgoing variable
    00207      int savedSequenceOut_;
    00208      // Iteration when last rectified
    00209      int lastRectified_;
    00210      // Size of factorization at invert (used to decide algorithm)
    00211      int sizeFactorization_;
    00213 };
    00214
    00215 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines