GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
class_conspartition.h
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
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-2026 Operations Research, RWTH Aachen University */
10/* Zuse Institute Berlin (ZIB) */
11/* */
12/* Licensed under the Apache License, Version 2.0 (the "License"); */
13/* you may not use this file except in compliance with the License. */
14/* You may obtain a copy of the License at */
15/* */
16/* http://www.apache.org/licenses/LICENSE-2.0 */
17/* */
18/* Unless required by applicable law or agreed to in writing, software */
19/* distributed under the License is distributed on an "AS IS" BASIS, */
20/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
21/* See the License for the specific language governing permissions and */
22/* limitations under the License. */
23/* */
24/* You should have received a copy of the Apache-2.0 license */
25/* along with GCG; see the file LICENSE. If not visit gcg.or.rwth-aachen.de.*/
26/* */
27/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
28
29/**@file class_conspartition.h
30 * @brief class representing a partition of a set of constraints
31 * @author Julius Hense
32 *
33 */
34
35/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
36
37#ifndef GCG_CLASS_CONSPARTITION_H__
38#define GCG_CLASS_CONSPARTITION_H__
39
40
42
43namespace gcg
44{
45
46/** @ingroup PARTITIONS
47 * @{
48 */
49
51{
52 BOTH = 0, /**< assign class to master or pricing problem */
53 ONLY_MASTER = 1, /**< assign class only to master problem */
54 ONLY_PRICING = 2 /**< assign class only to pricing problem */
55};
57
58
60{
61
62public:
63
64 /** constructor */
67 GCG* gcgstruct, /**< GCG data structure */
68 const char* name, /**< name of partition (will be copied) */
69 int nClasses, /**< initial number of classes */
70 int nConss /**< number of constraints to be classified */
71 );
72
73 /** copy constructor */
76 const ConsPartition* toCopy /**< ConsPartition to be copied */
77 );
78
79
80 /** destructor */
83
84
85 /** creates a new class, returns index of the class */
87 int addClass(
88 const char* name, /**< name of the class (will be copied) */
89 const char* desc, /**< description of the class (will be copied) */
90 CONS_DECOMPINFO decompInfo /**< decomposition code of the class */
91 );
92
93 /** assigns a constraint to a class */
96 int consindex, /**< index of the constraint */
97 int classindex /**< index of the class */
98 );
99
100 /** returns a vector containing all possible subsets of the chosen classindices */
102 std::vector<std::vector<int>> getAllSubsets(
103 bool both, /**< true, if BOTH classes should be considered */
104 bool only_master, /**< true, if ONLY_MASTER classes should be considered */
105 bool only_pricing /**< true, if ONLY_PRICING classes should be considered */
106 );
107
108 /** returns the decomposition info of a class */
111 int classindex /**< index of class */
112 );
113
114 /** returns the name of the class a constraint is assigned to */
116 const char* getClassNameOfCons(
117 int consindex /**< index of constraint */
118 );
119
120
121 /** returns the index of the class a constraint is assigned to */
123 int getClassOfCons(
124 int consindex /**< index of constraint */
125 );
126
127 /** returns vector containing the assigned class of each constraint */
129 const int* getConssToClasses(
130 );
131
132 /** returns the number of constraints */
134 int getNConss(
135 );
136
137 /** returns a vector with the numbers of constraints that are assigned to the classes */
139 std::vector<int> getNConssOfClasses(
140 );
141
142 /** returns whether a constraint is already assigned to a class */
144 bool isConsClassified(
145 int consindex /**< index of constraint */
146 );
147
148
149 /** returns partition with reduced number of classes
150 * if the current number of classes is greater than an upper bound
151 * and lower than 2*(upper bound) (returns NULL otherwise) */
154 int maxNumberOfClasses /**< upper bound */
155 );
156
157 /** sets the decomposition code of a class */
160 int classindex, /**< index of class */
161 CONS_DECOMPINFO decompInfo /**< decomposition code of class */
162 );
163
164};
165
166/** @} */
167} /* namespace gcg */
168#endif /* GCG_CLASS_CONSPARTITION_H__ */
generalization of ConsPartition and VarPartition
GCG_EXPORT void assignConsToClass(int consindex, int classindex)
GCG_EXPORT const int * getConssToClasses()
GCG_EXPORT void setClassDecompInfo(int classindex, CONS_DECOMPINFO decompInfo)
GCG_EXPORT ConsPartition(GCG *gcgstruct, const char *name, int nClasses, int nConss)
GCG_EXPORT int addClass(const char *name, const char *desc, CONS_DECOMPINFO decompInfo)
GCG_EXPORT std::vector< int > getNConssOfClasses()
GCG_EXPORT int getClassOfCons(int consindex)
GCG_EXPORT ConsPartition * reduceClasses(int maxNumberOfClasses)
GCG_EXPORT const char * getClassNameOfCons(int consindex)
GCG_EXPORT bool isConsClassified(int consindex)
GCG_EXPORT CONS_DECOMPINFO getClassDecompInfo(int classindex)
GCG_EXPORT std::vector< std::vector< int > > getAllSubsets(bool both, bool only_master, bool only_pricing)
IndexPartition(GCG *gcgstruct, const char *name, int nClasses, int nIndices)
#define GCG_EXPORT
Definition def.h:59
enum ConsClassDecompInfo CONS_DECOMPINFO
struct Gcg GCG
Definition type_gcg.h:44