Cbc  2.9.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CbcFathomDynamicProgramming.hpp
Go to the documentation of this file.
1 /* $Id: CbcFathomDynamicProgramming.hpp 1573 2011-01-05 01:12:36Z lou $ */
2 // Copyright (C) 2004, 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 CbcFathomDynamicProgramming_H
7 #define CbcFathomDynamicProgramming_H
8 
9 #include "CbcFathom.hpp"
10 
11 //#############################################################################
29 public:
30  // Default Constructor
32 
33  // Constructor with model - assumed before cuts
35  // Copy constructor
37 
39 
41  virtual void setModel(CbcModel * model);
42 
44  virtual CbcFathom * clone() const;
45 
47  virtual void resetModel(CbcModel * model);
48 
57  virtual int fathom(double *& newSolution);
58 
60  inline int maximumSize() const {
61  return maximumSizeAllowed_;
62  }
63  inline void setMaximumSize(int value) {
64  maximumSizeAllowed_ = value;
65  }
67  int checkPossible(int allowableSize = 0);
68  // set algorithm
69  inline void setAlgorithm(int value) {
70  algorithm_ = value;
71  }
75  bool tryColumn(int numberElements, const int * rows,
76  const double * coefficients, double cost,
77  int upper = COIN_INT_MAX);
79  inline const double * cost() const {
80  return cost_;
81  }
83  inline const int * back() const {
84  return back_;
85  }
87  inline int target() const {
88  return target_;
89  }
91  inline void setTarget(int value) {
92  target_ = value;
93  }
94 private:
96  void gutsOfDelete();
97 
101  bool addOneColumn0(int numberElements, const int * rows,
102  double cost);
107  bool addOneColumn1(int numberElements, const int * rows,
108  const int * coefficients, double cost);
114  bool addOneColumn1A(int numberElements, const int * rows,
115  const int * coefficients, double cost);
117  int bitPattern(int numberElements, const int * rows,
118  const int * coefficients);
120  int bitPattern(int numberElements, const int * rows,
121  const double * coefficients);
123  int decodeBitPattern(int bitPattern, int * values, int numberRows);
124 
125 protected:
126 
128  int size_;
132  int type_;
134  double * cost_;
136  int * back_;
138  int * lookup_;
140  int * indices_;
146  int * startBit_;
148  int * numberBits_;
150  int * rhs_;
154  int target_;
161 private:
162 
165 
166 };
167 
168 #endif
169 
int * numberBits_
Number bits for each active row.
void gutsOfDelete()
Does deleteions.
virtual ~CbcFathomDynamicProgramming()
void setTarget(int value)
Sets bit pattern for target result.
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 * startBit_
Start bit for each active row.
FathomDynamicProgramming class.
int target() const
Gets bit pattern for target result.
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 numberActive_
Number of active rows.
const double * cost() const
Returns cost array.
int type_
Type - 0 coefficients and rhs all 1, 1 - coefficients > 1 or rhs > 1.
CbcFathomDynamicProgramming & operator=(const CbcFathomDynamicProgramming &rhs)
Illegal Assignment operator.
int * indices_
Space for sorted indices.
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.
virtual int fathom(double *&newSolution)
returns 0 if no fathoming attempted, 1 fully fathomed , 2 incomplete search, 3 incomplete search but ...
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
int size_
Size of states (power of 2 unless just one constraint)
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
int maximumSizeAllowed_
Maximum size allowed.
const int COIN_INT_MAX
Definition: CoinFinite.hpp:19
int * lookup_
Some rows may be satisified so we need a lookup.
Fathom base class.
Definition: CbcFathom.hpp:32
const int * back() const
Returns back array.
int * back_
Which state produced this cheapest one.
int decodeBitPattern(int bitPattern, int *values, int numberRows)
Fills in original column (dense) from bit pattern - returning number nonzero.
int bitPattern(int numberElements, const int *rows, const int *coefficients)
Gets bit pattern from original column.
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.
virtual CbcFathom * clone() const
Clone.
int * coefficients_
Space for sorted coefficients.
int checkPossible(int allowableSize=0)
Returns type of algorithm and sets up arrays.
Simple Branch and bound class.
Definition: CbcModel.hpp:101
int maximumSize() const
Maximum size allowed.