source: stable/1.11/Clp/src/ClpPrimalColumnPivot.hpp @ 1461

Last change on this file since 1461 was 1461, checked in by stefan, 11 years ago

fix compiler warnings declaration of XXX shadows a member of YYY; remove unnecessary include to avoid warnings from CoinFactorization?

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
1/* $Id: ClpPrimalColumnPivot.hpp 1461 2009-11-06 19:06:43Z stefan $ */
2// Copyright (C) 2002, International Business Machines
3// Corporation and others.  All Rights Reserved.
4#ifndef ClpPrimalcolumnPivot_H
5#define ClpPrimalcolumnPivot_H
6
7class ClpSimplex;
8class CoinIndexedVector;
9
10//#############################################################################
11
12/** Primal Column Pivot Abstract Base Class
13
14Abstract Base Class for describing an interface to an algorithm
15to choose column pivot in primal simplex algorithm.  For some algorithms
16e.g. Dantzig choice then some functions may be null.  For Dantzig
17the only one of any importance is pivotColumn.
18
19If  you wish to inherit from this look at ClpPrimalColumnDantzig.cpp
20as that is simplest version.
21*/
22
23class ClpPrimalColumnPivot  {
24 
25public:
26 
27  ///@name Algorithmic methods
28  //@{
29 
30  /** Returns pivot column, -1 if none
31
32      Normally updates reduced costs using result of last iteration
33      before selecting incoming column.
34
35      The Packed CoinIndexedVector updates has cost updates - for normal LP
36      that is just +-weight where a feasibility changed.  It also has
37      reduced cost from last iteration in pivot row
38
39      Inside pivotColumn the pivotRow_ and reduced cost from last iteration
40      are also used.
41
42      So in the simplest case i.e. feasible we compute the row of the
43      tableau corresponding to last pivot and add a multiple of this
44      to current reduced costs.
45
46      We can use other arrays to help updates
47  */
48  virtual int pivotColumn(CoinIndexedVector * updates,
49                          CoinIndexedVector * spareRow1,
50                          CoinIndexedVector * spareRow2,
51                          CoinIndexedVector * spareColumn1,
52                          CoinIndexedVector * spareColumn2) = 0;
53 
54  /// Updates weights - part 1 (may be empty)
55  virtual void updateWeights(CoinIndexedVector * input);
56 
57  /** Saves any weights round factorization as pivot rows may change
58      Will be empty unless steepest edge (will save model)
59      May also recompute infeasibility stuff
60      1) before factorization
61      2) after good factorization (if weights empty may initialize)
62      3) after something happened but no factorization
63         (e.g. check for infeasible)
64      4) as 2 but restore weights from previous snapshot
65      5) forces some initialization e.g. weights
66      Also sets model
67  */
68  virtual void saveWeights(ClpSimplex * model,int mode)=0;
69  /** Signals pivot row choice:
70      -2 (default) - use normal pivot row choice
71      -1 to numberRows-1 - use this (will be checked)
72      way should be -1 to go to lower bound, +1 to upper bound
73  */
74  virtual int pivotRow(double & way)
75  {way=0;return -2;}
76  /// Gets rid of all arrays (may be empty)
77  virtual void clearArrays();
78  /// Returns true if would not find any column
79  virtual bool looksOptimal() const
80  { return looksOptimal_;}
81  /// Sets optimality flag (for advanced use)
82  virtual void setLooksOptimal(bool flag)
83  { looksOptimal_ = flag;}
84  //@}
85 
86 
87  ///@name Constructors and destructors
88  //@{
89  /// Default Constructor
90  ClpPrimalColumnPivot(); 
91 
92  /// Copy constructor
93  ClpPrimalColumnPivot(const ClpPrimalColumnPivot &);
94 
95  /// Assignment operator
96  ClpPrimalColumnPivot & operator=(const ClpPrimalColumnPivot& rhs);
97 
98  /// Destructor
99  virtual ~ClpPrimalColumnPivot ();
100
101  /// Clone
102  virtual ClpPrimalColumnPivot * clone(bool copyData = true) const = 0;
103
104  //@}
105
106  ///@name Other
107  //@{
108  /// Returns model
109  inline ClpSimplex * model()
110  { return model_;}
111  /// Sets model
112  inline void setModel(ClpSimplex * newmodel)
113  { model_=newmodel;}
114 
115  /// Returns type (above 63 is extra information)
116  inline int type()
117  { return type_;}
118
119  /** Returns number of extra columns for sprint algorithm - 0 means off.
120      Also number of iterations before recompute
121  */
122  virtual int numberSprintColumns(int & numberIterations) const;
123  /// Switch off sprint idea
124  virtual void switchOffSprint();
125  /// Called when maximum pivots changes
126  virtual void maximumPivotsChanged() {}
127 
128  //@}
129
130  //---------------------------------------------------------------------------
131 
132protected:
133  ///@name Protected member data
134  //@{
135  /// Pointer to model
136  ClpSimplex * model_;
137  /// Type of column pivot algorithm
138  int type_;
139  /// Says if looks optimal (normally computed)
140  bool looksOptimal_;
141  //@}
142};
143
144#endif
Note: See TracBrowser for help on using the repository browser.