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

Last change on this file since 2030 was 1665, checked in by lou, 9 years ago

Add EPL license notice in src.

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