Cgl 0.60.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CglClique.hpp
Go to the documentation of this file.
1 // $Id: CglClique.hpp 1331 2016-01-26 19:37:05Z forrest $
2 // Copyright (C) 2000, 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 _CglClique_h_
7 #define _CglClique_h_
8
9 #include "CglCutGenerator.hpp"
10
11 //class OsiCuts;
12 //class OsiSolverInterface;
13
14 class CglClique : public CglCutGenerator {
15
16 friend void CglCliqueUnitTest(const OsiSolverInterface * siP,
17 const std::string mpdDir );
18 public:
20 CglClique(const CglClique& rhs);
22 virtual CglCutGenerator * clone() const;
23
25 CglClique& operator=(const CglClique& rhs);
26
27 public:
28
29 virtual void
30 generateCuts(const OsiSolverInterface& si, OsiCuts & cs,
31 const CglTreeInfo info = CglTreeInfo());
32
53 CglClique(bool setPacking = false, bool justOriginalRows = false);
55 virtual ~CglClique() {}
57 virtual std::string generateCpp( FILE * fp);
58
59 void considerRows(const int numRows, const int* rowInd);
60
61 public:
64 enum scl_next_node_method {
65 SCL_MIN_DEGREE,
66 SCL_MAX_DEGREE,
67 SCL_MAX_XJ_MAX_DEG
68 };
69
70 void setStarCliqueNextNodeMethod(scl_next_node_method method) {
71 scl_next_node_rule = method;
72 }
73
74 void setStarCliqueCandidateLengthThreshold(int maxlen) {
75 scl_candidate_length_threshold = maxlen;
76 }
77 void setRowCliqueCandidateLengthThreshold(int maxlen) {
78 rcl_candidate_length_threshold = maxlen;
79 }
80
81 void setStarCliqueReport(bool yesno = true) { scl_report_result = yesno; }
82 void setRowCliqueReport(bool yesno = true) { rcl_report_result = yesno; }
83
84 void setDoStarClique(bool yesno = true) { do_star_clique = yesno; }
85 void setDoRowClique(bool yesno = true) { do_row_clique = yesno; }
86
87 void setMinViolation(double minviol) { petol = minviol; }
88 double getMinViolation() const { return petol; }
90 inline void setMaxNumber(int value) { maxNumber_ = value; }
91
92 private:
93
94 struct frac_graph ;
95 friend struct frac_graph ;
96
99 struct fnode {
101 int *nbrs;
104 double *edgecosts;
106 int degree;
108 double val;
109 };
110
113 struct frac_graph {
115 int nodenum;
117 int edgenum;
119 double density;
120 int min_deg_node;
121 int min_degree;
122 int max_deg_node;
123 int max_degree;
125 fnode *nodes;
128 int *all_nbr;
130 double *all_edgecost;
131
132 frac_graph() :
133 nodenum(0), edgenum(0), density(0),
134 min_deg_node(0), min_degree(0), max_deg_node(0), max_degree(0),
135 nodes(0), all_nbr(0), all_edgecost(0) {}
136 };
137
138 protected:
141 bool setPacking_;
143 bool justOriginalRows_;
145 int sp_numrows;
146 int* sp_orig_row_ind;
147 int sp_numcols;
148 int* sp_orig_col_ind;
149 double* sp_colsol;
150 int* sp_col_start;
151 int* sp_col_ind;
152 int* sp_row_start;
153 int* sp_row_ind;
154
156 frac_graph fgraph;
158 bool* node_node;
159
161 double petol;
163 int maxNumber_;
164
170 bool do_row_clique;
172 bool do_star_clique;
173
175 scl_next_node_method scl_next_node_rule;
180 int scl_candidate_length_threshold;
182 bool scl_report_result;
183
188 int rcl_candidate_length_threshold;
190 bool rcl_report_result;
198 const int* cl_perm_indices;
200 int cl_perm_length;
201
204 int* cl_indices;
206 int cl_length;
207
211 int* cl_del_indices;
213 int cl_del_length;
214
217 private:
220 void selectFractionalBinaries(const OsiSolverInterface& si);
223 void selectFractionals(const OsiSolverInterface& si);
225 void selectRowCliques(const OsiSolverInterface& si,int numOriginalRows);
227 void createSetPackingSubMatrix(const OsiSolverInterface& si);
229 void createFractionalGraph();
231 int createNodeNode();
233 void deleteSetPackingSubMatrix();
235 void deleteFractionalGraph();
237 void find_scl(OsiCuts& cs);
239 void find_rcl(OsiCuts& cs);
241 int scl_choose_next_node(const int current_nodenum,
242 const int *current_indices,
243 const int *current_degrees,
244 const double *current_values);
246 void scl_delete_node(const int del_ind, int& current_nodenum,
247 int *current_indices, int *current_degrees,
248 double *current_values);
250 int enumerate_maximal_cliques(int& pos, bool* scl_label, OsiCuts& cs);
252 int greedy_maximal_clique(OsiCuts& cs);
254 void recordClique(const int len, int* indices, OsiCuts& cs);
255 };
256 //#############################################################################
262 void CglCliqueUnitTest(const OsiSolverInterface * siP,
263 const std::string mpdDir);
265 class CglProbing;
266 class CglFakeClique : public CglClique {
267
268 public:
270 CglFakeClique(const CglFakeClique& rhs);
272 virtual CglCutGenerator * clone() const;
273
275 CglFakeClique& operator=(const CglFakeClique& rhs);
276
277 virtual void
278 generateCuts(const OsiSolverInterface& si, OsiCuts & cs,
279 const CglTreeInfo info = CglTreeInfo());
280
300 CglFakeClique(OsiSolverInterface * solver=NULL,bool setPacking = false);
302 virtual ~CglFakeClique();
304 void assignSolver(OsiSolverInterface * fakeSolver);
305 protected:
307 OsiSolverInterface * fakeSolver_;
309 CglProbing * probing_;
310 };
311
312 #endif
CglClique::frac_graph::frac_graph
frac_graph()
Definition: CglClique.hpp:132
CglClique::createNodeNode
int createNodeNode()
CglClique::frac_graph::edgenum
int edgenum
of edges in the graph
Definition: CglClique.hpp:117
CglClique::SCL_MIN_DEGREE
Definition: CglClique.hpp:65
CglClique::selectFractionals
void selectFractionals(const OsiSolverInterface &si)
Scan through the variables and select those that are at a fractional level.
CglClique::frac_graph::max_degree
int max_degree
Definition: CglClique.hpp:123
CglClique::scl_delete_node
void scl_delete_node(const int del_ind, int &current_nodenum, int *current_indices, int *current_degrees, double *current_values)
CglClique::selectRowCliques
void selectRowCliques(const OsiSolverInterface &si, int numOriginalRows)
CglClique::frac_graph::min_deg_node
int min_deg_node
Definition: CglClique.hpp:120
CglClique::sp_orig_col_ind
int * sp_orig_col_ind
Definition: CglClique.hpp:148
CglClique::sp_numcols
int sp_numcols
Definition: CglClique.hpp:147
CglFakeClique::fakeSolver_
OsiSolverInterface * fakeSolver_
fake solver to use
Definition: CglClique.hpp:307
CglClique::frac_graph::min_degree
int min_degree
Definition: CglClique.hpp:121
CglClique::SCL_MAX_DEGREE
Definition: CglClique.hpp:66
CglClique::frac_graph::all_edgecost
double * all_edgecost
The array of the costs of the edges going to the neighbors.
Definition: CglClique.hpp:130
CglClique::fnode::degree
int degree
degree of the node
Definition: CglClique.hpp:106
CglClique::fnode::val
double val
the fractional value of the variable corresponding to this node
Definition: CglClique.hpp:108
CglCutGenerator.hpp
CglClique::cl_del_indices
int * cl_del_indices
An array of nodes discarded from the candidate list.
Definition: CglClique.hpp:211
CglTreeInfo
Information about where the cut generator is invoked from.
Definition: CglTreeInfo.hpp:15
CglClique::greedy_maximal_clique
int greedy_maximal_clique(OsiCuts &cs)
CglClique::generateCuts
virtual void generateCuts(const OsiSolverInterface &si, OsiCuts &cs, const CglTreeInfo info=CglTreeInfo())
Generate cuts for the model data contained in si.
CglClique::getMinViolation
double getMinViolation() const
Definition: CglClique.hpp:88
CglClique::rcl_report_result
bool rcl_report_result
whether to give a detailed statistics on the row clique method
Definition: CglClique.hpp:190
OsiCuts
Collections of row cuts and column cuts.
Definition: OsiCuts.hpp:19
CglClique::deleteFractionalGraph
void deleteFractionalGraph()
CglClique::frac_graph::nodenum
int nodenum
of nodes = # of fractional values in the LP solution
Definition: CglClique.hpp:115
CglClique::sp_row_ind
int * sp_row_ind
Definition: CglClique.hpp:153
CglFakeClique
Definition: CglClique.hpp:266
CglClique::cl_length
int cl_length
The length of cl_indices.
Definition: CglClique.hpp:206
CglClique::setStarCliqueNextNodeMethod
void setStarCliqueNextNodeMethod(scl_next_node_method method)
Definition: CglClique.hpp:70
CglClique::SCL_MAX_XJ_MAX_DEG
Definition: CglClique.hpp:67
CglClique::frac_graph::max_deg_node
int max_deg_node
Definition: CglClique.hpp:122
CglClique::find_scl
void find_scl(OsiCuts &cs)
CglClique::generateCpp
virtual std::string generateCpp(FILE *fp)
Create C++ lines to get to current state.
CglClique::sp_col_ind
int * sp_col_ind
Definition: CglClique.hpp:151
OsiSolverInterface
Abstract Base Class for describing an interface to a solver.
Definition: OsiSolverInterface.hpp:61
CglClique
Definition: CglClique.hpp:14
CglClique::deleteSetPackingSubMatrix
void deleteSetPackingSubMatrix()
CglFakeClique::probing_
CglProbing * probing_
Probing object.
Definition: CglClique.hpp:309
CglClique::maxNumber_
int maxNumber_
Maximum number of binaries for looking at all.
Definition: CglClique.hpp:163
CglClique::setStarCliqueCandidateLengthThreshold
void setStarCliqueCandidateLengthThreshold(int maxlen)
Definition: CglClique.hpp:74
CglClique::cl_perm_length
int cl_perm_length
The length of cl_perm_indices.
Definition: CglClique.hpp:200
CglClique::setMaxNumber
void setMaxNumber(int value)
Maximum number of binaries for looking at all.
Definition: CglClique.hpp:90
CglClique::cl_indices
int * cl_indices
List of indices that should be considered for extending the ones listed in cl_perm_indices.
Definition: CglClique.hpp:204
CglClique::cl_perm_indices
const int * cl_perm_indices
variables/arrays that are used across many methods
Definition: CglClique.hpp:198
CglCutGenerator
Cut Generator Base Class.
Definition: CglCutGenerator.hpp:23
CglClique::frac_graph
A graph corresponding to a fractional solution of an LP.
Definition: CglClique.hpp:113
CglFakeClique::operator=
CglFakeClique & operator=(const CglFakeClique &rhs)
Assignment operator.
CglFakeClique::CglFakeClique
CglFakeClique(const CglFakeClique &rhs)
Copy constructor.
CglCliqueUnitTest
void CglCliqueUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglClique class.
CglClique::scl_next_node_method
scl_next_node_method
possible choices for selecting the next node in the star clique search
Definition: CglClique.hpp:64
CglClique::recordClique
void recordClique(const int len, int *indices, OsiCuts &cs)
CglClique::setRowCliqueReport
void setRowCliqueReport(bool yesno=true)
Definition: CglClique.hpp:82
CglClique::sp_numrows
int sp_numrows
pieces of the set packing part of the solverinterface
Definition: CglClique.hpp:145
CglClique::scl_report_result
bool scl_report_result
whether to give a detailed statistics on the star clique method
Definition: CglClique.hpp:182
CglClique::frac_graph::density
double density
density= edgenum/(nodenum choose 2)
Definition: CglClique.hpp:119
CglClique::~CglClique
virtual ~CglClique()
Destructor.
Definition: CglClique.hpp:55
CglClique::fnode::edgecosts
double * edgecosts
1-x_i-x_j, needed for odd holes, in the same order as the adj list, pointer into all_edgecost ...
Definition: CglClique.hpp:104
CglClique::sp_row_start
int * sp_row_start
Definition: CglClique.hpp:152
CglFakeClique::generateCuts
virtual void generateCuts(const OsiSolverInterface &si, OsiCuts &cs, const CglTreeInfo info=CglTreeInfo())
Generate cuts for the model data contained in si.
CglClique::fnode::nbrs
int * nbrs
pointer into all_nbr
Definition: CglClique.hpp:101
CglClique::frac_graph::all_nbr
int * all_nbr
The array of all the neighbors.
Definition: CglClique.hpp:128
CglClique::do_star_clique
bool do_star_clique
whether to do the star clique algorithm or not.
Definition: CglClique.hpp:172
CglClique::clone
virtual CglCutGenerator * clone() const
Clone.
CglClique::CglClique
CglClique(const CglClique &rhs)
Copy constructor.
CglClique::setStarCliqueReport
void setStarCliqueReport(bool yesno=true)
Definition: CglClique.hpp:81
CglClique::CglCliqueUnitTest
friend void CglCliqueUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglClique class.
CglClique::cl_del_length
int cl_del_length
The length of cl_del_indices.
Definition: CglClique.hpp:213
CglClique::scl_next_node_rule
scl_next_node_method scl_next_node_rule
How the next node to be added to the star clique should be selected.
Definition: CglClique.hpp:175
CglClique::fgraph
frac_graph fgraph
the intersection graph corresponding to the set packing problem
Definition: CglClique.hpp:156
CglClique::fnode
A node of the fractional graph.
Definition: CglClique.hpp:99
CglClique::selectFractionalBinaries
void selectFractionalBinaries(const OsiSolverInterface &si)
Scan through the variables and select those that are binary and are at a fractional level...
CglClique::setDoRowClique
void setDoRowClique(bool yesno=true)
Definition: CglClique.hpp:85
CglClique::do_row_clique
bool do_row_clique
data for the star clique algorithm
Definition: CglClique.hpp:170
CglClique::createSetPackingSubMatrix
void createSetPackingSubMatrix(const OsiSolverInterface &si)
CglClique::operator=
CglClique & operator=(const CglClique &rhs)
Assignment operator.
CglClique::sp_col_start
int * sp_col_start
Definition: CglClique.hpp:150
CglClique::find_rcl
void find_rcl(OsiCuts &cs)
CglClique::setDoStarClique
void setDoStarClique(bool yesno=true)
Definition: CglClique.hpp:84
CglClique::sp_orig_row_ind
int * sp_orig_row_ind
Definition: CglClique.hpp:146
CglClique::setRowCliqueCandidateLengthThreshold
void setRowCliqueCandidateLengthThreshold(int maxlen)
Definition: CglClique.hpp:77
CglClique::setMinViolation
void setMinViolation(double minviol)
Definition: CglClique.hpp:87
CglFakeClique::clone
virtual CglCutGenerator * clone() const
Clone.
CglClique::sp_colsol
double * sp_colsol
Definition: CglClique.hpp:149
CglClique::frac_graph::nodes
fnode * nodes
The array of the nodes in the graph.
Definition: CglClique.hpp:125
CglClique::node_node
bool * node_node
the node-node incidence matrix of the intersection graph.
Definition: CglClique.hpp:158
CglClique::createFractionalGraph
void createFractionalGraph()
CglClique::rcl_candidate_length_threshold
int rcl_candidate_length_threshold
In the row clique method the maximal length of the candidate list (those nodes that can extend the ro...
Definition: CglClique.hpp:188
CglClique::petol
double petol
The primal tolerance in the solverinterface.
Definition: CglClique.hpp:161
CglClique::setPacking_
bool setPacking_
An indicator showing whether the whole matrix in the solverinterface is a set packing problem or not...
Definition: CglClique.hpp:141
CglClique::considerRows
void considerRows(const int numRows, const int *rowInd)
CglFakeClique::~CglFakeClique
virtual ~CglFakeClique()
Destructor.
CglClique::enumerate_maximal_cliques
int enumerate_maximal_cliques(int &pos, bool *scl_label, OsiCuts &cs)
CglClique::scl_candidate_length_threshold
int scl_candidate_length_threshold
In the star clique method the maximal length of the candidate list (those nodes that are in a star...
Definition: CglClique.hpp:180
CglFakeClique::assignSolver
void assignSolver(OsiSolverInterface *fakeSolver)
Assign solver (generator takes over ownership)
CglClique::scl_choose_next_node
int scl_choose_next_node(const int current_nodenum, const int *current_indices, const int *current_degrees, const double *current_values)
CglProbing
Probing Cut Generator Class.
Definition: CglProbing.hpp:25
CglClique::justOriginalRows_
bool justOriginalRows_
True if just look at original rows.
Definition: CglClique.hpp:143