class_indexclassifier.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_CLASS_INDEXCLASSIFIER_H__
37 #define GCG_CLASS_INDEXCLASSIFIER_H__
38 
39 #include "objscip/objscip.h"
40 #include <vector>
41 #include <string>
42 
43 namespace gcg
44 {
45 
47 {
48 
49 protected:
50  SCIP* scip;
52 private:
53  std::string name;
54  int nClasses;
55  int nIndices;
56  std::vector<int> indicesToClasses;
57  std::vector<std::string> classNames;
58  std::vector<std::string> classDescriptions;
59  std::vector<int> classDecompInfo;
62 protected:
63 
66  SCIP* scip,
67  const char* name,
68  int nClasses,
69  int nIndices
70  );
71 
74  const IndexClassifier* toCopy
75  );
76 
77 
79  virtual ~IndexClassifier();
80 
82  int addClass(
83  const char* name,
84  const char* desc
85  );
86 
88  void assignIndexToClass(
89  int index,
90  int classindex
91  );
92 
94  std::vector<std::vector<int>> getAllSubsets(
95  std::vector<int>& classindices
96  );
97 
100  int classindex
101  );
102 
104  const char* getClassNameOfIndex(
105  int index
106  );
107 
109  int getClassOfIndex(
110  int index
111  );
112 
114  std::vector<int> getIndicesToClasses(
115  );
116 
118  int getNIndices(
119  );
120 
122  std::vector<int> getNIndicesOfClasses(
123  );
124 
126  bool isIndexClassified(
127  int index
128  );
129 
131  void setClassDecompInfo(
132  int classindex,
133  int decompInfo
134  );
135 
136 
137 public:
138 
142  IndexClassifier* otherClassifier
143  );
144 
146  const char* getClassDescription(
147  int classindex
148  );
149 
151  const char* getClassName(
152  int classindex
153  );
154 
156  const char* getName(
157  );
158 
159 
161  int getNClasses(
162  );
163 
168  std::vector<int> reduceClasses(
169  int maxNumberOfClasses
170  );
171 
174  int removeEmptyClasses(
175  );
176 
178  void setClassDescription(
179  int classindex,
180  const char* desc
181  );
182 
184  void setClassName(
185  int classindex,
186  const char* name
187  );
188 
189 };
190 
191 
192 } /* namespace gcg */
193 #endif /* SRC_CLASS_INDEXCLASSIFIER_H_ */
void setClassName(int classindex, const char *name)
void setClassDecompInfo(int classindex, int decompInfo)
const char * getClassName(int classindex)
std::vector< int > getIndicesToClasses()
const char * getClassNameOfIndex(int index)
int addClass(const char *name, const char *desc)
bool classifierIsDuplicateOfClassifier(IndexClassifier *otherClassifier)
int getClassDecompInfo(int classindex)
void assignIndexToClass(int index, int classindex)
std::vector< int > getNIndicesOfClasses()
const char * getClassDescription(int classindex)
void setClassDescription(int classindex, const char *desc)
std::vector< std::vector< int > > getAllSubsets(std::vector< int > &classindices)
std::vector< int > reduceClasses(int maxNumberOfClasses)
IndexClassifier(SCIP *scip, const char *name, int nClasses, int nIndices)