CbcFathomDynamicProgramming.hpp
Go to the documentation of this file.
1 /* $Id: CbcFathomDynamicProgramming.hpp 1432 2010-02-07 19:33:53Z bjarni $ */
2 // Copyright (C) 2004, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 #ifndef CbcFathomDynamicProgramming_H
5 #define CbcFathomDynamicProgramming_H
6 
7 #include "CbcFathom.hpp"
8 
9 //#############################################################################
27 public:
28  // Default Constructor
30 
31  // Constructor with model - assumed before cuts
33  // Copy constructor
35 
37 
39  virtual void setModel(CbcModel * model);
40 
42  virtual CbcFathom * clone() const;
43 
45  virtual void resetModel(CbcModel * model);
46 
55  virtual int fathom(double *& newSolution);
56 
58  inline int maximumSize() const {
59  return maximumSizeAllowed_;
60  }
61  inline void setMaximumSize(int value) {
62  maximumSizeAllowed_ = value;
63  }
65  int checkPossible(int allowableSize = 0);
66  // set algorithm
67  inline void setAlgorithm(int value) {
68  algorithm_ = value;
69  }
73  bool tryColumn(int numberElements, const int * rows,
74  const double * coefficients, double cost,
75  int upper = COIN_INT_MAX);
77  inline const double * cost() const {
78  return cost_;
79  }
81  inline const int * back() const {
82  return back_;
83  }
85  inline int target() const {
86  return target_;
87  }
89  inline void setTarget(int value) {
90  target_ = value;
91  }
92 private:
94  void gutsOfDelete();
95 
99  bool addOneColumn0(int numberElements, const int * rows,
100  double cost);
105  bool addOneColumn1(int numberElements, const int * rows,
106  const int * coefficients, double cost);
112  bool addOneColumn1A(int numberElements, const int * rows,
113  const int * coefficients, double cost);
115  int bitPattern(int numberElements, const int * rows,
116  const int * coefficients);
118  int bitPattern(int numberElements, const int * rows,
119  const double * coefficients);
121  int decodeBitPattern(int bitPattern, int * values, int numberRows);
122 
123 protected:
124 
126  int size_;
130  int type_;
132  double * cost_;
134  int * back_;
136  int * lookup_;
138  int * indices_;
144  int * startBit_;
146  int * numberBits_;
148  int * rhs_;
152  int target_;
159 private:
160 
163 
164 };
165 
166 #endif
167 
int decodeBitPattern(int bitPattern, int *values, int numberRows)
Fills in original column (dense) from bit pattern - returning number nonzero.
int size_
Size of states (power of 2 unless just one constraint)
int maximumSizeAllowed_
Maximum size allowed.
virtual ~CbcFathomDynamicProgramming()
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
int target() const
Gets bit pattern for target result.
int * back_
Which state produced this cheapest one.
bool addOneColumn0(int numberElements, const int *rows, double cost)
Adds one attempt of one column of type 0, returns true if was used in making any changes.
int numberActive_
Number of active rows.
virtual int fathom(double *&newSolution)
returns 0 if no fathoming attempted, 1 fully fathomed , 2 incomplete search, 3 incomplete search but ...
int * indices_
Space for sorted indices.
int maximumSize() const
Maximum size allowed.
bool tryColumn(int numberElements, const int *rows, const double *coefficients, double cost, int upper=COIN_INT_MAX)
Tries a column returns true if was used in making any changes.
Fathom base class.
Definition: CbcFathom.hpp:30
void gutsOfDelete()
Does deleteions.
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
bool addOneColumn1(int numberElements, const int *rows, const int *coefficients, double cost)
Adds one attempt of one column of type 1, returns true if was used in making any changes.
int * numberBits_
Number bits for each active row.
CbcFathomDynamicProgramming & operator=(const CbcFathomDynamicProgramming &rhs)
Illegal Assignment operator.
int * coefficients_
Space for sorted coefficients.
FathomDynamicProgramming class.
int checkPossible(int allowableSize=0)
Returns type of algorithm and sets up arrays.
bool addOneColumn1A(int numberElements, const int *rows, const int *coefficients, double cost)
Adds one attempt of one column of type 1, returns true if was used in making any changes.
int bitPattern(int numberElements, const int *rows, const int *coefficients)
Gets bit pattern from original column.
int * startBit_
Start bit for each active row.
virtual CbcFathom * clone() const
Clone.
int type_
Type - 0 coefficients and rhs all 1, 1 - coefficients > 1 or rhs > 1.
int * lookup_
Some rows may be satisified so we need a lookup.
void setTarget(int value)
Sets bit pattern for target result.
const double * cost() const
Returns cost array.
const int * back() const
Returns back array.
Simple Branch and bound class.
Definition: CbcModel.hpp:98