Scippy

GCG

Branch-and-Price & Column Generation for Everyone

pub_extendedmasterconsdata.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_extendedmasterconsdata.h
30 * @ingroup PUBLICCOREAPI
31 * @brief public methods for interacting with GCG_EXTENDEDMASTERCONSDATA
32 * @author Til Mohr
33 * @author Erik Muehmer
34 */
35
36/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
37
38#ifndef GCG_PUB_EXTENDEDMASTERCONSDATA_H_
39#define GCG_PUB_EXTENDEDMASTERCONSDATA_H_
40
42
43#include "scip/scip.h"
44#include "gcg/def.h"
45#include "gcg/type_gcg.h"
46#include "gcg/type_branchgcg.h"
48#include "gcg/type_gcgcol.h"
49
50#ifdef NDEBUG
52#endif
53
54#ifdef __cplusplus
55extern "C" {
56#endif
57
58/**
59 * @ingroup GCG_EXTENDEDMASTERCONSDATA
60 *
61 * @{
62 */
63
64/** create a pricing modification, taking ownership over additionalvars and additionalcons */
67 GCG* gcg, /**< GCG data structure */
68 GCG_PRICINGMODIFICATION** pricingmodification, /**< pointer to store the pricing modification */
69 int blocknr, /**< block number of the extended master cons */
70 SCIP_VAR* coefvar, /**< variable in the pricing problem inferred from the extended master cons
71 * always has the objective coefficient of the negated dual value of the extended master cons
72 * its solution value corresponds to the coefficient of the new mastervariable in the extended master cons */
73 SCIP_VAR** additionalvars, /**< array of additional variables with no objective coefficient in the pricing programs inferred from the extended master cons */
74 int nadditionalvars, /**< number of additional variables in the pricing programs */
75 SCIP_CONS** additionalconss, /**< array of additional constraints in the pricing programs inferred from the extended master cons */
76 int nadditionalconss /**< number of additional constraints in the pricing programs */
77 );
78
79/** create an extended master cons, taking ownership over pricingmodifications */
82 GCG* gcg, /**< GCG data structure */
83 GCG_EXTENDEDMASTERCONSDATA** extendedmasterconsdata, /**< pointer to store the extended master cons data */
84 GCG_EXTENDEDMASTERCONSTYPE type, /**< type of the extended master cons */
85 SCIP_CONS* cons, /**< constraint in the master problem that represents the extended master cons */
86 GCG_PRICINGMODIFICATION** pricingmodifications, /**< pricing modifications for the extended master cons */
87 int npricingmodifications, /**< number of pricing modifications for the extended master cons */
88 GCG_BRANCHCONSDATA* data /**< branchconsdata that belongs to the cons */
89 );
90
91/** create an extended master cons, taking ownership over pricingmodifications */
94 GCG* gcg, /**< GCG data structure */
95 GCG_EXTENDEDMASTERCONSDATA** extendedmasterconsdata, /**< pointer to store the extended master cons data */
96 GCG_EXTENDEDMASTERCONSTYPE type, /**< type of the extended master cons */
97 SCIP_ROW* row, /**< row in the master problem that represents the extended master cons */
98 GCG_PRICINGMODIFICATION** pricingmodifications, /**< pricing modifications for the extended master cons */
99 int npricingmodifications, /**< number of pricing modifications for the extended master cons */
100 GCG_MASTERSEPACUT* data /**< mastersepacut that corresponds to the row */
101 );
102
103/** free an extended master cons */
106 GCG* gcg, /**< GCG data structure */
107 GCG_EXTENDEDMASTERCONSDATA** extendedmasterconsdata /**< pointer to the extended master cons data */
108 );
109
110/** determine whether the extendedmasterconsdata is active in the masterscip */
113 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata /**< extended master cons data */
114 );
115
116/** add a new variable along with its coefficient to the extended master cons */
119 GCG* gcg, /**< GCG data structure */
120 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata, /**< extended master cons data */
121 SCIP_VAR* var, /**< variable to add */
122 SCIP_Real coef /**< coefficient of the variable */
123 );
124
125#ifdef NDEBUG
126#define GCGextendedmasterconsGetCons(extendedmasterconsdata) (extendedmasterconsdata)->cons.cons
127#else
128/** get the constraint that is the extended master cons */
131 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata /**< extended master cons data */
132 );
133#endif
134
135#ifdef NDEBUG
136#define GCGextendedmasterconsGetRow(extendedmasterconsdata) (extendedmasterconsdata)->cons.row
137#else
138/** get the row that is the extended master cons */
141 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata /**< extended master cons data */
142 );
143#endif
144
145#ifdef NDEBUG
146#define GCGpricingmodificationGetCoefVar(pricingmodification) (pricingmodification)->coefvar
147#else
148/** get the variable that determines the coefficient of a column in the extended master cons */
151 GCG_PRICINGMODIFICATION* pricingmodification /**< pricing modification */
152 );
153#endif
154
155#ifdef NDEBUG
156#define GCGpricingmodificationGetAdditionalVars(pricingmodification) (pricingmodification)->additionalvars
157#else
158/** get the additional variables that are inferred by the extended master cons */
161 GCG_PRICINGMODIFICATION* pricingmodification /**< pricing modification */
162 );
163#endif
164
165#ifdef NDEBUG
166#define GCGpricingmodificationGetNAdditionalVars(pricingmodification) (pricingmodification)->nadditionalvars
167#else
168/** get the number of additional variables that are inferred by the extended master cons */
171 GCG_PRICINGMODIFICATION* pricingmodification /**< pricing modification */
172 );
173#endif
174
175#ifdef NDEBUG
176#define GCGpricingmodificationGetAdditionalConss(pricingmodification) (pricingmodification)->additionalconss
177#else
178/** get the additional constraints that are inferred by the extended master cons */
181 GCG_PRICINGMODIFICATION* pricingmodification /**< pricing modification */
182 );
183#endif
184
185#ifdef NDEBUG
186#define GCGpricingmodificationGetNAdditionalConss(pricingmodification) (pricingmodification)->nadditionalconss
187#else
188/** get the number of additional constraints that are inferred by the extended master cons */
191 GCG_PRICINGMODIFICATION* pricingmodification /**< pricing modification */
192 );
193#endif
194
195#ifdef NDEBUG
196#define GCGpricingmodificationGetBlock(pricingmodification) (pricingmodification)->blocknr
197#else
198/** get the number of the block the modification belongs to */
201 GCG_PRICINGMODIFICATION* pricingmodification /**< pricing modification */
202 );
203#endif
204
205/** get the pricing modification for a block, if exists, else NULL */
208 GCG* gcg, /**< GCG data structure */
209 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata, /**< extended master cons data */
210 int blocknr /**< block number */
211 );
212
213#ifdef NDEBUG
214#define GCGextendedmasterconsGetPricingModifications(extendedmasterconsdata) (extendedmasterconsdata)->pricingmodifications
215#else
216/** get the pricing modifications for the extended master cons */
219 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata /**< extended master cons data */
220 );
221#endif
222
223#ifdef NDEBUG
224#define GCGextendedmasterconsGetNPricingModifications(extendedmasterconsdata) (extendedmasterconsdata)->npricingmodifications
225#else
226/** get the number of pricing modifications for the extended master cons */
229 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata /**< extended master cons data */
230 );
231#endif
232
233/** check whether a given variable is a coefficient variable of a given pricing modification */
236 GCG_PRICINGMODIFICATION* pricingmodification, /**< pricing modification */
237 SCIP_VAR* var /**< variable to check */
238 );
239
240/** check whether a given variable is a coefficient variable of a given extended master cons */
243 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata, /**< extended master cons data */
244 SCIP_VAR* var /**< variable to check */
245 );
246
247/** get name of the extended master cons */
250 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata /**< extended master cons data */
251 );
252
253/** get the lhs of the extended master cons */
256 GCG* gcg, /**< GCG data structure */
257 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata /**< extended master cons data */
258 );
259
260/** get the rhs of the extended master cons */
263 GCG* gcg, /**< GCG data structure */
264 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata /**< extended master cons data */
265 );
266
267/** get the constant of the extended master cons (always returns 0 if extended master cons is a constraint, returns constant of row otherwise) */
270 GCG* gcg, /**< GCG data structure */
271 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata /**< extended master cons data */
272 );
273
274/** get number of nonzero entries in the extended master cons */
277 GCG* gcg, /**< GCG data structure */
278 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata /**< extended master cons data */
279 );
280
281/** get array of columns with nonzero entries */
284 GCG* gcg, /**< GCG data structure */
285 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata /**< extended master cons data */
286 );
287
288/** get array of coefficients with nonzero entries */
291 GCG* gcg, /**< GCG data structure */
292 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata /**< extended master cons data */
293 );
294
295/** calculate the coefficient of a column solution in the extended master cons */
298 GCG* gcg, /**< GCG data structure */
299 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata, /**< extended master cons data */
300 SCIP_VAR** solvars, /**< array of column solution variables */
301 SCIP_Real* solvals, /**< array of column solution values */
302 int nsolvars, /**< number of column solution variables and values */
303 int probnr, /**< the pricing problem that the column belongs to */
304 GCG_COL* gcgcol, /**< gcg column if available (or NULL) */
305 SCIP_Real* coeff /**< pointer to store the coefficient */
306 );
307
308#ifdef NDEBUG
309#define GCGextendedmasterconsGetType(extendedmasterconsdata) (extendedmasterconsdata)->type
310#else
311/** gets the type of the extended master cons */
314 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata /**< extended master cons data */
315 );
316#endif
317
318/**@} */
319#ifdef __cplusplus
320}
321#endif
322
323#endif
common defines and data types used in all packages of GCG
#define GCG_EXPORT
Definition: def.h:59
#define SCIP_Bool
#define SCIP_Real
GCG_EXPORT GCG_PRICINGMODIFICATION * GCGextendedmasterconsGetPricingModification(GCG *gcg, GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata, int blocknr)
GCG_EXPORT int GCGpricingmodificationGetBlock(GCG_PRICINGMODIFICATION *pricingmodification)
GCG_EXPORT SCIP_CONS * GCGextendedmasterconsGetCons(GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata)
GCG_EXPORT const char * GCGextendedmasterconsGetName(GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata)
GCG_EXPORT SCIP_Bool GCGextendedmasterconsIsCoefVar(GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata, SCIP_VAR *var)
GCG_EXPORT int GCGpricingmodificationGetNAdditionalVars(GCG_PRICINGMODIFICATION *pricingmodification)
GCG_EXPORT SCIP_RETCODE GCGpricingmodificationCreate(GCG *gcg, GCG_PRICINGMODIFICATION **pricingmodification, int blocknr, SCIP_VAR *coefvar, SCIP_VAR **additionalvars, int nadditionalvars, SCIP_CONS **additionalconss, int nadditionalconss)
GCG_EXPORT SCIP_Real GCGextendedmasterconsGetRhs(GCG *gcg, GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata)
GCG_EXPORT SCIP_Real GCGextendedmasterconsGetLhs(GCG *gcg, GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata)
GCG_EXPORT int GCGpricingmodificationGetNAdditionalConss(GCG_PRICINGMODIFICATION *pricingmodification)
GCG_EXPORT SCIP_RETCODE GCGextendedmasterconsFree(GCG *gcg, GCG_EXTENDEDMASTERCONSDATA **extendedmasterconsdata)
GCG_EXPORT SCIP_Bool GCGextendedmasterconsIsActive(GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata)
GCG_EXPORT int GCGextendedmasterconsGetNPricingModifications(GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata)
GCG_EXPORT int GCGextendedmasterconsGetNNonz(GCG *gcg, GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata)
GCG_EXPORT SCIP_RETCODE GCGextendedmasterconsCreateFromCons(GCG *gcg, GCG_EXTENDEDMASTERCONSDATA **extendedmasterconsdata, GCG_EXTENDEDMASTERCONSTYPE type, SCIP_CONS *cons, GCG_PRICINGMODIFICATION **pricingmodifications, int npricingmodifications, GCG_BRANCHCONSDATA *data)
GCG_EXPORT SCIP_VAR ** GCGpricingmodificationGetAdditionalVars(GCG_PRICINGMODIFICATION *pricingmodification)
GCG_EXPORT SCIP_CONS ** GCGpricingmodificationGetAdditionalConss(GCG_PRICINGMODIFICATION *pricingmodification)
GCG_EXPORT GCG_EXTENDEDMASTERCONSTYPE GCGextendedmasterconsGetType(GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata)
GCG_EXPORT SCIP_RETCODE GCGextendedmasterconsAddMasterVar(GCG *gcg, GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata, SCIP_VAR *var, SCIP_Real coef)
GCG_EXPORT SCIP_VAR * GCGpricingmodificationGetCoefVar(GCG_PRICINGMODIFICATION *pricingmodification)
GCG_EXPORT SCIP_Bool GCGpricingmodificationIsCoefVar(GCG_PRICINGMODIFICATION *pricingmodification, SCIP_VAR *var)
GCG_EXPORT SCIP_RETCODE GCGextendedmasterconsGetCoeff(GCG *gcg, GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata, SCIP_VAR **solvars, SCIP_Real *solvals, int nsolvars, int probnr, GCG_COL *gcgcol, SCIP_Real *coeff)
GCG_EXPORT SCIP_Real GCGextendedmasterconsGetConstant(GCG *gcg, GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata)
GCG_EXPORT SCIP_COL ** GCGextendedmasterconsGetCols(GCG *gcg, GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata)
GCG_EXPORT GCG_PRICINGMODIFICATION ** GCGextendedmasterconsGetPricingModifications(GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata)
GCG_EXPORT SCIP_Real * GCGextendedmasterconsGetVals(GCG *gcg, GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata)
GCG_EXPORT SCIP_RETCODE GCGextendedmasterconsCreateFromRow(GCG *gcg, GCG_EXTENDEDMASTERCONSDATA **extendedmasterconsdata, GCG_EXTENDEDMASTERCONSTYPE type, SCIP_ROW *row, GCG_PRICINGMODIFICATION **pricingmodifications, int npricingmodifications, GCG_MASTERSEPACUT *data)
GCG_EXPORT SCIP_ROW * GCGextendedmasterconsGetRow(GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata)
Definition: struct_gcg.h:55
data structures for GCG extended master cons data
type definitions for branching rules in GCG projects
type definitions for extended master conss in GCG projects
enum GCG_ExtendedMasterConsType GCG_EXTENDEDMASTERCONSTYPE
type definitions for gcg data structure
type definitions for master separator cuts
enum SCIP_Retcode SCIP_RETCODE