rowgraph_weighted.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program */
4 /* GCG --- Generic Column Generation */
5 /* a Dantzig-Wolfe decomposition based extension */
6 /* of the branch-cut-and-price framework */
7 /* SCIP --- Solving Constraint Integer Programs */
8 /* */
9 /* Copyright (C) 2010-2018 Operations Research, RWTH Aachen University */
10 /* Zuse Institute Berlin (ZIB) */
11 /* */
12 /* This program is free software; you can redistribute it and/or */
13 /* modify it under the terms of the GNU Lesser General Public License */
14 /* as published by the Free Software Foundation; either version 3 */
15 /* of the License, or (at your option) any later version. */
16 /* */
17 /* This program is distributed in the hope that it will be useful, */
18 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
19 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
20 /* GNU Lesser General Public License for more details. */
21 /* */
22 /* You should have received a copy of the GNU Lesser General Public License */
23 /* along with this program; if not, write to the Free Software */
24 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.*/
25 /* */
26 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 
36 #ifndef GCG_ROWGRAPH_WEIGHTED_H_
37 #define GCG_ROWGRAPH_WEIGHTED_H_
38 
39 #include "graph.h"
40 #include "rowgraph.h"
41 
42 namespace gcg {
43 
45 {
46  JOHNSON = 1,
48  JACCARD = 5,
49  COSINE = 6,
50  SIMPSON = 9,
51 };
53 
55 {
56  SIM = 0,
57  DIST = 1
58 };
59 typedef enum WeightType WEIGHT_TYPE;
60 
61 
62 template <class T>
64 {
65 private:
66  int n_blocks;
67  int non_cl;
68 
72  virtual SCIP_RETCODE postProcess(std::vector<int>& labels, bool enabled);
73 
74  virtual SCIP_RETCODE postProcessForPartialGraph(gcg::Seeedpool* seeedpool, gcg::Seeed* seeed, std::vector<int>& labels, bool enabled);
75 
80  virtual SCIP_RETCODE postProcessStableSet(std::vector<int>& labels, bool enabled);
81 
82  virtual SCIP_RETCODE postProcessStableSetForPartialGraph(gcg::Seeedpool* seeedpool, gcg::Seeed* seeed, std::vector<int>& labels, bool enabled);
83 
84 public:
86  SCIP* scip,
87  Weights w
88  );
89  virtual ~RowGraphWeighted();
90 
91  // we need this to avoid the warning of hidding the parent function
93 
94  virtual SCIP_RETCODE createFromMatrix(
95  SCIP_CONS** conss,
96  SCIP_VAR** vars,
97  int nconss_,
98  int nvars_,
99  DISTANCE_MEASURE dist,
100  WEIGHT_TYPE w_type
101  );
102 
103  // we need this to avoid the warning of hidding the parent function
105 
107  virtual SCIP_RETCODE createFromPartialMatrix(
108  Seeedpool* seeedpool,
109  Seeed* seeed,
110  DISTANCE_MEASURE dist,
111  WEIGHT_TYPE w_type
112  );
113 
114  static double calculateSimilarity(
115  int a,
116  int b,
117  int c,
118  DISTANCE_MEASURE dist,
119  WEIGHT_TYPE w_type,
120  bool itself
121  );
122 
124  virtual SCIP_RETCODE computePartitionDBSCAN(double eps, bool postprocenable);
125 
127  virtual SCIP_RETCODE computePartitionDBSCANForPartialGraph(gcg::Seeedpool* seeedpool, gcg::Seeed* seeed, double eps, bool postprocenable);
128 
130  virtual SCIP_RETCODE computePartitionMST(double eps, bool postprocenable);
131 
133  virtual SCIP_RETCODE computePartitionMSTForPartialGraph(gcg::Seeedpool* seeedpool, gcg::Seeed* seeed, double eps, bool postprocenable);
134 
136  virtual SCIP_RETCODE computePartitionMCL(int& stoppedAfter, double inflatefactor, bool postprocenable);
137 
139  virtual SCIP_RETCODE computePartitionMCLForPartialGraph(gcg::Seeedpool* seeedpool, gcg::Seeed* seeed, int& stoppedAfter, double inflatefactor, bool postprocenable);
140 
142  virtual SCIP_RETCODE getNBlocks(int& _n_blocks);
143 
144  virtual SCIP_RETCODE nonClustered(int& _non_cl);
145 
146  virtual double getEdgeWeightPercentile(double q);
147 
148 
149 };
150 
151 } /* namespace gcg */
152 #endif /* GCG_ROWGRAPH_WEIGHTED_H_ */
virtual SCIP_RETCODE createFromMatrix(SCIP_CONS **conss, SCIP_VAR **vars, int nconss_, int nvars_, DISTANCE_MEASURE dist, WEIGHT_TYPE w_type)
virtual SCIP_RETCODE computePartitionMCL(int &stoppedAfter, double inflatefactor, bool postprocenable)
virtual SCIP_RETCODE getNBlocks(int &_n_blocks)
virtual SCIP_RETCODE nonClustered(int &_non_cl)
RowGraphWeighted(SCIP *scip, Weights w)
enum DistanceMeasure DISTANCE_MEASURE
virtual SCIP_RETCODE computePartitionMCLForPartialGraph(gcg::Seeedpool *seeedpool, gcg::Seeed *seeed, int &stoppedAfter, double inflatefactor, bool postprocenable)
A row graph where each row is a node and rows are adjacent if they share a variable.
class to manage partial decompositions (aka seeed), each seeed corresponds to one seeedpool which con...
Definition: class_seeed.h:71
virtual SCIP_RETCODE computePartitionMST(double eps, bool postprocenable)
virtual SCIP_RETCODE computePartitionMSTForPartialGraph(gcg::Seeedpool *seeedpool, gcg::Seeed *seeed, double eps, bool postprocenable)
virtual SCIP_RETCODE createFromPartialMatrix(Seeedpool *seeedpool, Seeed *seeed, DISTANCE_MEASURE dist, WEIGHT_TYPE w_type)
miscellaneous graph methods for structure detection
virtual SCIP_RETCODE computePartitionDBSCAN(double eps, bool postprocenable)
static double calculateSimilarity(int a, int b, int c, DISTANCE_MEASURE dist, WEIGHT_TYPE w_type, bool itself)
virtual double getEdgeWeightPercentile(double q)
virtual SCIP_RETCODE computePartitionDBSCANForPartialGraph(gcg::Seeedpool *seeedpool, gcg::Seeed *seeed, double eps, bool postprocenable)
enum WeightType WEIGHT_TYPE