Cbc 2.10.8
CbcFathomDynamicProgramming.hpp
Go to the documentation of this file.
1/* $Id$ */
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//#############################################################################
29public:
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 {
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
102private:
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
133protected:
135 int size_;
139 int type_;
141 double *cost_;
143 int *back_;
157 int *rhs_;
168
169private:
172};
173
174#endif
175
176/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
177*/
FathomDynamicProgramming class.
int * lookup_
Some rows may be satisified so we need a lookup.
CbcFathomDynamicProgramming & operator=(const CbcFathomDynamicProgramming &rhs)
Illegal Assignment operator.
virtual int fathom(double *&newSolution)
returns 0 if no fathoming attempted, 1 fully fathomed , 2 incomplete search, 3 incomplete search but ...
CbcFathomDynamicProgramming(const CbcFathomDynamicProgramming &rhs)
void gutsOfDelete()
Does deleteions.
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
const double * cost() const
Returns cost array.
int size_
Size of states (power of 2 unless just one constraint)
int maximumSizeAllowed_
Maximum size allowed.
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 type_
Type - 0 coefficients and rhs all 1, 1 - coefficients > 1 or rhs > 1.
virtual CbcFathom * clone() const
Clone.
int * startBit_
Start bit for each active row.
CbcFathomDynamicProgramming(CbcModel &model)
int * numberBits_
Number bits for each active row.
int * indices_
Space for sorted indices.
const int * back() const
Returns back array.
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 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.
virtual ~CbcFathomDynamicProgramming()
int checkPossible(int allowableSize=0)
Returns type of algorithm and sets up arrays.
int * coefficients_
Space for sorted coefficients.
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.
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
int bitPattern(int numberElements, const int *rows, const double *coefficients)
Gets bit pattern from original column.
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.
void setTarget(int value)
Sets bit pattern for target result.
Fathom base class.
Definition: CbcFathom.hpp:31
Simple Branch and bound class.
Definition: CbcModel.hpp:100