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

Last change on this file since 1525 was 1525, checked in by mjs, 10 years ago

Formatted .cpp, .hpp, .c, .h files with "astyle -A4 -p". This matches the formatting used in the grand CBC reorganization.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.3 KB
Line 
1/* $Id: ClpDualRowSteepest.hpp 1525 2010-02-26 17:27:59Z mjs $ */
2// Copyright (C) 2002, International Business Machines
3// Corporation and others.  All Rights Reserved.
4#ifndef ClpDualRowSteepest_H
5#define ClpDualRowSteepest_H
6
7#include "ClpDualRowPivot.hpp"
8class CoinIndexedVector;
9
10
11//#############################################################################
12
13/** Dual Row Pivot Steepest Edge Algorithm Class
14
15See Forrest-Goldfarb paper for algorithm
16
17*/
18
19class ClpDualRowSteepest : public ClpDualRowPivot {
20
21public:
22
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     /// Gets rid of last update
56     virtual void unrollWeights();
57     /// Gets rid of all arrays
58     virtual void clearArrays();
59     /// Returns true if would not find any row
60     virtual bool looksOptimal() const;
61     /// Called when maximum pivots changes
62     virtual void maximumPivotsChanged();
63     //@}
64
65     /** enums for persistence
66     */
67     enum Persistence {
68          normal = 0x00, // create (if necessary) and destroy
69          keep = 0x01 // create (if necessary) and leave
70     };
71
72     ///@name Constructors and destructors
73     //@{
74     /** Default Constructor
75         0 is uninitialized, 1 full, 2 is partial uninitialized,
76         3 starts as 2 but may switch to 1.
77         By partial is meant that the weights are updated as normal
78         but only part of the infeasible basic variables are scanned.
79         This can be faster on very easy problems.
80     */
81     ClpDualRowSteepest(int mode = 3);
82
83     /// Copy constructor
84     ClpDualRowSteepest(const ClpDualRowSteepest &);
85
86     /// Assignment operator
87     ClpDualRowSteepest & operator=(const ClpDualRowSteepest& rhs);
88
89     /// Fill most values
90     void fill(const ClpDualRowSteepest& rhs);
91
92     /// Destructor
93     virtual ~ClpDualRowSteepest ();
94
95     /// Clone
96     virtual ClpDualRowPivot * clone(bool copyData = true) const;
97
98     //@}
99     /**@name gets and sets */
100     //@{
101     /// Mode
102     inline int mode() const {
103          return mode_;
104     }
105     /// Set/ get persistence
106     inline void setPersistence(Persistence life) {
107          persistence_ = life;
108     }
109     inline Persistence persistence() const {
110          return persistence_ ;
111     }
112//@}
113
114     //---------------------------------------------------------------------------
115
116private:
117     ///@name Private member data
118     /** Status
119         0) Normal
120         -1) Needs initialization
121         1) Weights are stored by sequence number
122     */
123     int state_;
124     /** If 0 then we are using uninitialized weights, 1 then full,
125         if 2 then uninitialized partial, 3 switchable */
126     int mode_;
127     /// Life of weights
128     Persistence persistence_;
129     /// weight array
130     double * weights_;
131     /// square of infeasibility array (just for infeasible rows)
132     CoinIndexedVector * infeasible_;
133     /// alternate weight array (so we can unroll)
134     CoinIndexedVector * alternateWeights_;
135     /// save weight array (so we can use checkpoint)
136     CoinIndexedVector * savedWeights_;
137     /// Dubious weights
138     int * dubiousWeights_;
139     //@}
140};
141
142#endif
Note: See TracBrowser for help on using the repository browser.