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

Last change on this file since 2070 was 2070, checked in by forrest, 5 years ago

for some cbc ideas

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.6 KB
Line 
1/* $Id: ClpDualRowSteepest.hpp 2070 2014-11-18 11:12:54Z forrest $ */
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
15/** Dual Row Pivot Steepest Edge Algorithm Class
16
17See Forrest-Goldfarb paper for algorithm
18
19*/
20
21class ClpDualRowSteepest : public ClpDualRowPivot {
22
23public:
24
25     ///@name Algorithmic methods
26     //@{
27
28     /// Returns pivot row, -1 if none
29     virtual int pivotRow();
30
31     /** Updates weights and returns pivot alpha.
32         Also does FT update */
33     virtual double updateWeights(CoinIndexedVector * input,
34                                  CoinIndexedVector * spare,
35                                  CoinIndexedVector * spare2,
36                                  CoinIndexedVector * updatedColumn);
37
38     /** Updates primal solution (and maybe list of candidates)
39         Uses input vector which it deletes
40         Computes change in objective function
41     */
42     virtual void updatePrimalSolution(CoinIndexedVector * input,
43                                       double theta,
44                                       double & changeInObjective);
45
46     /** Saves any weights round factorization as pivot rows may change
47         Save model
48         May also recompute infeasibility stuff
49         1) before factorization
50         2) after good factorization (if weights empty may initialize)
51         3) after something happened but no factorization
52            (e.g. check for infeasible)
53         4) as 2 but restore weights from previous snapshot
54         5) for strong branching - initialize (uninitialized) , infeasibilities
55     */
56     virtual void saveWeights(ClpSimplex * model, int mode);
57     /// Pass in saved weights
58     void passInSavedWeights(const CoinIndexedVector * saved);
59     /// Get saved weights
60     inline CoinIndexedVector * savedWeights()
61     { return savedWeights_;} 
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          return mode_;
111     }
112     /// Set mode
113     inline void setMode(int mode) {
114          mode_ = mode;
115     }
116     /// Set/ get persistence
117     inline void setPersistence(Persistence life) {
118          persistence_ = life;
119     }
120     inline Persistence persistence() const {
121          return persistence_ ;
122     }
123//@}
124
125     //---------------------------------------------------------------------------
126
127private:
128     ///@name Private member data
129     /** Status
130         0) Normal
131         -1) Needs initialization
132         1) Weights are stored by sequence number
133     */
134     int state_;
135     /** If 0 then we are using uninitialized weights, 1 then full,
136         if 2 then uninitialized partial, 3 switchable */
137     int mode_;
138     /// Life of weights
139     Persistence persistence_;
140     /// weight array
141     double * weights_;
142     /// square of infeasibility array (just for infeasible rows)
143     CoinIndexedVector * infeasible_;
144     /// alternate weight array (so we can unroll)
145     CoinIndexedVector * alternateWeights_;
146     /// save weight array (so we can use checkpoint)
147     CoinIndexedVector * savedWeights_;
148     /// Dubious weights
149     int * dubiousWeights_;
150     //@}
151};
152
153#endif
Note: See TracBrowser for help on using the repository browser.