Scippy

GCG

Branch-and-Price & Column Generation for Everyone

struct_vardata.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 struct_vardata.h
29  * @ingroup DATASTRUCTURES
30  * @brief data structures for GCG variable data
31  * @author Gerald Gamrath
32  * @author Martin Bergner
33  */
34 
35 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
36 
37 #ifndef GCG_STRUCT_VARDATA_H__
38 #define GCG_STRUCT_VARDATA_H__
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /** type of the variable */
46 {
47  GCG_VARTYPE_ORIGINAL = 0, /**< variable belongs to original problem */
48  GCG_VARTYPE_PRICING = 1, /**< variable belongs to a pricing problem */
49  GCG_VARTYPE_MASTER = 2 /**< variable belongs to the master problem */
50 };
51 typedef enum GCG_Vartype GCG_VARTYPE;
52 
53 /** additional data for linking variables */
55 {
56  SCIP_VAR** pricingvars; /**< array of corresponding variables in the pricing programs (NULL if variable is not linking this block)*/
57  SCIP_CONS** linkconss; /**< array of constraints in the master problem that ensure that all copies have the same values */
58  int nblocks; /**< number of blocks that this variable is linking */
59 };
61 
62 
63 /** data for original variables */
65 {
66  SCIP_VAR* pricingvar; /**< corresponding variable in the pricing program */
67  SCIP_CONS** masterconss; /**< master constraints of the original program in which the variable has a nonzero entry */
68  SCIP_Real* coefs; /**< coefficients in the linking constraints of the original program */
69  int ncoefs; /**< number of coefficients */
70  SCIP_VAR** mastervars; /**< variables in the master problem that contain the variable */
71  SCIP_Real* mastervals; /**< value of this variable in the master problem variables */
72  int nmastervars; /**< number of corresponding master variables */
73  int maxmastervars; /**< length of arrays mastervars and vals */
74  GCG_LINKINGVARDATA* linkingvardata; /**< additional data for linking variables */
75 };
77 
78 /** data for pricing variables */
80 {
81  SCIP_VAR** origvars; /**< corresponding variables in the original program */
82  int norigvars; /**< number of corresponding variables in the original program */
83  int maxorigvars; /**< length of origvars array */
84 };
86 
87 
88 /** data for master variables */
90 {
91  int norigvars; /**< number of variables in the original program corresponding to the current variable */
92  int maxorigvars; /**< capacity of origvars and origvals */
93  SCIP_VAR** origvars; /**< variables in the original program corresponding to the current variable */
94  SCIP_Real* origvals; /**< this variable represents vals[i] times the variable origvars[i] in the
95  * original program */
96  SCIP_Bool isray; /**< does this variable represent a ray or an extreme point? */
97  SCIP_Bool isartificial; /**< is variable artificial? */
98  SCIP_HASHMAP* origvar2val; /**< hash map that stores the fraction of original variables the master variable is contained in */
99  int index; /**< index of the master variable if stored in GCG's pricedvars array, -1 otherwise */
100 };
102 
103 /** variable data structure */
105 {
106  union
107  {
108  GCG_ORIGVARDATA origvardata; /**< data for original variables */
109  GCG_PRICINGVARDATA pricingvardata; /**< data for pricing variables */
110  GCG_MASTERVARDATA mastervardata; /**< data for variable of the master problem */
111  } data;
112  GCG_VARTYPE vartype; /**< type of variable */
113  int blocknr; /**< number of the block and pricing problem, the variable belongs to,
114  * or -1 if variable is directly transferred to the master problem,
115  * or -2 if variable is a linking variable */
116  SCIP_Longint creationnode; /**< node where the variable is created */
117  SCIP_Longint rootredcostcall; /**< pricing reduced cost call when the variable is created
118  * (-1 if variable was not created at the root node or was created in Farkas pricing) */
119  SCIP_Real creationtime; /**< time when the variable is created */
120  SCIP_Longint iteration; /**< iteration when the variable is created */
121  SCIP_Real gap; /**< gap when the variable was created */
122  SCIP_Real redcost; /**< reduced cost of the variable */
123 };
124 
125 #ifdef __cplusplus
126 }
127 #endif
128 
129 #endif
SCIP_Real gap
SCIP_Longint iteration
SCIP_HASHMAP * origvar2val
SCIP_CONS ** linkconss
SCIP_Longint creationnode
SCIP_CONS ** masterconss
@ GCG_VARTYPE_MASTER
SCIP_Real creationtime
GCG_Vartype
SCIP_VAR ** pricingvars
SCIP_VAR ** origvars
SCIP_Real redcost
GCG_LINKINGVARDATA * linkingvardata
SCIP_Real * coefs
union SCIP_VarData::@0 data
SCIP_Bool isartificial
GCG_MASTERVARDATA mastervardata
SCIP_Real * mastervals
GCG_PRICINGVARDATA pricingvardata
SCIP_Longint rootredcostcall
SCIP_VAR ** mastervars
GCG_ORIGVARDATA origvardata
SCIP_VAR ** origvars
@ GCG_VARTYPE_PRICING
GCG_VARTYPE vartype
SCIP_Real * origvals
@ GCG_VARTYPE_ORIGINAL
enum GCG_Vartype GCG_VARTYPE
SCIP_VAR * pricingvar