source: trunk/Clp/src/ClpDualRowSteepest.hpp @ 2470

Last change on this file since 2470 was 2385, checked in by unxusr, 10 months ago

formatting

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.3 KB
Line 
1/* $Id: ClpDualRowSteepest.hpp 2385 2019-01-06 19:43:06Z stefan $ */
2// Copyright (C) 2002, International Business Machines
3// Corporation and others.  All Rights Reserved.
4// This code is licensed under the terms of the Eclipse Public License (EPL).
5
6#ifndef ClpDualRowSteepest_H
7#define ClpDualRowSteepest_H
8
9#include "ClpDualRowPivot.hpp"
10class CoinIndexedVector;
11
12//#############################################################################
13
14/** Dual Row Pivot Steepest Edge Algorithm Class
15
16See Forrest-Goldfarb paper for algorithm
17
18*/
19
20class ClpDualRowSteepest : public ClpDualRowPivot {
21
22public:
23  ///@name Algorithmic methods
24  //@{
25
26  /// Returns pivot row, -1 if none
27  virtual int pivotRow();
28
29  /** Updates weights and returns pivot alpha.
30         Also does FT update */
31  virtual double updateWeights(CoinIndexedVector *input,
32    CoinIndexedVector *spare,
33    CoinIndexedVector *spare2,
34    CoinIndexedVector *updatedColumn);
35
36  /** Updates primal solution (and maybe list of candidates)
37         Uses input vector which it deletes
38         Computes change in objective function
39     */
40  virtual void updatePrimalSolution(CoinIndexedVector *input,
41    double theta,
42    double &changeInObjective);
43
44  /** Saves any weights round factorization as pivot rows may change
45         Save model
46         May also recompute infeasibility stuff
47         1) before factorization
48         2) after good factorization (if weights empty may initialize)
49         3) after something happened but no factorization
50            (e.g. check for infeasible)
51         4) as 2 but restore weights from previous snapshot
52         5) for strong branching - initialize (uninitialized) , infeasibilities
53     */
54  virtual void saveWeights(ClpSimplex *model, int mode);
55  /// Pass in saved weights
56  void passInSavedWeights(const CoinIndexedVector *saved);
57  /// Get saved weights
58  inline CoinIndexedVector *savedWeights()
59  {
60    return savedWeights_;
61  }
62  /// Gets rid of last update
63  virtual void unrollWeights();
64  /// Gets rid of all arrays
65  virtual void clearArrays();
66  /// Returns true if would not find any row
67  virtual bool looksOptimal() const;
68  /// Called when maximum pivots changes
69  virtual void maximumPivotsChanged();
70  //@}
71
72  /** enums for persistence
73     */
74  enum Persistence {
75    normal = 0x00, // create (if necessary) and destroy
76    keep = 0x01 // create (if necessary) and leave
77  };
78
79  ///@name Constructors and destructors
80  //@{
81  /** Default Constructor
82         0 is uninitialized, 1 full, 2 is partial uninitialized,
83         3 starts as 2 but may switch to 1.
84         By partial is meant that the weights are updated as normal
85         but only part of the infeasible basic variables are scanned.
86         This can be faster on very easy problems.
87     */
88  ClpDualRowSteepest(int mode = 3);
89
90  /// Copy constructor
91  ClpDualRowSteepest(const ClpDualRowSteepest &);
92
93  /// Assignment operator
94  ClpDualRowSteepest &operator=(const ClpDualRowSteepest &rhs);
95
96  /// Fill most values
97  void fill(const ClpDualRowSteepest &rhs);
98
99  /// Destructor
100  virtual ~ClpDualRowSteepest();
101
102  /// Clone
103  virtual ClpDualRowPivot *clone(bool copyData = true) const;
104
105  //@}
106  /**@name gets and sets */
107  //@{
108  /// Mode
109  inline int mode() const
110  {
111    return mode_;
112  }
113  /// Set mode
114  inline void setMode(int mode)
115  {
116    mode_ = mode;
117  }
118  /// Set/ get persistence
119  inline void setPersistence(Persistence life)
120  {
121    persistence_ = life;
122  }
123  inline Persistence persistence() const
124  {
125    return persistence_;
126  }
127  //@}
128
129  //---------------------------------------------------------------------------
130
131protected:
132  ///@name Protected member data
133  /** Status
134         0) Normal
135         -1) Needs initialization
136         1) Weights are stored by sequence number
137     */
138  int state_;
139  /** If 0 then we are using uninitialized weights, 1 then full,
140         if 2 then uninitialized partial, 3 switchable */
141  int mode_;
142  /// Life of weights
143  Persistence persistence_;
144  /// weight array
145  double *weights_;
146  /// square of infeasibility array (just for infeasible rows)
147  CoinIndexedVector *infeasible_;
148  /// alternate weight array (so we can unroll)
149  CoinIndexedVector *alternateWeights_;
150  /// save weight array (so we can use checkpoint)
151  CoinIndexedVector *savedWeights_;
152  /// Dubious weights
153  int *dubiousWeights_;
154  //@}
155};
156
157#endif
158
159/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
160*/
Note: See TracBrowser for help on using the repository browser.