Scippy

GCG

Branch-and-Price & Column Generation for Everyone

pub_gcgcol.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 pub_gcgcol.h
29  * @ingroup PUBLICCOREAPI
30  * @brief public methods for working with gcg columns
31  * @author Jonas Witt
32  */
33 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 #ifndef GCG_PUB_GCGCOL_H__
36 #define GCG_PUB_GCGCOL_H__
37 
38 #include "type_gcgcol.h"
39 #include "scip/type_scip.h"
40 #include "scip/type_retcode.h"
41 #include "scip/type_var.h"
42 #include "scip/type_cons.h"
43 #include "scip/type_misc.h"
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 /*
50  * GCG Column
51  */
52 
53 /**@defgroup GCG_COLUMN GCG Column
54  * @ingroup DATASTRUCTURES
55  * @{
56  */
57 
58 /** create a gcg column */
59 extern
60 SCIP_RETCODE GCGcreateGcgCol(
61  SCIP* scip, /**< SCIP data structure */
62  GCG_COL** gcgcol, /**< pointer to store gcg column */
63  int prob, /**< number of corresponding pricing problem */
64  SCIP_VAR** vars, /**< (sorted) array of variables of corresponding pricing problem */
65  SCIP_Real* vals, /**< array of solution values (belonging to vars) */
66  int nvars, /**< number of variables */
67  SCIP_Bool isray, /**< is the column a ray? */
68  SCIP_Real redcost /**< last known reduced cost */
69 );
70 
71 /** free a gcg column */
72 extern
73 void GCGfreeGcgCol(
74  GCG_COL** gcgcol /**< pointer to store gcg column */
75 );
76 
77 /** create a gcg column from a solution to a pricing problem */
78 extern
79 SCIP_RETCODE GCGcreateGcgColFromSol(
80  SCIP* scip, /**< SCIP data structure (original problem) */
81  GCG_COL** gcgcol, /**< pointer to store gcg column */
82  int prob, /**< number of corresponding pricing problem */
83  SCIP_SOL* sol, /**< solution of pricing problem with index prob */
84  SCIP_Bool isray, /**< is column a ray? */
85  SCIP_Real redcost /**< last known reduced cost */
86 );
87 
88 /** get pricing problem index of gcg column */
89 extern
90 int GCGcolGetProbNr(
91  GCG_COL* gcgcol /**< gcg column structure */
92 );
93 
94 /** get pricing problem of gcg column */
95 extern
97  GCG_COL* gcgcol /**< gcg column structure */
98 );
99 
100 /** get variables of gcg column */
101 extern
102 SCIP_VAR** GCGcolGetVars(
103  GCG_COL* gcgcol /**< gcg column structure */
104 );
105 
106 /** get values of gcg column */
107 extern
108 SCIP_Real* GCGcolGetVals(
109  GCG_COL* gcgcol /**< gcg column structure */
110 );
111 
112 /** get number of variables of gcg column */
113 extern
114 int GCGcolGetNVars(
115  GCG_COL* gcgcol /**< gcg column structure */
116 );
117 
118 /** is gcg column a ray? */
119 extern
120 SCIP_Bool GCGcolIsRay(
121  GCG_COL* gcgcol /**< gcg column structure */
122 );
123 
124 /** get reduced cost of gcg column */
125 extern
126 SCIP_Real GCGcolGetRedcost(
127  GCG_COL* gcgcol /**< gcg column structure */
128 );
129 
130 /** comparison method for sorting gcg columns by non-decreasing reduced cost */
131 extern
132 SCIP_DECL_SORTPTRCOMP(GCGcolCompRedcost);
133 
134 /** comparison method for sorting gcg columns by non-increasing age */
135 extern
136 SCIP_DECL_SORTPTRCOMP(GCGcolCompAge);
137 
138 /** comparison method for gcg columns. Returns TRUE iff columns are equal */
139 extern
140 SCIP_Bool GCGcolIsEq(
141  GCG_COL* gcgcol1, /**< first gcg column structure */
142  GCG_COL* gcgcol2 /**< second gcg column structure */
143 );
144 
145 /** update reduced cost of variable and increase age */
146 extern
148  GCG_COL* gcgcol, /**< gcg column structure */
149  SCIP_Real redcost, /**< new reduced cost */
150  SCIP_Bool growold /**< increase age counter? */
151  );
152 
153 /** return solution value of variable in gcg column */
154 extern
155 SCIP_Real GCGcolGetSolVal(
156  SCIP* scip, /**< SCIP data structure */
157  GCG_COL* gcgcol, /**< gcg column */
158  SCIP_VAR* var /**< variable */
159  );
160 
161 /** get master coefficients of column */
162 extern
163 SCIP_Real* GCGcolGetMastercoefs(
164  GCG_COL* gcgcol /**< gcg column structure */
165  );
166 
167 /** get number of master coefficients of column */
168 extern
170  GCG_COL* gcgcol /**< gcg column structure */
171  );
172 
173 /** set master coefficients of column */
174 extern
175 SCIP_RETCODE GCGcolSetMastercoefs(
176  GCG_COL* gcgcol, /**< gcg column structure */
177  SCIP_Real* mastercoefs, /**< array of master coefficients */
178  int nmastercoefs /**< number of master coefficients */
179  );
180 
181 /** set norm of column */
182 extern
183 void GCGcolSetNorm(
184  GCG_COL* gcgcol, /**< gcg column structure */
185  SCIP_Real norm /**< norm of column */
186  );
187 /** get norm of column */
188 extern
189 void GCGcolComputeNorm(
190  SCIP* scip, /**< SCIP data structure */
191  GCG_COL* gcgcol /**< gcg column structure */
192  );
193 
194 /** set master coefficients of column as initialized */
195 extern
196 SCIP_RETCODE GCGcolSetInitializedCoefs(
197  GCG_COL* gcgcol /**< gcg column structure */
198  );
199 
200 /** return if master coefficients of column have been initialized */
201 extern
202 SCIP_Bool GCGcolGetInitializedCoefs(
203  GCG_COL* gcgcol /**< gcg column structure */
204  );
205 
206 /** get master coefficients of column */
207 extern
208 int* GCGcolGetLinkvars(
209  GCG_COL* gcgcol /**< gcg column structure */
210  );
211 
212 /** get number of master coefficients of column */
213 extern
215  GCG_COL* gcgcol /**< gcg column structure */
216  );
217 
218 /** set master coefficients information of column */
219 extern
220 SCIP_RETCODE GCGcolSetLinkvars(
221  GCG_COL* gcgcol, /**< gcg column structure */
222  int* linkvars, /**< array of linking variable indices for gcgcol->var */
223  int nlinkvars /**< number of linking variables in gcgcol->var */
224  );
225 
226 /** get master cut coefficients of column */
227 extern
228 SCIP_Real* GCGcolGetMastercuts(
229  GCG_COL* gcgcol /**< gcg column structure */
230  );
231 
232 /** get number of master cut coefficients of column */
233 extern
235  GCG_COL* gcgcol /**< gcg column structure */
236  );
237 
238 /** get norm of column */
239 extern
240 SCIP_Real GCGcolGetNorm(
241  GCG_COL* gcgcol /**< gcg column structure */
242  );
243 
244 /** update master cut coefficients information of column */
245 extern
246 SCIP_RETCODE GCGcolUpdateMastercuts(
247  GCG_COL* gcgcol, /**< gcg column structure */
248  SCIP_Real* newmastercuts, /**< pointer to new array of master cut coefficients */
249  int nnewmastercuts /**< new number of master cut coefficients */
250  );
251 
252 /** gets the age of the col */
253 extern
254 int GCGcolGetAge(
255  GCG_COL* col /**< col */
256  );
257 
258 /** returns whether the col's age exceeds the age limit */
259 extern
260 SCIP_Bool GCGcolIsAged(
261  GCG_COL* col, /**< col to check */
262  int agelimit /**< maximum age a col can reach before it is deleted from the pool, or -1 */
263  );
264 
265 /** compute parallelism of column to dual objective */
266 SCIP_Real GCGcolComputeDualObjPara(
267  SCIP* scip, /**< SCIP data structure */
268  GCG_COL* gcgcol /**< gcg column */
269  );
270 
271 /** compute orthogonality of two gcg columns */
272 extern
273 SCIP_Real GCGcolComputeOrth(
274  SCIP* scip, /**< SCIP data structure */
275  GCG_COL* gcgcol1, /**< first gcg column */
276  GCG_COL* gcgcol2 /**< second gcg column */
277  );
278 
279 /**@} */
280 
281 #ifdef __cplusplus
282 }
283 #endif
284 #endif
SCIP_RETCODE GCGcreateGcgCol(SCIP *scip, GCG_COL **gcgcol, int prob, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_Bool isray, SCIP_Real redcost)
Definition: gcgcol.c:52
void GCGcolComputeNorm(SCIP *scip, GCG_COL *gcgcol)
Definition: gcgcol.c:446
SCIP_Bool GCGcolIsRay(GCG_COL *gcgcol)
Definition: gcgcol.c:351
void GCGcolUpdateRedcost(GCG_COL *gcgcol, SCIP_Real redcost, SCIP_Bool growold)
Definition: gcgcol.c:375
type definitions for gcg column data structure
int GCGcolGetNMastercuts(GCG_COL *gcgcol)
Definition: gcgcol.c:568
SCIP_Real GCGcolGetSolVal(SCIP *scip, GCG_COL *gcgcol, SCIP_VAR *var)
Definition: gcgcol.c:613
SCIP_Real GCGcolGetRedcost(GCG_COL *gcgcol)
Definition: gcgcol.c:359
int GCGcolGetNLinkvars(GCG_COL *gcgcol)
Definition: gcgcol.c:528
SCIP_Real * GCGcolGetMastercoefs(GCG_COL *gcgcol)
Definition: gcgcol.c:393
SCIP_Bool GCGcolIsAged(GCG_COL *col, int agelimit)
Definition: gcgcol.c:640
SCIP_RETCODE GCGcreateGcgColFromSol(SCIP *scip, GCG_COL **gcgcol, int prob, SCIP_SOL *sol, SCIP_Bool isray, SCIP_Real redcost)
Definition: gcgcol.c:154
SCIP_Bool GCGcolIsEq(GCG_COL *gcgcol1, GCG_COL *gcgcol2)
Definition: gcgcol.c:246
SCIP_Bool GCGcolGetInitializedCoefs(GCG_COL *gcgcol)
Definition: gcgcol.c:512
SCIP_Real GCGcolGetNorm(GCG_COL *gcgcol)
Definition: gcgcol.c:576
void GCGcolSetNorm(GCG_COL *gcgcol, SCIP_Real norm)
Definition: gcgcol.c:437
SCIP_Real * GCGcolGetVals(GCG_COL *gcgcol)
Definition: gcgcol.c:335
SCIP_RETCODE GCGcolSetLinkvars(GCG_COL *gcgcol, int *linkvars, int nlinkvars)
Definition: gcgcol.c:536
int * GCGcolGetLinkvars(GCG_COL *gcgcol)
Definition: gcgcol.c:520
SCIP * GCGcolGetPricingProb(GCG_COL *gcgcol)
Definition: gcgcol.c:319
SCIP_VAR ** GCGcolGetVars(GCG_COL *gcgcol)
Definition: gcgcol.c:327
void GCGfreeGcgCol(GCG_COL **gcgcol)
Definition: gcgcol.c:135
SCIP_RETCODE GCGcolSetMastercoefs(GCG_COL *gcgcol, SCIP_Real *mastercoefs, int nmastercoefs)
Definition: gcgcol.c:409
SCIP_DECL_SORTPTRCOMP(GCGcolCompRedcost)
Definition: gcgcol.c:212
int GCGcolGetNMastercoefs(GCG_COL *gcgcol)
Definition: gcgcol.c:401
int GCGcolGetNVars(GCG_COL *gcgcol)
Definition: gcgcol.c:343
int GCGcolGetProbNr(GCG_COL *gcgcol)
Definition: gcgcol.c:311
int GCGcolGetAge(GCG_COL *col)
Definition: gcgcol.c:367
SCIP_Real * GCGcolGetMastercuts(GCG_COL *gcgcol)
Definition: gcgcol.c:560
SCIP_RETCODE GCGcolUpdateMastercuts(GCG_COL *gcgcol, SCIP_Real *newmastercuts, int nnewmastercuts)
Definition: gcgcol.c:584
SCIP_Real GCGcolComputeDualObjPara(SCIP *scip, GCG_COL *gcgcol)
Definition: gcgcol.c:651
SCIP_RETCODE GCGcolSetInitializedCoefs(GCG_COL *gcgcol)
Definition: gcgcol.c:502
SCIP_Real GCGcolComputeOrth(SCIP *scip, GCG_COL *gcgcol1, GCG_COL *gcgcol2)
Definition: gcgcol.c:758