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

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

Adding Clp to development branch

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