GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
pub_gcgcol.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 pub_gcgcol.h
30 * @ingroup PUBLICCOREAPI
31 * @brief public methods for working with gcg columns
32 * @author Jonas Witt
33 */
34
35/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
36#ifndef GCG_PUB_GCGCOL_H__
37#define GCG_PUB_GCGCOL_H__
38
39#include "gcg/type_gcgcol.h"
40
41#include "scip/type_scip.h"
42#include "scip/type_retcode.h"
43#include "scip/type_var.h"
44#include "scip/type_cons.h"
45#include "scip/type_misc.h"
46#include "gcg/def.h"
47#include "gcg/type_gcg.h"
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
54/*
55 * GCG Column
56 */
57
58/**@defgroup GCG_COLUMN GCG Column
59 * @ingroup DATASTRUCTURES
60 * @{
61 */
62
63/** create a gcg column */
66 GCG* gcg, /**< GCG data structure */
67 SCIP* pricingprob, /**< SCIP data structure */
68 GCG_COL** gcgcol, /**< pointer to store gcg column */
69 int prob, /**< number of corresponding pricing problem */
70 SCIP_VAR** vars, /**< (sorted) array of variables of corresponding pricing problem */
71 SCIP_Real* vals, /**< array of solution values (belonging to vars) */
72 int nvars, /**< number of variables */
73 SCIP_Bool isray, /**< is the column a ray? */
74 SCIP_Real redcost /**< last known reduced cost */
75);
76
77/** free a gcg column */
80 GCG_COL** gcgcol /**< pointer to store gcg column */
81);
82
83/** create a gcg column from a solution to a pricing problem */
86 GCG* gcg, /**< GCG data structure */
87 SCIP* pricingprob, /**< SCIP data structure (pricing problem) */
88 SCIP* subproblem, /**< SCIP data structure that contains the actual solution (if NULL pricingprob will be used) */
89 SCIP_HASHMAP* varmap, /**< mapping of pricingprob vars to subproblem vars (can be NULL if subproblem is NULL) */
90 GCG_COL** gcgcol, /**< pointer to store gcg column */
91 int prob, /**< number of corresponding pricing problem */
92 SCIP_SOL* sol, /**< solution of pricing problem with index prob */
93 SCIP_Bool isray, /**< is column a ray? */
94 SCIP_Real redcost /**< last known reduced cost */
95);
96
97/** get pricing problem index of gcg column */
100 GCG_COL* gcgcol /**< gcg column structure */
101);
102
103/** get pricing problem of gcg column */
106 GCG_COL* gcgcol /**< gcg column structure */
107);
108
109/** get variables of gcg column */
112 GCG_COL* gcgcol /**< gcg column structure */
113);
114
115/** get values of gcg column */
118 GCG_COL* gcgcol /**< gcg column structure */
119);
120
121/** get number of variables of gcg column */
124 GCG_COL* gcgcol /**< gcg column structure */
125);
126
127/** is gcg column a ray? */
130 GCG_COL* gcgcol /**< gcg column structure */
131);
132
133/** get reduced cost of gcg column */
136 GCG_COL* gcgcol /**< gcg column structure */
137);
138
139/** comparison method for sorting gcg columns by non-decreasing reduced cost */
141SCIP_DECL_SORTPTRCOMP(GCGcolCompRedcost);
142
143/** comparison method for sorting gcg columns by non-increasing age */
145SCIP_DECL_SORTPTRCOMP(GCGcolCompAge);
146
147/** comparison method for gcg columns. Returns TRUE iff columns are equal */
150 GCG_COL* gcgcol1, /**< first gcg column structure */
151 GCG_COL* gcgcol2 /**< second gcg column structure */
152);
153
154/** update reduced cost of variable and increase age */
157 GCG_COL* gcgcol, /**< gcg column structure */
158 SCIP_Real redcost, /**< new reduced cost */
159 SCIP_Bool growold /**< increase age counter? */
160 );
161
162/** return solution value of variable in gcg column */
165 GCG_COL* gcgcol, /**< gcg column */
166 SCIP_VAR* var /**< variable */
167 );
168
169/** get master coefficients of column */
172 GCG_COL* gcgcol /**< gcg column structure */
173 );
174
175/** get number of master coefficients of column */
178 GCG_COL* gcgcol /**< gcg column structure */
179 );
180
181/** set master coefficients of column */
184 GCG_COL* gcgcol, /**< gcg column structure */
185 SCIP_Real* mastercoefs, /**< array of master coefficients */
186 int nmastercoefs /**< number of master coefficients */
187 );
188
189/** set norm of column */
191void GCGcolSetNorm(
192 GCG_COL* gcgcol, /**< gcg column structure */
193 SCIP_Real norm /**< norm of column */
194 );
195
196/** get norm of column */
199 GCG* gcg, /**< GCG data structure */
200 GCG_COL* gcgcol /**< gcg column structure */
201 );
202
203/** set master coefficients of column as initialized */
206 GCG_COL* gcgcol /**< gcg column structure */
207 );
208
209/** return if master coefficients of column have been initialized */
212 GCG_COL* gcgcol /**< gcg column structure */
213 );
214
215/** get master coefficients of column */
218 GCG_COL* gcgcol /**< gcg column structure */
219 );
220
221/** get number of master coefficients of column */
224 GCG_COL* gcgcol /**< gcg column structure */
225 );
226
227/** set master coefficients information of column */
230 GCG_COL* gcgcol, /**< gcg column structure */
231 int* linkvars, /**< array of linking variable indices for gcgcol->var */
232 int nlinkvars /**< number of linking variables in gcgcol->var */
233 );
234
235/** get original separator cut coefficients of column in master problem */
238 GCG_COL* gcgcol /**< gcg column structure */
239 );
240
241/** get number of original separator cut coefficients of column in master problem */
244 GCG_COL* gcgcol /**< gcg column structure */
245 );
246
247/** get norm of column */
250 GCG_COL* gcgcol /**< gcg column structure */
251 );
252
253/** update original separator cut coefficients information of column in the amster problem */
256 GCG_COL* gcgcol, /**< gcg column structure */
257 SCIP_Real* neworiginalsepamastercuts,/**< pointer to new array of master cut coefficients */
258 int nneworiginalsepamastercuts/**< new number of master cut coefficients */
259 );
260
261/** gets the age of the col */
263int GCGcolGetAge(
264 GCG_COL* col /**< col */
265 );
266
267/** returns whether the col's age exceeds the age limit */
270 GCG_COL* col, /**< col to check */
271 int agelimit /**< maximum age a col can reach before it is deleted from the pool, or -1 */
272 );
273
274/** compute parallelism of column to dual objective */
277 GCG* gcg, /**< GCG data structure */
278 GCG_COL* gcgcol, /**< gcg column */
279 SCIP_Real* para /**< pointer to store the parallelism of column to dual objective */
280 );
281
282/** compute orthogonality of two gcg columns */
285 GCG* gcg, /**< GCG data structure */
286 GCG_COL* gcgcol1, /**< first gcg column */
287 GCG_COL* gcgcol2, /**< second gcg column */
288 SCIP_Real* orth /**< pointer to store the orthogonality of two gcg columns */
289 );
290
291/** returns the inferred (coefficient) pricing variables solution values */
294 GCG_COL* gcgcol /**< gcgcol */
295 );
296
297/** returns the inferred (coefficient) pricing variables */
300 GCG_COL* gcgcol /**< gcgcol */
301 );
302
303/** returns the number of inferred (coefficient) pricing variables */
306 GCG_COL* gcgcol /**< gcgcol */
307 );
308
309/** update the column's stored coefficients for mastersepacut */
312 GCG_COL* gcgcol, /**< gcg column structure */
313 SCIP_Real* sepamastercoeffs, /**< pointer to array of new mastercut coefficients */
314 int nsepamastercoeffs /**< number of new mastercut coefficients */
315 );
316
317/** get the column's number of stored coefficients for mastersepacuts */
320 GCG_COL* gcgcol /**< gcg column structure */
321 );
322
323/** get the size of the column's array for mastersepacut coefficients */
326 GCG_COL* gcgcol /**< gcg column structure */
327 );
328
329/** get the column's coefficients for the mastersepacuts */
332 GCG_COL* gcgcol /**< gcg column structure */
333 );
334
335/** updates column such that it respect the given active cuts */
338 GCG* gcg, /**< GCG data structure */
339 GCG_COL* gcgcol, /**< gcg column structure */
340 GCG_EXTENDEDMASTERCONSDATA** mastersepacuts, /**< active master sepa cuts */
341 int nmastersepacuts, /**< number of all active cuts */
342 SCIP_Real* mastersepacutcoefs /**< master sepa cut coefficients */
343 );
344
345/** gets the hash key of a col */
347SCIP_DECL_HASHGETKEY(GCGhashGetKeyCol);
348
349/** returns TRUE iff both cols are identical */
351SCIP_DECL_HASHKEYEQ(GCGhashKeyEqCol);
352
353/** calculates the hash key value of a col */
355SCIP_DECL_HASHKEYVAL(GCGhashKeyValCol);
356
357/**@} */
358
359#ifdef __cplusplus
360}
361#endif
362#endif
SCIP_DECL_HASHGETKEY(SCIPhashGetKeyCons)
common defines and data types used in all packages of GCG
#define GCG_EXPORT
Definition def.h:59
#define SCIP_Bool
#define SCIP_Real
SCIP_RETCODE GCGcolSetMastersepacutCoeffs(GCG_COL *gcgcol, SCIP_Real *mastersepacutcoeffs, int nmastersepacutcoeffs)
Definition gcgcol.c:728
SCIP_RETCODE GCGcolComputeNorm(GCG *gcg, GCG_COL *gcgcol)
Definition gcgcol.c:562
SCIP_Real * GCGcolGetMastercoefs(GCG_COL *gcgcol)
Definition gcgcol.c:509
int GCGcolGetMastersepacutCoeffsSize(GCG_COL *gcgcol)
Definition gcgcol.c:768
int GCGcolGetNOriginalSepaMastercuts(GCG_COL *gcgcol)
Definition gcgcol.c:683
SCIP_Real * GCGcolGetOriginalSepaMastercuts(GCG_COL *gcgcol)
Definition gcgcol.c:675
int GCGcolGetNLinkvars(GCG_COL *gcgcol)
Definition gcgcol.c:643
SCIP_Real * GCGcolGetVals(GCG_COL *gcgcol)
Definition gcgcol.c:451
SCIP_RETCODE GCGcolUpdateOriginalSepaMastercuts(GCG_COL *gcgcol, SCIP_Real *neworiginalsepamastercuts, int nneworiginalsepamastercuts)
Definition gcgcol.c:699
SCIP_Real * GCGcolGetInferredPricingVals(GCG_COL *gcgcol)
Definition gcgcol.c:1133
SCIP_RETCODE GCGcolSetInitializedCoefs(GCG_COL *gcgcol)
Definition gcgcol.c:617
SCIP_RETCODE GCGcreateGcgColFromSol(GCG *gcg, SCIP *pricingprob, SCIP *subproblem, SCIP_HASHMAP *varmap, GCG_COL **gcgcol, int prob, SCIP_SOL *sol, SCIP_Bool isray, SCIP_Real redcost)
Definition gcgcol.c:267
SCIP_Real GCGcolGetNorm(GCG_COL *gcgcol)
Definition gcgcol.c:691
void GCGcolUpdateRedcost(GCG_COL *gcgcol, SCIP_Real redcost, SCIP_Bool growold)
Definition gcgcol.c:491
SCIP_RETCODE GCGcolSetLinkvars(GCG_COL *gcgcol, int *linkvars, int nlinkvars)
Definition gcgcol.c:651
SCIP_VAR ** GCGcolGetVars(GCG_COL *gcgcol)
Definition gcgcol.c:443
SCIP_RETCODE GCGfreeGcgCol(GCG_COL **gcgcol)
Definition gcgcol.c:231
int GCGcolGetNMastersepacutCoeffs(GCG_COL *gcgcol)
Definition gcgcol.c:760
SCIP_Real * GCGcolGetMastersepaCutCoeffs(GCG_COL *gcgcol)
Definition gcgcol.c:776
SCIP_RETCODE GCGcreateGcgCol(GCG *gcg, SCIP *pricingprob, GCG_COL **gcgcol, int probnr, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_Bool isray, SCIP_Real redcost)
Definition gcgcol.c:53
SCIP_Real GCGcolGetSolVal(GCG_COL *gcgcol, SCIP_VAR *var)
Definition gcgcol.c:784
int GCGcolGetNVars(GCG_COL *gcgcol)
Definition gcgcol.c:459
SCIP_Bool GCGcolIsRay(GCG_COL *gcgcol)
Definition gcgcol.c:467
SCIP * GCGcolGetPricingProb(GCG_COL *gcgcol)
Definition gcgcol.c:435
void GCGcolSetNorm(GCG_COL *gcgcol, SCIP_Real norm)
Definition gcgcol.c:553
int * GCGcolGetLinkvars(GCG_COL *gcgcol)
Definition gcgcol.c:635
SCIP_Bool GCGcolIsAged(GCG_COL *col, int agelimit)
Definition gcgcol.c:814
SCIP_Bool GCGcolGetInitializedCoefs(GCG_COL *gcgcol)
Definition gcgcol.c:627
SCIP_Real GCGcolGetRedcost(GCG_COL *gcgcol)
Definition gcgcol.c:475
SCIP_VAR ** GCGcolGetInferredPricingVars(GCG_COL *gcgcol)
Definition gcgcol.c:1141
SCIP_RETCODE GCGcolComputeDualObjPara(GCG *gcg, GCG_COL *gcgcol, SCIP_Real *para)
Definition gcgcol.c:825
SCIP_Bool GCGcolIsEq(GCG_COL *gcgcol1, GCG_COL *gcgcol2)
Definition gcgcol.c:371
int GCGcolGetProbNr(GCG_COL *gcgcol)
Definition gcgcol.c:427
SCIP_RETCODE GCGcolSetMastercoefs(GCG_COL *gcgcol, SCIP_Real *mastercoefs, int nmastercoefs)
Definition gcgcol.c:525
SCIP_RETCODE GCGcolUpdateActiveMastersepacuts(GCG *gcg, GCG_COL *gcgcol, GCG_EXTENDEDMASTERCONSDATA **mastersepacuts, int nmastersepacuts, SCIP_Real *mastersepacutcoefs)
Definition gcgcol.c:1157
int GCGcolGetNMastercoefs(GCG_COL *gcgcol)
Definition gcgcol.c:517
int GCGcolGetAge(GCG_COL *gcgcol)
Definition gcgcol.c:483
int GCGcolGetNInferredPricingVars(GCG_COL *gcgcol)
Definition gcgcol.c:1149
SCIP_RETCODE GCGcolComputeOrth(GCG *gcg, GCG_COL *gcgcol1, GCG_COL *gcgcol2, SCIP_Real *orth)
Definition gcgcol.c:984
SCIP_DECL_HASHKEYEQ(SCIPhashKeyEqString)
SCIP_DECL_HASHKEYVAL(SCIPhashKeyValString)
SCIP_DECL_SORTPTRCOMP(SCIPbendersComp)
SCIP_VAR * var
SCIP_VAR ** vars
int nvars
SCIP_SOL * sol
type definitions for extended master conss in GCG projects
struct GCG_ExtendedMasterConsData GCG_EXTENDEDMASTERCONSDATA
struct Gcg GCG
Definition type_gcg.h:44
type definitions for gcg data structure
struct GCG_Col GCG_COL
Definition type_gcgcol.h:44
struct SCIP_HashMap SCIP_HASHMAP
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP
struct SCIP_Sol SCIP_SOL
struct SCIP_Var SCIP_VAR