Scippy

GCG

Branch-and-Price & Column Generation for Everyone

gcg.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-2021 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 
28 /**@file gcg.h
29  * @ingroup PUBLICCOREAPI
30  * @brief GCG interface methods
31  * @author Martin Bergner
32  */
33 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 
36 /* #define SCIP_STATISTIC */
37 
38 #ifndef GCG_H_
39 #define GCG_H_
40 
41 #include "scip/scip.h"
42 #include "def.h"
43 
44 #include "type_branchgcg.h"
45 #include "type_decomp.h"
46 #include "type_detector.h"
47 #include "type_solver.h"
48 
49 #include "pub_gcgvar.h"
50 #include "pub_decomp.h"
51 
52 #include "relax_gcg.h"
53 #include "gcg_general.h"
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 /** checks whether the scip is the original scip instance
60  * @returns whether the scip is the original scip instance */
61 extern
62 SCIP_Bool GCGisOriginal(
63  SCIP* scip /**< SCIP data structure */
64  );
65 
66 /** checks whether the scip is the master problem scip
67  * @returns whether the scip is the master problem scip */
68 extern
69 SCIP_Bool GCGisMaster(
70  SCIP* scip /**< SCIP data structure */
71  );
72 
73 /** print out GCG statistics
74  * @returns SCIP return code */
75 SCIP_RETCODE GCGprintStatistics(
76  SCIP* scip, /**< SCIP data structure */
77  FILE* file /**< output file or NULL for standard output */
78 );
79 
80 /** print out complete detection statistics
81  * @returns SCIP return code */
83  SCIP* scip, /**< SCIP data structure */
84  FILE* file /**< output file or NULL for standard output */
85 );
86 
87 /** print name of current instance to given output
88  * @returns SCIP return code */
89 SCIP_RETCODE GCGprintInstanceName(
90  SCIP* scip, /**< SCIP data structure */
91  FILE* file /**< output file or NULL for standard output */
92 );
93 
95  SCIP* scip, /**< SCIP data structure */
96  SCIP_DIALOGHDLR* dialoghdlr /**< dialog handler */
97  );
98 
99 
100 
102  SCIP* scip, /**< SCIP data structure */
103  FILE* file /**< output file or NULL for standard output */
104 );
105 
106 SCIP_RETCODE GCGprintCompleteDetectionTime(
107  SCIP* scip, /**< SCIP data structure */
108  FILE* file /**< output file or NULL for standard output */
109 );
110 
111 
112 SCIP_RETCODE GCGprintPartitionInformation(
113  SCIP* scip, /**< SCIP data structure */
114  FILE* file /**< output file or NULL for standard output */
115 );
116 
117 SCIP_RETCODE GCGprintDecompInformation(
118  SCIP* scip, /**< SCIP data structure */
119  FILE* file /**< output file or NULL for standard output */
120 );
121 
122 
123 
124 /** gets the total memory used after problem creation stage for all pricingproblems */
125 extern
126 SCIP_Real GCGgetPricingprobsMemUsed(
127  SCIP* scip /**< SCIP data structure */
128  );
129 
130 /** prints out the degeneracy of the problem */
131 extern
132 void GCGprintDegeneracy(
133  SCIP* scip, /**< SCIP data structure */
134  double degeneracy /**< degeneracy to print*/
135  );
136 
137 /** returns the average degeneracy */
138 extern
139 SCIP_Real GCGgetDegeneracy(
140  SCIP* scip /**< SCIP data structure */
141  );
142 
143 /** transforms given values of the given original variables into values of the given master variables
144  * @returns the sum of the values of the corresponding master variables that are fixed */
145 extern
147  SCIP* scip, /**< SCIP data structure */
148  SCIP_VAR** origvars, /**< array with (subset of the) original variables */
149  SCIP_Real* origvals, /**< array with values for the given original variables */
150  int norigvars, /**< number of given original variables */
151  SCIP_VAR** mastervars, /**< array of (all present) master variables */
152  SCIP_Real* mastervals, /**< array to store the values of the master variables */
153  int nmastervars /**< number of master variables */
154  );
155 
156 /** transforms given solution of the master problem into solution of the original problem
157  * @returns SCIP return code */
158 extern
159 SCIP_RETCODE GCGtransformMastersolToOrigsol(
160  SCIP* scip, /**< SCIP data structure */
161  SCIP_SOL* mastersol, /**< solution of the master problem */
162  SCIP_SOL** origsol /**< pointer to store the new created original problem's solution */
163  );
164 
165 /** Checks whether the constraint belongs to GCG or not
166  * @returns whether the constraint belongs to GCG or not */
167 extern
168 SCIP_Bool GCGisConsGCGCons(
169  SCIP_CONS* cons /**< constraint to check */
170  );
171 
172 
173 /** returns the original problem for the given master problem */
174 SCIP* GCGgetOriginalprob(
175  SCIP* masterprob /**< the SCIP data structure for the master problem */
176  );
177 
178 /** returns the master problem */
179 extern
180 SCIP* GCGgetMasterprob(
181  SCIP* scip /**< SCIP data structure */
182  );
183 
184 /** returns the pricing problem of the given number */
185 extern
186 SCIP* GCGgetPricingprob(
187  SCIP* scip, /**< SCIP data structure */
188  int pricingprobnr /**< number of the pricing problem */
189  );
190 
191 /** returns the number of pricing problems */
192 extern
194  SCIP* scip /**< SCIP data structure */
195  );
196 
197 /** returns TRUE iff the pricingproblem of the given number is relevant, that means is not identical to
198  * another and represented by it */
199 extern
200 SCIP_Bool GCGisPricingprobRelevant(
201  SCIP* scip, /**< SCIP data structure */
202  int pricingprobnr /**< number of the pricing problem */
203  );
204 
205 /**
206  * for a given block, return the block by which it is represented
207  */
208 extern
210  SCIP* scip, /**< SCIP data structure */
211  int pricingprobnr /**< number of the pricing problem */
212  );
213 
214 /** returns the number of relevant pricing problems */
215 extern
217  SCIP* scip /**< SCIP data structure */
218  );
219 
220 /** returns the number of blocks in the original formulation, that are represented by
221  * the pricingprob with the given number */
222 extern
224  SCIP* scip, /**< SCIP data structure */
225  int pricingprobnr /**< number of the pricing problem */
226  );
227 
228 /** returns the number of constraints in the master problem */
229 extern
231  SCIP* scip /**< SCIP data structure */
232  );
233 
234 /** returns the contraints in the master problem */
235 extern
236 SCIP_CONS** GCGgetMasterConss(
237  SCIP* scip /**< SCIP data structure */
238  );
239 
240 /** returns the contraints in the original problem that correspond to the constraints in the master problem */
241 extern
242 SCIP_CONS** GCGgetOrigMasterConss(
243  SCIP* scip /**< SCIP data structure */
244  );
245 
246 
247 /** returns the convexity constraint for the given block */
248 extern
249 SCIP_CONS* GCGgetConvCons(
250  SCIP* scip, /**< SCIP data structure */
251  int blocknr /**< the number of the block for which we
252  * need the convexity constraint */
253  );
254 
255 /** returns whether the master problem is a set covering problem */
256 extern
257 SCIP_Bool GCGisMasterSetCovering(
258  SCIP* scip /**< SCIP data structure */
259  );
260 
261 /** returns whether the master problem is a set partitioning problem */
262 extern
264  SCIP* scip /**< SCIP data structure */
265  );
266 
267 /** returns whether the relaxator has been initialized */
268 extern
269 SCIP_Bool GCGrelaxIsInitialized(
270  SCIP* scip /**< SCIP data structure */
271  );
272 
273 /** return linking constraints for variables */
274 extern
275 SCIP_CONS** GCGgetVarLinkingconss(
276  SCIP* scip /**< SCIP data structure */
277  );
278 
279 /** return blocks of linking constraints for variables */
280 extern
282  SCIP* scip /**< SCIP data structure */
283  );
284 
285 /** return number of linking constraints for variables */
286 extern
288  SCIP* scip /**< SCIP data structure */
289  );
290 
291 /** return number of linking variables */
292 extern
294  SCIP* scip /**< SCIP data structure */
295  );
296 
297 /** return number of variables directly transferred to the master problem */
298 extern
299 int GCGgetNTransvars(
300  SCIP* scip /**< SCIP data structure */
301  );
302 
303 /** returns the auxiliary variable for the given pricing probblem */
304 extern
305 SCIP_VAR* GCGgetAuxiliaryVariable(
306  SCIP* scip, /**< SCIP data structure */
307  int pricingprobnr /**< number of the pricing problem */
308  );
309 
310 /** returns the relaxation solution from the Benders' decomposition */
311 extern
313  SCIP* scip /**< SCIP data structure */
314  );
315 
316 #ifdef __cplusplus
317 }
318 #endif
319 #endif /* GCG_H_ */
type definitions for branching rules in GCG projects
int GCGgetBlockRepresentative(SCIP *scip, int pricingprobnr)
Definition: relax_gcg.c:4023
SCIP * GCGgetOriginalprob(SCIP *masterprob)
Definition: relax_gcg.c:3883
int GCGgetNMasterConss(SCIP *scip)
Definition: relax_gcg.c:4079
common defines and data types used in all packages of GCG
type definitions for detectors in GCG projects
int GCGgetNVarLinkingconss(SCIP *scip)
Definition: relax_gcg.c:5043
SCIP_RETCODE GCGprintDecompInformation(SCIP *scip, FILE *file)
SCIP_CONS ** GCGgetVarLinkingconss(SCIP *scip)
Definition: relax_gcg.c:5005
SCIP_RETCODE GCGprintStatistics(SCIP *scip, FILE *file)
Definition: misc.c:685
SCIP * GCGgetPricingprob(SCIP *scip, int pricingprobnr)
Definition: relax_gcg.c:3939
int GCGgetNPricingprobs(SCIP *scip)
Definition: relax_gcg.c:3979
SCIP_Real GCGgetPricingprobsMemUsed(SCIP *scip)
Definition: relax_gcg.c:4925
void GCGprintDegeneracy(SCIP *scip, double degeneracy)
SCIP * GCGgetMasterprob(SCIP *scip)
Definition: relax_gcg.c:3920
int * GCGgetVarLinkingconssBlock(SCIP *scip)
Definition: relax_gcg.c:5024
SCIP_VAR * GCGgetAuxiliaryVariable(SCIP *scip, int pricingprobnr)
SCIP_Bool GCGisConsGCGCons(SCIP_CONS *cons)
Definition: misc.c:787
SCIP_Bool GCGisMaster(SCIP *scip)
Definition: misc.c:675
SCIP_RETCODE GCGtransformMastersolToOrigsol(SCIP *scip, SCIP_SOL *mastersol, SCIP_SOL **origsol)
Definition: misc.c:120
gcg general public methods
SCIP_RETCODE GCGprintPartitionInformation(SCIP *scip, FILE *file)
SCIP_RETCODE GCGprintCompleteDetectionStatistics(SCIP *scip, FILE *file)
Definition: misc.c:755
SCIP_Bool GCGisOriginal(SCIP *scip)
Definition: misc.c:665
int GCGgetNIdenticalBlocks(SCIP *scip, int pricingprobnr)
Definition: relax_gcg.c:4053
int GCGgetNRelPricingprobs(SCIP *scip)
Definition: relax_gcg.c:3959
type definitions for pricing problem solvers in GCG project
SCIP_Bool GCGrelaxIsInitialized(SCIP *scip)
Definition: relax_gcg.c:4958
SCIP_CONS ** GCGgetOrigMasterConss(SCIP *scip)
Definition: relax_gcg.c:4117
int GCGgetNLinkingvars(SCIP *scip)
Definition: relax_gcg.c:5062
GCG relaxator.
SCIP_Real GCGtransformOrigvalsToMastervals(SCIP *scip, SCIP_VAR **origvars, SCIP_Real *origvals, int norigvars, SCIP_VAR **mastervars, SCIP_Real *mastervals, int nmastervars)
Definition: misc.c:545
SCIP_Real GCGgetDegeneracy(SCIP *scip)
Definition: relax_gcg.c:4978
SCIP_SOL * GCGgetBendersRelaxationSol(SCIP *scip)
Definition: relax_gcg.c:5100
SCIP_RETCODE GCGprintInstanceName(SCIP *scip, FILE *file)
Definition: misc.c:738
public methods for GCG variables
SCIP_Bool GCGisPricingprobRelevant(SCIP *scip, int pricingprobnr)
Definition: relax_gcg.c:4000
SCIP_CONS ** GCGgetMasterConss(SCIP *scip)
Definition: relax_gcg.c:4098
SCIP_Bool GCGisMasterSetPartitioning(SCIP *scip)
Definition: relax_gcg.c:4240
SCIP_RETCODE GCGprintCompleteDetectionTime(SCIP *scip, FILE *file)
SCIP_RETCODE GCGprintMiplibStructureInformation(SCIP *scip, SCIP_DIALOGHDLR *dialoghdlr)
int GCGgetNTransvars(SCIP *scip)
Definition: relax_gcg.c:5081
SCIP_Bool GCGisMasterSetCovering(SCIP *scip)
Definition: relax_gcg.c:4221
SCIP_CONS * GCGgetConvCons(SCIP *scip, int blocknr)
Definition: relax_gcg.c:4136
SCIP_RETCODE GCGprintBlockcandidateInformation(SCIP *scip, FILE *file)
type definitions for decomposition information in GCG projects
public methods for working with decomposition structures