Cbc  2.10.5
 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 2465 2019-01-03 19:26:52Z unxusr $ */
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  {
62  return maximumSizeAllowed_;
63  }
64  inline void setMaximumSize(int value)
65  {
66  maximumSizeAllowed_ = value;
67  }
69  int checkPossible(int allowableSize = 0);
70  // set algorithm
71  inline void setAlgorithm(int value)
72  {
73  algorithm_ = value;
74  }
78  bool tryColumn(int numberElements, const int *rows,
79  const double *coefficients, double cost,
80  int upper = COIN_INT_MAX);
82  inline const double *cost() const
83  {
84  return cost_;
85  }
87  inline const int *back() const
88  {
89  return back_;
90  }
92  inline int target() const
93  {
94  return target_;
95  }
97  inline void setTarget(int value)
98  {
99  target_ = value;
100  }
101 
102 private:
104  void gutsOfDelete();
105 
109  bool addOneColumn0(int numberElements, const int *rows,
110  double cost);
115  bool addOneColumn1(int numberElements, const int *rows,
116  const int *coefficients, double cost);
122  bool addOneColumn1A(int numberElements, const int *rows,
123  const int *coefficients, double cost);
125  int bitPattern(int numberElements, const int *rows,
126  const int *coefficients);
128  int bitPattern(int numberElements, const int *rows,
129  const double *coefficients);
131  int decodeBitPattern(int bitPattern, int *values, int numberRows);
132 
133 protected:
135  int size_;
139  int type_;
141  double *cost_;
143  int *back_;
145  int *lookup_;
147  int *indices_;
153  int *startBit_;
157  int *rhs_;
161  int target_;
168 
169 private:
172 };
173 
174 #endif
175 
176 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
177 */
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:31
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:100
int maximumSize() const
Maximum size allowed.