source: trunk/Clp/src/AbcDualRowPivot.hpp @ 1879

Last change on this file since 1879 was 1878, checked in by forrest, 7 years ago

minor changes to implement Aboca

File size: 3.7 KB
Line 
1/* $Id: AbcDualRowPivot.hpp 1732 2011-05-31 08:09:41Z forrest $ */
2// Copyright (C) 2002, International Business Machines
3// Corporation and others, Copyright (C) 2012, FasterCoin.  All Rights Reserved.
4// This code is licensed under the terms of the Eclipse Public License (EPL).
5
6#ifndef AbcDualRowPivot_H
7#define AbcDualRowPivot_H
8#include "AbcCommon.hpp"
9
10class AbcSimplex;
11class CoinIndexedVector;
12
13//#############################################################################
14
15/** Dual Row Pivot Abstract Base Class
16   
17    Abstract Base Class for describing an interface to an algorithm
18    to choose row pivot in dual simplex algorithm.  For some algorithms
19    e.g. Dantzig choice then some functions may be null.
20   
21*/
22
23class AbcDualRowPivot  {
24 
25public:
26 
27  ///@name Algorithmic methods
28  //@{
29 
30  /// Returns pivot row, -1 if none
31  virtual int pivotRow() = 0;
32 
33  /** Does most of work for weights and returns pivot alpha.
34      Also does FT update */
35  virtual double updateWeights1(CoinIndexedVector & input,CoinIndexedVector & updateColumn) = 0;
36  virtual void updateWeightsOnly(CoinIndexedVector & input) = 0;
37  virtual double updateWeights(CoinIndexedVector & input,CoinIndexedVector & updateColumn) = 0;
38  /// Actually updates weights
39  virtual void updateWeights2(CoinIndexedVector & input,CoinIndexedVector & updateColumn) = 0;
40 
41  /** Updates primal solution (and maybe list of candidates)
42      Uses input vector which it deletes
43      Would be faster if we kept basic regions, but on other hand it
44      means everything is always in sync
45  */
46  virtual void updatePrimalSolution(CoinIndexedVector & updateColumn,
47                                    double theta) = 0;
48  virtual void updatePrimalSolutionAndWeights(CoinIndexedVector & weightsVector,
49                                    CoinIndexedVector & updateColumn,
50                                              double theta);
51  /** Saves any weights round factorization as pivot rows may change
52      Will be empty unless steepest edge (will save model)
53      May also recompute infeasibility stuff
54      1) before factorization
55      2) after good factorization (if weights empty may initialize)
56      3) after something happened but no factorization
57      (e.g. check for infeasible)
58      4) as 2 but restore weights from previous snapshot
59      5) for strong branching - initialize  , infeasibilities
60  */
61  virtual void saveWeights(AbcSimplex * model, int mode);
62  /// Recompute infeasibilities
63  virtual void recomputeInfeasibilities();
64  /// checks accuracy and may re-initialize (may be empty)
65  virtual void checkAccuracy();
66  /// Gets rid of all arrays (may be empty)
67  virtual void clearArrays();
68  /// Returns true if would not find any row
69  virtual bool looksOptimal() const {
70    return false;
71  }
72  //@}
73 
74 
75  ///@name Constructors and destructors
76  //@{
77  /// Default Constructor
78  AbcDualRowPivot();
79 
80  /// Copy constructor
81  AbcDualRowPivot(const AbcDualRowPivot &);
82 
83  /// Assignment operator
84  AbcDualRowPivot & operator=(const AbcDualRowPivot& rhs);
85 
86  /// Destructor
87  virtual ~AbcDualRowPivot ();
88 
89  /// Clone
90  virtual AbcDualRowPivot * clone(bool copyData = true) const = 0;
91 
92  //@}
93 
94  ///@name Other
95  //@{
96  /// Returns model
97  inline AbcSimplex * model() {
98    return model_;
99  }
100 
101  /// Sets model (normally to NULL)
102  inline void setModel(AbcSimplex * newmodel) {
103    model_ = newmodel;
104  }
105 
106  /// Returns type (above 63 is extra information)
107  inline int type() {
108    return type_;
109  }
110 
111  //@}
112 
113  //---------------------------------------------------------------------------
114 
115protected:
116  ///@name Protected member data
117  //@{
118  /// Pointer to model
119  AbcSimplex * model_;
120  /// Type of row pivot algorithm
121  int type_;
122  //@}
123};
124#ifndef CLP_DUAL_COLUMN_MULTIPLIER
125//#define CLP_DUAL_COLUMN_MULTIPLIER 0.99999
126#endif
127#endif
Note: See TracBrowser for help on using the repository browser.