GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
relax_gcg.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 relax_gcg.h
30 * @ingroup RELAXATORS-GCG
31 * @brief GCG relaxator
32 * @author Gerald Gamrath
33 * @author Christian Puchert
34 * @author Martin Bergner
35 * @author Oliver Gaul
36 * @author Erik Muehmer
37 */
38
39/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
40
41#ifndef GCG_RELAX_GCG_H__
42#define GCG_RELAX_GCG_H__
43
44#include "scip/scip.h"
45#include "gcg/gcg.h"
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51/**
52 * @ingroup RELAXATORS-GCG
53 * @{
54 */
55
56/** creates the GCG relaxator and includes it in SCIP */
59 GCG* gcg /**< GCG data structure */
60 );
61
62/** includes a branching rule into the relaxator data */
65 GCG* gcg, /**< GCG data structure */
66 SCIP_BRANCHRULE** branchrule, /**< branching rule for which callback methods are saved */
67 GCG_BRANCHRULE** gcgbranchrule, /**< pointer to store created GCG branch rule (can be NULL) */
68 const char* name, /**< name of branching rule */
69 const char* desc, /**< description of branching rule */
70 int priority, /**< priority of the branching rule */
71 int maxdepth, /**< maximal depth level, up to which this branching rule should be used (or -1) */
72 SCIP_Real maxbounddist, /**< maximal relative distance from current node's dual bound to primal bound
73 * compared to best node's dual bound for applying branching rule
74 * (0.0: only on current best node, 1.0: on all nodes) */
75 SCIP_BRANCHRULEDATA* branchruledata, /**< branching rule data */
76 GCG_DECL_BRANCHACTIVEMASTER((*branchactivemaster)),/**< activation method for branchrule */
77 GCG_DECL_BRANCHDEACTIVEMASTER((*branchdeactivemaster)),/**< deactivation method for branchrule */
78 GCG_DECL_BRANCHPROPMASTER((*branchpropmaster)),/**< propagation method for branchrule */
79 GCG_DECL_BRANCHMASTERSOLVED((*branchmastersolved)),/**< master solved method for branchrule */
80 GCG_DECL_BRANCHDATADELETE((*branchdatadelete)),/**< branchdata deletion method for branchrule */
81 GCG_DECL_BRANCHNEWCOL ((*branchnewcol)), /**< new column handler method of branching rule */
82 GCG_DECL_BRANCHGETEXTENDEDMASTERCONS((*branchgetextendedmastercons)), /**< extended master cons getter of branching rule */
83 GCG_DECL_BRANCHGETEXTENDEDMASTERCONSCOEFF((*branchgetextendedmasterconscoeff)) /**< column coefficient calculation method for extended master conss */
84 );
85
86/** perform activation method of the given branchrule for the given branchdata */
89 GCG* gcg, /**< GCG data structure */
90 GCG_BRANCHRULE* branchrule, /**< branching rule that did the branching */
91 GCG_BRANCHDATA* branchdata /**< data representing the branching decision */
92 );
93
94/** perform deactivation method of the given branchrule for the given branchdata */
97 GCG* gcg, /**< GCG data structure */
98 GCG_BRANCHRULE* branchrule, /**< branching rule that did the branching */
99 GCG_BRANCHDATA* branchdata /**< data representing the branching decision */
100 );
101
102/** perform propagation method of the given branchrule for the given branchdata */
105 GCG* gcg, /**< GCG data structure */
106 GCG_BRANCHRULE* branchrule, /**< branching rule that did the branching */
107 GCG_BRANCHDATA* branchdata, /**< data representing the branching decision */
108 SCIP_RESULT* result /**< pointer to store the result of the propagation call */
109 );
110
111/** perform method of the given branchrule that is called after the master LP is solved */
114 GCG* gcg, /**< GCG data structure */
115 GCG_BRANCHRULE* branchrule, /**< branching rule that did the branching */
116 GCG_BRANCHDATA* branchdata, /**< data representing the branching decision */
117 SCIP_Real newlowerbound /**< the new local lowerbound */
118 );
119
120/** frees branching data created by the given branchrule */
123 GCG* gcg, /**< GCG data structure */
124 GCG_BRANCHRULE* branchrule, /**< branching rule that did the branching */
125 GCG_BRANCHDATA** branchdata, /**< data representing the branching decision */
126 SCIP_Bool origbranch, /**< true iff an origbranch triggered this call */
127 SCIP_Bool force /**< branch data must be deleted if true */
128 );
129
130/** notifies the branching rule that a new mastervariable was created while this node was active */
133 GCG* gcg, /**< GCG data structure */
134 GCG_BRANCHRULE* branchrule, /**< branching rule that did the branching */
135 GCG_BRANCHDATA* branchdata, /**< data representing the branching decision */
136 SCIP_VAR* mastervar /**< new mastervariable that was created */
137 );
138
139/** gets the extendedmasterconsdata created by this branching rule, if any */
142 GCG* gcg, /**< GCG data structure */
143 GCG_BRANCHRULE* branchrule, /**< branching rule that did the branching */
144 GCG_BRANCHDATA* branchdata, /**< data representing the branching decision */
145 GCG_EXTENDEDMASTERCONSDATA** extendedmasterconsdata /**< the extendedmasterconsdata to grab */
146 );
147
148/** get extended master conss of all active nods */
151 GCG* gcg, /**< GCG data structure */
152 GCG_BRANCHRULE*** branchrules, /**< branching rules that created extended master conss (can be NULL) */
153 GCG_BRANCHDATA*** branchdata, /**< data represeting the branching decisions of the active nodes (can be NULL) */
154 GCG_EXTENDEDMASTERCONSDATA*** extendedmasterconsdata, /**< array of extended master conss generated by branching in all currently active nodes */
155 int* nextendedmasterconss /**< number of currently active branching rules that created extended master conss */
156 );
157
158/** transformes a constraint of the original problem into the master variable space and
159 * adds it to the master problem */
162 GCG* gcg, /**< GCG data structure */
163 SCIP_CONS* cons, /**< the constraint that should be transformed */
164 SCIP_CONS** transcons /**< pointer to the transformed constraint */
165 );
166
167/** returns the current solution for the original problem */
170 GCG* gcg /**< GCG data structure */
171 );
172
173/** returns whether the current solution is primal feasible in the original problem */
176 GCG* gcg /**< GCG data structure */
177 );
178
179/** start probing mode on both the original and master problems
180 *
181 * @note This mode is intended for working on the original variables but using the master LP;
182 * it currently only supports bound changes on the original variables,
183 * but no additional rows
184 */
187 GCG* gcg, /**< GCG data structure */
188 SCIP_HEUR* probingheur /**< heuristic that started probing mode, or NULL */
189 );
190
191/** returns the heuristic that started probing in the master problem, or NULL */
194 GCG* gcg /**< GCG data structure */
195 );
196
197/** add a new probing node the original problem together with an original branching constraint
198 *
199 * @note A corresponding probing node must be added to the master problem right before solving the probing LP
200 */
203 GCG* gcg /**< GCG data structure */
204 );
205
206/** add a new probing node the master problem together with a master branching constraint
207 * which ensures that bound changes are transferred to master and pricing problems
208 *
209 * @note A corresponding probing node must have been added to the original problem beforehand;
210 * furthermore, this method must be called after bound changes to the original problem have been made
211 */
214 GCG* gcg /**< GCG data structure */
215 );
216
217/** add a new probing node the master problem together with a master branching constraint
218 * which ensures that bound changes are transferred to master and pricing problems as well as additional
219 * constraints
220 *
221 * @note A corresponding probing node must have been added to the original problem beforehand;
222 * furthermore, this method must be called after bound changes to the original problem have been made
223 */
226 GCG* gcg, /**< GCG data structure */
227 GCG_BRANCHRULE* branchrule, /**< pointer to the branching rule */
228 GCG_BRANCHDATA* branchdata, /**< branching data */
229 SCIP_CONS** origbranchconss, /**< original constraints enforcing the branching decision */
230 int norigbranchconss, /**< number of original constraints */
231 int maxorigbranchconss /**< capacity of origbranchconss */
232 );
233
234/** add probing nodes to both the original and master problem;
235 * furthermore, add origbranch and masterbranch constraints to transfer branching decisions
236 * from the original to the master problem
237 */
240 GCG* gcg, /**< GCG data structure */
241 int probingdepth /**< probing depth of the node in the probing path that should be reactivated */
242 );
243
244/** solve the master probing LP without pricing */
247 GCG* gcg, /**< GCG data structure */
248 int maxlpiterations, /**< maximum number of lp iterations allowed */
249 SCIP_Longint* nlpiterations, /**< pointer to store the number of performed LP iterations (or NULL) */
250 SCIP_Real* lpobjvalue, /**< pointer to store the lp obj value if lp was solved */
251 SCIP_Bool* lpsolved, /**< pointer to store whether the lp was solved */
252 SCIP_Bool* lperror, /**< pointer to store whether an unresolved LP error occured or the
253 * solving process should be stopped (e.g., due to a time limit) */
254 SCIP_Bool* cutoff /**< pointer to store whether the probing direction is infeasible */
255 );
256
257/** solve the master probing LP with pricing */
260 GCG* gcg, /**< GCG data structure */
261 int maxpricerounds, /**< maximum number of pricing rounds allowed */
262 SCIP_Longint* nlpiterations, /**< pointer to store the number of performed LP iterations (or NULL) */
263 int* npricerounds, /**< pointer to store the number of performed pricing rounds (or NULL) */
264 SCIP_Real* lpobjvalue, /**< pointer to store the lp obj value if lp was solved */
265 SCIP_Bool* lpsolved, /**< pointer to store whether the lp was solved */
266 SCIP_Bool* lperror, /**< pointer to store whether an unresolved LP error occured or the
267 * solving process should be stopped (e.g., due to a time limit) */
268 SCIP_Bool* cutoff /**< pointer to store whether the probing direction is infeasible */
269 );
270
271/** end probing mode in both the original and master problems */
274 GCG* gcg /**< GCG data structure */
275 );
276
277/** transforms the current solution of the master problem into the original problem's space
278 * and saves this solution as currentsol in the relaxator's data */
281 GCG* gcg /**< GCG data structure */
282 );
283
284/** initialize master problem for solving
285 */
287 GCG* gcg /**< GCG data structure */
288 );
289
290/** stash limit settings if not already stashed
291 *
292 * @note This function is used to prevent that SCIP interrupts (due to limits) the solving process when the B&B trees are not synchronized.
293 * Otherwise it may happen that SCIP creates a dummy node in one tree that cannot be mirrored to the other one.
294 */
296 GCG* gcg /**< GCG data structure */
297 );
298
299/** restore limit settings if currently stashed
300 */
302 GCG* gcg /**< GCG data structure */
303 );
304
305#ifdef _OPENMP
306/** returns OpenMP locks
307 * @returns pointer to GCG_LOCKS struct
308 */
309GCG_LOCKS* GCGgetLocks(
310 GCG* gcg /**< GCG data structure */
311 );
312#endif
313
314/** sets the pricing problem parameters */
316 GCG_DECTYPE dectype, /**< the dectype of the decomp */
317 SCIP* pricingprob, /**< SCIP data structure of the pricing problem */
318 int clocktype, /**< clocktype to use in the pricing problem */
319 SCIP_Real infinity, /**< values larger than this are considered infinity in the pricing problem */
320 SCIP_Real epsilon, /**< absolute values smaller than this are considered zero in the pricing problem */
321 SCIP_Real sumepsilon, /**< absolute values of sums smaller than this are considered zero in the pricing problem */
322 SCIP_Real feastol, /**< feasibility tolerance for constraints in the pricing problem */
323 SCIP_Real lpfeastolfactor, /**< primal feasibility tolerance factor of LP solver in the pricing problem */
324 SCIP_Real dualfeastol, /**< feasibility tolerance for reduced costs in LP solution in the pricing problem */
325 SCIP_Bool enableppcuts /**< should ppcuts be stored for sepa_basis */
326 );
327
328/** returns the GCG data structure */
331 SCIP* origprob /**< SCIP data structure */
332 );
333
334/** includes a separator into the relaxator data */
337 GCG* gcg, /**< SCIP data structure */
338 SCIP_SEPA** sepa, /**< pointer to store created scip separator */
339 GCG_SEPA** gcgsepa, /**< pointer to store created GCG separator (can be NULL) */
340 const char* name, /**< name of separator */
341 const char* desc, /**< description of separator */
342 int priority, /**< priority of separator (>= 0: before, < 0: after constraint handlers) */
343 int freq, /**< frequency for calling separator */
344 SCIP_Real maxbounddist, /**< maximal relative distance from current node's dual bound to primal bound compared
345 * to best node's dual bound for applying separation */
346 SCIP_Bool usessubscip, /**< does the separator use a secondary SCIP instance? */
347 SCIP_Bool delay, /**< should separator be delayed, if other separators found cuts? */
348 SCIP_DECL_SEPAEXECLP ((*sepaexeclp)), /**< LP solution separation method of separator */
349 SCIP_DECL_SEPAEXECSOL ((*sepaexecsol)), /**< arbitrary primal solution separation method of separator */
350 SCIP_SEPADATA* sepadata, /**< separator data */
351 GCG_DECL_SEPAGETCOLCOEFFICIENT((*sepagetcolcoef)),/**< method for computing the column coefficient for a cut */
352 GCG_DECL_SEPAMASTERCUTDELETE((*sepamastercutdelete))/**< callback to delete the mastersepacutdata */
353 );
354
355#ifdef __cplusplus
356}
357
358#endif
359
360#endif
#define GCG_EXPORT
Definition def.h:59
#define SCIP_Longint
#define SCIP_Bool
#define SCIP_Real
#define infinity
GCG interface methods.
SCIP_RETCODE GCGincludeRelaxGcg(GCG *gcg)
Definition relax_gcg.c:3577
SCIP * origprob
* result
SCIP_Longint nlpiterations
SCIP_Bool lperror
heurdata npricerounds
int maxdepth
SCIP_Bool cutoff
SCIP_Bool lpsolved
SCIP_RETCODE GCGrelaxBranchActiveMaster(GCG *gcg, GCG_BRANCHRULE *branchrule, GCG_BRANCHDATA *branchdata)
Definition relax_gcg.c:3781
SCIP_RETCODE GCGrelaxBranchGetAllActiveExtendedMasterConss(GCG *gcg, GCG_BRANCHRULE ***branchrules, GCG_BRANCHDATA ***branchdata, GCG_EXTENDEDMASTERCONSDATA ***extendedmasterconsdata, int *nextendedmasterconss)
Definition relax_gcg.c:3931
SCIP_RETCODE GCGrelaxNewProbingnodeMaster(GCG *gcg)
Definition relax_gcg.c:4508
SCIP_RETCODE GCGrelaxBranchPropMaster(GCG *gcg, GCG_BRANCHRULE *branchrule, GCG_BRANCHDATA *branchdata, SCIP_RESULT *result)
Definition relax_gcg.c:3837
SCIP_RETCODE GCGrelaxBranchMasterSolved(GCG *gcg, GCG_BRANCHRULE *branchrule, GCG_BRANCHDATA *branchdata, SCIP_Real newlowerbound)
Definition relax_gcg.c:3961
SCIP_RETCODE GCGrelaxBranchNewCol(GCG *gcg, GCG_BRANCHRULE *branchrule, GCG_BRANCHDATA *branchdata, SCIP_VAR *mastervar)
Definition relax_gcg.c:3885
SCIP_RETCODE GCGrelaxNewProbingnodeMasterCons(GCG *gcg, GCG_BRANCHRULE *branchrule, GCG_BRANCHDATA *branchdata, SCIP_CONS **origbranchconss, int norigbranchconss, int maxorigbranchconss)
Definition relax_gcg.c:4562
SCIP_RETCODE GCGrelaxPerformProbing(GCG *gcg, int maxlpiterations, SCIP_Longint *nlpiterations, SCIP_Real *lpobjvalue, SCIP_Bool *lpsolved, SCIP_Bool *lperror, SCIP_Bool *cutoff)
Definition relax_gcg.c:4756
SCIP_RETCODE GCGrelaxIncludeBranchrule(GCG *gcg, SCIP_BRANCHRULE **branchrule, GCG_BRANCHRULE **gcgbranchrule, const char *name, const char *desc, int priority, int maxdepth, SCIP_Real maxbounddist, SCIP_BRANCHRULEDATA *branchruledata, GCG_DECL_BRANCHACTIVEMASTER((*branchactivemaster)), GCG_DECL_BRANCHDEACTIVEMASTER((*branchdeactivemaster)), GCG_DECL_BRANCHPROPMASTER((*branchpropmaster)), GCG_DECL_BRANCHMASTERSOLVED((*branchmastersolved)), GCG_DECL_BRANCHDATADELETE((*branchdatadelete)), GCG_DECL_BRANCHNEWCOL((*branchnewcol)), GCG_DECL_BRANCHGETEXTENDEDMASTERCONS((*branchgetextendedmastercons)),)
Definition relax_gcg.c:3717
SCIP_RETCODE GCGrelaxIncludeSepa(GCG *gcg, SCIP_SEPA **sepa, GCG_SEPA **gcgsepa, const char *name, const char *desc, int priority, int freq, SCIP_Real maxbounddist, SCIP_Bool usessubscip, SCIP_Bool delay, SCIP_DECL_SEPAEXECLP((*sepaexeclp)), SCIP_DECL_SEPAEXECSOL((*sepaexecsol)), SCIP_SEPADATA *sepadata, GCG_DECL_SEPAGETCOLCOEFFICIENT((*sepagetcolcoef)),)
Definition relax_gcg.c:5807
SCIP_RETCODE GCGrelaxStartProbing(GCG *gcg, SCIP_HEUR *probingheur)
Definition relax_gcg.c:4390
SCIP_RETCODE GCGrelaxUpdateCurrentSol(GCG *gcg)
Definition relax_gcg.c:4964
SCIP_SOL * GCGrelaxGetCurrentOrigSol(GCG *gcg)
Definition relax_gcg.c:4309
SCIP_RETCODE GCGrestoreLimitSettings(GCG *gcg)
Definition relax_gcg.c:5738
SCIP_RETCODE GCGsetPricingProblemParameters(GCG_DECTYPE dectype, SCIP *pricingprob, int clocktype, SCIP_Real infinity, SCIP_Real epsilon, SCIP_Real sumepsilon, SCIP_Real feastol, SCIP_Real lpfeastolfactor, SCIP_Real dualfeastol, SCIP_Bool enableppcuts)
Definition relax_gcg.c:865
SCIP_RETCODE GCGrelaxBranchDataDelete(GCG *gcg, GCG_BRANCHRULE *branchrule, GCG_BRANCHDATA **branchdata, SCIP_Bool origbranch, SCIP_Bool force)
Definition relax_gcg.c:3858
SCIP_RETCODE GCGrelaxTransOrigToMasterCons(GCG *gcg, SCIP_CONS *cons, SCIP_CONS **transcons)
Definition relax_gcg.c:3982
SCIP_RETCODE GCGrelaxNewProbingnodeOrig(GCG *gcg)
Definition relax_gcg.c:4459
SCIP_RETCODE GCGinitializeMasterProblemSolve(GCG *gcg)
Definition relax_gcg.c:5686
SCIP_RETCODE GCGrelaxPerformProbingWithPricing(GCG *gcg, int maxpricerounds, SCIP_Longint *nlpiterations, int *npricerounds, SCIP_Real *lpobjvalue, SCIP_Bool *lpsolved, SCIP_Bool *lperror, SCIP_Bool *cutoff)
Definition relax_gcg.c:4775
SCIP_RETCODE GCGrelaxEndProbing(GCG *gcg)
Definition relax_gcg.c:4794
SCIP_RETCODE GCGstashLimitSettings(GCG *gcg)
Definition relax_gcg.c:5700
SCIP_HEUR * GCGrelaxGetProbingheur(GCG *gcg)
Definition relax_gcg.c:4437
SCIP_Bool GCGrelaxIsOrigSolFeasible(GCG *gcg)
Definition relax_gcg.c:4328
SCIP_RETCODE GCGrelaxBacktrackProbing(GCG *gcg, int probingdepth)
Definition relax_gcg.c:4618
GCG_EXPORT GCG * GCGrelaxGetGcg(SCIP *origprob)
Definition relax_gcg.c:5788
SCIP_RETCODE GCGrelaxBranchGetExtendedMasterCons(GCG *gcg, GCG_BRANCHRULE *branchrule, GCG_BRANCHDATA *branchdata, GCG_EXTENDEDMASTERCONSDATA **extendedmasterconsdata)
Definition relax_gcg.c:3905
SCIP_RETCODE GCGrelaxBranchDeactiveMaster(GCG *gcg, GCG_BRANCHRULE *branchrule, GCG_BRANCHDATA *branchdata)
Definition relax_gcg.c:3809
struct SCIP_Branchrule SCIP_BRANCHRULE
struct SCIP_BranchruleData SCIP_BRANCHRULEDATA
#define GCG_DECL_BRANCHDATADELETE(x)
struct GCG_BranchData GCG_BRANCHDATA
#define GCG_DECL_BRANCHGETEXTENDEDMASTERCONSCOEFF(x)
#define GCG_DECL_BRANCHDEACTIVEMASTER(x)
struct GCG_Branchrule GCG_BRANCHRULE
#define GCG_DECL_BRANCHGETEXTENDEDMASTERCONS(x)
#define GCG_DECL_BRANCHPROPMASTER(x)
#define GCG_DECL_BRANCHACTIVEMASTER(x)
#define GCG_DECL_BRANCHMASTERSOLVED(x)
#define GCG_DECL_BRANCHNEWCOL(x)
struct SCIP_Cons SCIP_CONS
enum Dectype GCG_DECTYPE
Definition type_decomp.h:57
struct GCG_ExtendedMasterConsData GCG_EXTENDEDMASTERCONSDATA
struct Gcg GCG
Definition type_gcg.h:44
struct SCIP_Heur SCIP_HEUR
void GCG_LOCKS
Definition type_locks.h:66
enum SCIP_Result SCIP_RESULT
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP
struct SCIP_SepaData SCIP_SEPADATA
#define SCIP_DECL_SEPAEXECSOL(x)
#define SCIP_DECL_SEPAEXECLP(x)
struct SCIP_Sepa SCIP_SEPA
struct GCG_Sepa GCG_SEPA
#define GCG_DECL_SEPAGETCOLCOEFFICIENT(x)
#define GCG_DECL_SEPAMASTERCUTDELETE(x)
struct SCIP_Sol SCIP_SOL
struct SCIP_Var SCIP_VAR