GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
pub_mastersepacut.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 mastersepacut.c
30 * @brief public functions to work with master cuts
31 * @author Erik Muehmer
32 */
33
34/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35
36#ifndef GCG_PUB_MASTERSEPACUT_H__
37#define GCG_PUB_MASTERSEPACUT_H__
38
40
41#include "scip/scip.h"
42#include "gcg/def.h"
43#include "gcg/type_gcg.h"
46
47#ifdef NDEBUG
49#endif
50
51#ifdef __cplusplus
52extern "C" {
53#endif
54
55#ifdef NDEBUG
56#define GCGmastersepacutGetVarHistory(mastersepacut) ((mastersepacut)->knownvarhistory)
57#else
58/** returns the variable history of the separator master cut */
61 GCG_MASTERSEPACUT* mastersepacut /**< separator master cut */
62 );
63#endif
64
65/** return the separator which created the cut */
68 GCG_MASTERSEPACUT* mastersepacut /**< separator master cut */
69 );
70
71/** returns the data of the separator master cut */
74 GCG_MASTERSEPACUT* mastersepacut /**< separator master cut */
75 );
76
77/** set the variable history of separator master cut */
80 GCG* gcg, /**< GCG data structure */
81 GCG_MASTERSEPACUT* mastersepacut /**< pointer to separator master cut */
82 );
83
84/** creates a Chvatal-Gomory cut */
87 GCG* gcg, /**< GCG data structure */
88 GCG_MASTERSEPACUT** mastersepacut, /**< pointer to store separator master cut */
89 GCG_SEPA* sepa, /**< separator creating this cut */
90 GCG_VARHISTORY* varhistory, /**< variables history of subset row cut*/
91 SCIP_Real* weights, /**< weights which were used to create the cut */
92 int* indices, /**< indices of constraints used to create the cut */
93 int n /**< number of constraints used to create the cut */
94 );
95
96/** frees data of Chvatal-Gomory cut */
99 GCG* gcg, /**< GCG data structure */
100 GCG_MASTERSEPACUTDATA** data /**< pointer to data of subset row cut */
101 );
102
103/** returns the number of weights of Chvatal-Gomory cut */
106 GCG_MASTERSEPACUT* mastersepacut /**< separator master cut */
107 );
108
109/** returns the weights of Chvatal-Gomory cut */
112 GCG_MASTERSEPACUT* mastersepacut /**< separator master cut */
113 );
114
115/** returns the constraint indices of Chvatal-Gomory cut */
118 GCG_MASTERSEPACUT* mastersepacut /**< separator master cut */
119 );
120
121/** computes the coefficient of a column for a Chvatal-Gomory cut */
124 GCG* gcg, /**< GCG data structure */
125 GCG_EXTENDEDMASTERCONSDATA* mastercutdata, /**< master separator cut */
126 GCG_COL* gcgcol, /**< gcg column */
127 SCIP_Real* coeff /**< pointer to store the coefficient */
128 );
129
130/** computes the coefficient of a master variable for a Chvatal-Gomory cut */
133 GCG* gcg, /**< GCG data structure */
134 GCG_EXTENDEDMASTERCONSDATA* mastercutdata, /**< separator master cut */
135 SCIP_VAR** vars, /**< pricing variables which define the master variable */
136 SCIP_Real* vals, /**< values of the pricing variables which define the master variables */
137 int nvars, /**< number of pricing variables which define the master variable */
138 int probnr, /**< index of the pricing problem which generated the master variable */
139 SCIP_Real* coef /**< pointer to store the coefficient */
140 );
141
142/** returns active master separator cuts */
145 GCG* gcg /**< GCG data structure */
146 );
147
148/** return number of active mastersepacuts */
151 GCG* gcg /**< GCG data structure */
152 );
153
154#ifdef NDEBUG
155#define GCGextendedmasterconsGetMastersepacut(extendedmasterconsdata) ((extendedmasterconsdata)->data.mastersepacut)
156#else
157/** returns the corresponding mastersepacut */
160 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata
161 );
162#endif
163
164/** increases usage counter of separator master cut */
167 GCG_EXTENDEDMASTERCONSDATA* mastersepacut /**< separator master cut */
168 );
169
170/** decreases usage counter of separator master cut, and frees memory if necessary */
173 GCG* gcg, /**< GCG data structure */
174 GCG_EXTENDEDMASTERCONSDATA** mastersepacut /**< pointer to separator master cut */
175 );
176
177/** creates separator master cut */
180 GCG* gcg, /**< GCG data structure */
181 GCG_MASTERSEPACUT** mastersepacut, /**< pointer to store separator master cut */
182 GCG_SEPA* sepa, /**< separator creating this cut */
183 GCG_VARHISTORY* varhistory, /**< variable history */
184 GCG_MASTERSEPACUTDATA* mastersepacutdata /**< separator master cut data */
185 );
186
187/** creates extended master cons data for a given master cut */
190 GCG* gcg, /**< GCG data structure */
191 GCG_EXTENDEDMASTERCONSDATA** extendedmastercons, /**< pointer to store the create extended master cons data */
192 GCG_MASTERSEPACUT* cut, /**< master cut data structure */
193 SCIP_ROW* row, /**< corresponding row object */
194 GCG_PRICINGMODIFICATION** pricingmodifications, /**< related pricing modifications */
195 int npricingmodifications /**< number of pricing modifications */
196 );
197
198/** calculate the coefficient of a column solution */
201 GCG* gcg, /**< GCG data structure */
202 GCG_EXTENDEDMASTERCONSDATA* mastersepacut, /**< master cut data structure */
203 SCIP_VAR** solvars, /**< array of column solution variables */
204 SCIP_Real* solvals, /**< array of column solution values */
205 int nsolvars, /**< number of column solution variables and values */
206 int probnr, /**< the pricing problem that the column belongs to */
207 GCG_COL* gcgcol, /**< gcg column if available (or NULL) */
208 SCIP_Real* coef /**< pointer to store the coefficient */
209 );
210
211/** removes the mastersepacuts which were applied at current node, but have already been removed from the LP */
214 GCG* gcg, /**< GCG data structure */
215 int startidx /**< index of the first new separaot mastercut */
216 );
217
218/** removes all mastersepacuts after given index from active cuts */
221 GCG* gcg, /**< GCG data structure */
222 int newnrows /**< index to which active cuts should be shrunk to */
223 );
224
225/** remove all mastersepacuts from generated cuts and release them */
228 GCG* gcg /**< GCG data structure */
229 );
230
231/** adds new mastersepacut to generated cuts */
234 GCG* gcg, /**< GCG data structure */
235 GCG_EXTENDEDMASTERCONSDATA* mastersepacut /**< mastersepacut */
236 );
237
238/** adds a mastercut generated by a master separator to active cuts */
241 GCG* gcg, /**< GCG data structure */
242 GCG_EXTENDEDMASTERCONSDATA* mastersepacut /**< mastersepacut */
243 );
244
245#ifdef __cplusplus
246}
247#endif
248
249#endif
common defines and data types used in all packages of GCG
#define GCG_EXPORT
Definition def.h:59
#define SCIP_Real
SCIP_RETCODE GCGaddActiveMastersepacut(GCG *gcg, GCG_EXTENDEDMASTERCONSDATA *mastersepacut)
SCIP_RETCODE GCGaddGeneratedMastersepacut(GCG *gcg, GCG_EXTENDEDMASTERCONSDATA *mastersepacut)
SCIP_RETCODE GCGremoveNewInactiveMastersepacuts(GCG *gcg, int startidx)
SCIP_RETCODE GCGclearGeneratedMastersepacuts(GCG *gcg)
int GCGgetNActiveMastersepacuts(GCG *gcg)
SCIP_RETCODE GCGshrinkActiveMastersepacuts(GCG *gcg, int newnrows)
GCG_EXTENDEDMASTERCONSDATA ** GCGgetActiveMastersepacuts(GCG *gcg)
int GCGchvatalGomoryCutGetNWeights(GCG_MASTERSEPACUT *mastersepacut)
Definition gcgcgcut.c:116
SCIP_RETCODE GCGchvatalGomoryCutGetColumnCoefficient(GCG *gcg, GCG_EXTENDEDMASTERCONSDATA *mastercutdata, GCG_COL *gcgcol, SCIP_Real *coeff)
Definition gcgcgcut.c:161
SCIP_RETCODE GCGcreateChvatalGomoryCut(GCG *gcg, GCG_MASTERSEPACUT **mastersepacut, GCG_SEPA *sepa, GCG_VARHISTORY *varhistory, SCIP_Real *weights, int *indices, int n)
Definition gcgcgcut.c:53
int * GCGchvatalGomoryCutGetConssIndices(GCG_MASTERSEPACUT *mastersepacut)
Definition gcgcgcut.c:146
SCIP_RETCODE GCGfreeChvatalGomoryCutData(GCG *gcg, GCG_MASTERSEPACUTDATA **data)
Definition gcgcgcut.c:88
SCIP_RETCODE GCGchvatalGomoryCutGetVariableCoefficient(GCG *gcg, GCG_EXTENDEDMASTERCONSDATA *mastercutdata, SCIP_VAR **vars, SCIP_Real *vals, int nvars, int probnr, SCIP_Real *coef)
Definition gcgcgcut.c:204
SCIP_Real * GCGchvatalGomoryCutGetWeights(GCG_MASTERSEPACUT *mastersepacut)
Definition gcgcgcut.c:131
SCIP_VAR ** vars
int nvars
SCIP_RETCODE GCGmastersepacutGetExtendedmasterconsCoeff(GCG *gcg, GCG_EXTENDEDMASTERCONSDATA *mastersepacut, SCIP_VAR **solvars, SCIP_Real *solvals, int nsolvars, int probnr, GCG_COL *gcgcol, SCIP_Real *coef)
SCIP_RETCODE GCGmastersepacutSetVarHistory(GCG *gcg, GCG_MASTERSEPACUT *mastersepacut)
SCIP_RETCODE GCGcaptureMastersepacut(GCG_EXTENDEDMASTERCONSDATA *mastersepacut)
GCG_MASTERSEPACUTDATA * GCGmastersepacutGetData(GCG_MASTERSEPACUT *mastersepacut)
GCG_MASTERSEPACUT * GCGextendedmasterconsGetMastersepacut(GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata)
GCG_SEPA * GCGmastersepacutGetSeparator(GCG_MASTERSEPACUT *mastersepacut)
GCG_VARHISTORY * GCGmastersepacutGetVarHistory(GCG_MASTERSEPACUT *mastersepacut)
SCIP_RETCODE GCGextendedmasterconsCreateForSepamastercut(GCG *gcg, GCG_EXTENDEDMASTERCONSDATA **extendedmastercons, GCG_MASTERSEPACUT *cut, SCIP_ROW *row, GCG_PRICINGMODIFICATION **pricingmodifications, int npricingmodifications)
SCIP_RETCODE GCGcreateMastersepacut(GCG *gcg, GCG_MASTERSEPACUT **mastersepacut, GCG_SEPA *sepa, GCG_VARHISTORY *varhistory, GCG_MASTERSEPACUTDATA *mastersepacutdata)
SCIP_RETCODE GCGreleaseMastersepacut(GCG *gcg, GCG_EXTENDEDMASTERCONSDATA **mastersepacut)
type definitions for extended master conss in GCG projects
struct GCG_ExtendedMasterConsData GCG_EXTENDEDMASTERCONSDATA
struct GCG_PricingModification GCG_PRICINGMODIFICATION
struct Gcg GCG
Definition type_gcg.h:44
struct GCG_Col GCG_COL
Definition type_gcgcol.h:44
type definitions for managing variable history
struct GCG_VarHistory GCG_VARHISTORY
struct SCIP_Row SCIP_ROW
type definitions for master separator cuts
struct GCG_Mastersepacut GCG_MASTERSEPACUT
struct GCG_MastersepacutData GCG_MASTERSEPACUTDATA
enum SCIP_Retcode SCIP_RETCODE
struct GCG_Sepa GCG_SEPA
struct SCIP_Var SCIP_VAR