source: branches/devel-1/include/ClpPrimalColumnSteepest.hpp

Last change on this file was 29, checked in by forrest, 18 years ago

Presolve (no changes to Makefile)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1// Copyright (C) 2002, International Business Machines
2// Corporation and others.  All Rights Reserved.
3#ifndef ClpPrimalColumnSteepest_H
4#define ClpPrimalColumnSteepest_H
5
6#include "ClpPrimalColumnPivot.hpp"
7#include <bitset>
8
9//#############################################################################
10
11
12/** Primal Column Pivot Steepest Edge Algorithm Class
13
14See Forrest-Goldfarb paper for algorithm
15
16*/
17
18class CoinIndexedVector;
19
20class ClpPrimalColumnSteepest : public ClpPrimalColumnPivot {
21 
22public:
23 
24  ///@name Algorithmic methods
25  //@{
26 
27  /** Returns pivot column, -1 if none.
28      updateArray has cost updates (also use pivotRow_ from last iteration)
29  */
30  virtual int pivotColumn(CoinIndexedVector * updates,
31                          CoinIndexedVector * spareRow1,
32                          CoinIndexedVector * spareRow2,
33                          CoinIndexedVector * spareColumn1,
34                          CoinIndexedVector * spareColumn2);
35
36  /// Updates weights - part 1 - also checks accuracy
37  virtual void updateWeights(CoinIndexedVector * input);
38
39  /// Checks accuracy - just for debug
40  void checkAccuracy(int sequence,double relativeTolerance,
41                     CoinIndexedVector * rowArray1,
42                     CoinIndexedVector * rowArray2);
43
44  /// Initialize weights
45  void initializeWeights();
46
47  /// Save weights
48  virtual void saveWeights(ClpSimplex * model,int mode);
49  /// Gets rid of last update
50  virtual void unrollWeights();
51  /// Gets rid of all arrays
52  virtual void clearArrays();
53  //@}
54 
55  /**@name gets and sets */
56  //@{
57  /// Mode
58  inline int mode() const
59    { return mode_;};
60 //@}
61
62 
63  ///@name Constructors and destructors
64  //@{
65  /// Default Constructor
66  ClpPrimalColumnSteepest(int mode=0); 
67 
68  /// Copy constructor
69  ClpPrimalColumnSteepest(const ClpPrimalColumnSteepest &);
70 
71  /// Assignment operator
72  ClpPrimalColumnSteepest & operator=(const ClpPrimalColumnSteepest& rhs);
73 
74  /// Destructor
75  virtual ~ClpPrimalColumnSteepest ();
76
77  /// Clone
78  virtual ClpPrimalColumnPivot * clone(bool copyData = true) const;
79 
80  //@}
81
82  ///@name Private functions to deal with devex
83  /** reference would be faster using ClpSimplex's status_,
84      but I prefer to keep modularity.
85  */
86  inline bool reference(int i) const {
87    return (reference_[i>>5]>>(i&31))!=0;
88  }
89  inline void setReference(int i,bool trueFalse) {
90    unsigned int & value = reference_[i>>5];
91    int bit = i&31;
92    if (trueFalse)
93      value |= (1<<bit);
94    else
95      value &= ~(1<<bit);
96  }
97  //@}
98  //---------------------------------------------------------------------------
99 
100private:
101  ///@name Private member data
102  /** Status
103      0) Normal
104      -1) Needs initialization
105      1) Weights are stored by sequence number
106  */
107  int state_;
108  /// If 0 then we are using exact devex, 1 then full
109  int mode_;
110  /// weight array
111  double * weights_;
112  /// square of infeasibility array (just for infeasible columns)
113  CoinIndexedVector * infeasible_;
114  /// alternate weight array (so we can unroll)
115  CoinIndexedVector * alternateWeights_;
116  /// save weight array (so we can use checkpoint)
117  double * savedWeights_;
118  // This is pivot row (or pivot sequence round re-factorization)
119  int pivotSequence_; 
120  // This is saved pivot sequence
121  int savedPivotSequence_; 
122  // This is saved outgoing variable
123  int savedSequenceOut_; 
124  // Array for exact devex to say what is in reference framework
125  unsigned int * reference_;
126  // Update weight
127  double devex_;
128  //@}
129};
130
131#endif
Note: See TracBrowser for help on using the repository browser.