Clp  1.16.11
AbcPrimalColumnSteepest.hpp
Go to the documentation of this file.
1 /* $Id: AbcPrimalColumnSteepest.hpp 1910 2013-01-27 02:00:13Z stefan $ */
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 AbcPrimalColumnSteepest_H
7 #define AbcPrimalColumnSteepest_H
8 
10 #include <bitset>
11 
12 //#############################################################################
13 class CoinIndexedVector;
14 
15 
24 
25 public:
26 
28 
29 
37  virtual int pivotColumn(CoinPartitionedVector * updates,
38  CoinPartitionedVector * spareRow2,
39  CoinPartitionedVector * spareColumn1);
41  void justDjs(CoinIndexedVector * updates,
42  CoinIndexedVector * spareColumn1);
44  int partialPricing(CoinIndexedVector * updates,
45  int numberWanted,
46  int numberLook);
48  void djsAndDevex(CoinIndexedVector * updates,
49  CoinIndexedVector * spareRow2,
50  CoinIndexedVector * spareColumn1);
52  void djsAndDevex2(CoinIndexedVector * updates,
53  CoinIndexedVector * spareColumn1);
55  void justDevex(CoinIndexedVector * updates,
56  CoinIndexedVector * spareColumn1);
64  int doSteepestWork(CoinPartitionedVector * updates,
65  CoinPartitionedVector * spareRow2,
66  CoinPartitionedVector * spareColumn1,
67  int type);
68 
70  virtual void updateWeights(CoinIndexedVector * input);
71 
73  void checkAccuracy(int sequence, double relativeTolerance,
74  CoinIndexedVector * rowArray1);
75 
78 
87  virtual void saveWeights(AbcSimplex * model, int mode);
89  virtual void unrollWeights();
91  virtual void clearArrays();
93  virtual bool looksOptimal() const;
95  virtual void maximumPivotsChanged();
97 
100  inline int mode() const {
102  return mode_;
103  }
105 
108  enum Persistence {
109  normal = 0x00, // create (if necessary) and destroy
110  keep = 0x01 // create (if necessary) and leave
111  };
112 
114 
115 
124 
127 
130 
133 
135  virtual AbcPrimalColumnPivot * clone(bool copyData = true) const;
136 
138 
140 
143  inline bool reference(int i) const {
144  return ((reference_[i>>5] >> (i & 31)) & 1) != 0;
145  }
146  inline void setReference(int i, bool trueFalse) {
147  unsigned int & value = reference_[i>>5];
148  int bit = i & 31;
149  if (trueFalse)
150  value |= (1 << bit);
151  else
152  value &= ~(1 << bit);
153  }
155  inline void setPersistence(Persistence life) {
156  persistence_ = life;
157  }
158  inline Persistence persistence() const {
159  return persistence_ ;
160  }
161 
163  //---------------------------------------------------------------------------
164 
165 private:
167  // Update weight
168  double devex_;
170  double * weights_;
172  CoinIndexedVector * infeasible_;
174  CoinIndexedVector * alternateWeights_;
176  double * savedWeights_;
177  // Array for exact devex to say what is in reference framework
178  unsigned int * reference_;
184  int state_;
197  int mode_;
199  Persistence persistence_;
201  int numberSwitched_;
202  // This is pivot row (or pivot sequence round re-factorization)
203  int pivotSequence_;
204  // This is saved pivot sequence
205  int savedPivotSequence_;
206  // This is saved outgoing variable
207  int savedSequenceOut_;
208  // Iteration when last rectified
209  int lastRectified_;
210  // Size of factorization at invert (used to decide algorithm)
211  int sizeFactorization_;
213 };
214 
215 #endif
AbcPrimalColumnSteepest::operator=
AbcPrimalColumnSteepest & operator=(const AbcPrimalColumnSteepest &rhs)
Assignment operator.
AbcPrimalColumnSteepest::setReference
void setReference(int i, bool trueFalse)
Definition: AbcPrimalColumnSteepest.hpp:146
AbcPrimalColumnSteepest::updateWeights
virtual void updateWeights(CoinIndexedVector *input)
Updates weights - part 1 - also checks accuracy.
AbcPrimalColumnSteepest::normal
@ normal
Definition: AbcPrimalColumnSteepest.hpp:109
AbcPrimalColumnSteepest::djsAndDevex
void djsAndDevex(CoinIndexedVector *updates, CoinIndexedVector *spareRow2, CoinIndexedVector *spareColumn1)
Update djs, weights for Devex using djs.
AbcPrimalColumnPivot.hpp
AbcPrimalColumnSteepest::Persistence
Persistence
enums for persistence
Definition: AbcPrimalColumnSteepest.hpp:108
AbcPrimalColumnSteepest::maximumPivotsChanged
virtual void maximumPivotsChanged()
Called when maximum pivots changes.
AbcPrimalColumnSteepest::saveWeights
virtual void saveWeights(AbcSimplex *model, int mode)
Save weights - this may initialize weights as well mode is - 1) before factorization 2) after factori...
AbcPrimalColumnSteepest::AbcPrimalColumnSteepest
AbcPrimalColumnSteepest(const AbcPrimalColumnSteepest &rhs)
Copy constructor.
AbcPrimalColumnSteepest::~AbcPrimalColumnSteepest
virtual ~AbcPrimalColumnSteepest()
Destructor.
AbcPrimalColumnSteepest::partialPricing
int partialPricing(CoinIndexedVector *updates, int numberWanted, int numberLook)
Update djs doing partial pricing (dantzig)
AbcPrimalColumnSteepest::persistence
Persistence persistence() const
Definition: AbcPrimalColumnSteepest.hpp:158
AbcPrimalColumnSteepest::setPersistence
void setPersistence(Persistence life)
Set/ get persistence.
Definition: AbcPrimalColumnSteepest.hpp:155
AbcPrimalColumnSteepest::justDjs
void justDjs(CoinIndexedVector *updates, CoinIndexedVector *spareColumn1)
Just update djs.
AbcPrimalColumnSteepest::djsAndDevex2
void djsAndDevex2(CoinIndexedVector *updates, CoinIndexedVector *spareColumn1)
Update djs, weights for Devex using pivot row.
AbcPrimalColumnSteepest::looksOptimal
virtual bool looksOptimal() const
Returns true if would not find any column.
AbcPrimalColumnSteepest::initializeWeights
void initializeWeights()
Initialize weights.
AbcPrimalColumnSteepest::keep
@ keep
Definition: AbcPrimalColumnSteepest.hpp:110
AbcPrimalColumnPivot::model
AbcSimplex * model()
Returns model.
Definition: AbcPrimalColumnPivot.hpp:114
AbcPrimalColumnSteepest::pivotColumn
virtual int pivotColumn(CoinPartitionedVector *updates, CoinPartitionedVector *spareRow2, CoinPartitionedVector *spareColumn1)
Returns pivot column, -1 if none.
AbcSimplex
Definition: AbcSimplex.hpp:62
AbcPrimalColumnSteepest::clearArrays
virtual void clearArrays()
Gets rid of all arrays.
AbcPrimalColumnSteepest::justDevex
void justDevex(CoinIndexedVector *updates, CoinIndexedVector *spareColumn1)
Update weights for Devex.
AbcPrimalColumnSteepest::reference
bool reference(int i) const
reference would be faster using AbcSimplex's status_, but I prefer to keep modularity.
Definition: AbcPrimalColumnSteepest.hpp:143
AbcPrimalColumnSteepest
Primal Column Pivot Steepest Edge Algorithm Class.
Definition: AbcPrimalColumnSteepest.hpp:23
AbcPrimalColumnSteepest::doSteepestWork
int doSteepestWork(CoinPartitionedVector *updates, CoinPartitionedVector *spareRow2, CoinPartitionedVector *spareColumn1, int type)
Does steepest work type - 0 - just djs 1 - just steepest 2 - both using scaleFactor 3 - both using ex...
AbcPrimalColumnSteepest::unrollWeights
virtual void unrollWeights()
Gets rid of last update.
AbcPrimalColumnPivot::type
int type()
Returns type (above 63 is extra information)
Definition: AbcPrimalColumnPivot.hpp:123
AbcPrimalColumnSteepest::clone
virtual AbcPrimalColumnPivot * clone(bool copyData=true) const
Clone.
AbcPrimalColumnSteepest::mode
int mode() const
Mode.
Definition: AbcPrimalColumnSteepest.hpp:101
AbcPrimalColumnSteepest::checkAccuracy
void checkAccuracy(int sequence, double relativeTolerance, CoinIndexedVector *rowArray1)
Checks accuracy - just for debug.
AbcPrimalColumnPivot
Primal Column Pivot Abstract Base Class.
Definition: AbcPrimalColumnPivot.hpp:26
AbcPrimalColumnSteepest::AbcPrimalColumnSteepest
AbcPrimalColumnSteepest(int mode=3)
Default Constructor 0 is exact devex, 1 full steepest, 2 is partial exact devex 3 switches between 0 ...