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

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

Changes to make more reliable if problem size changes

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