Scippy

GCG

Branch-and-Price & Column Generation for Everyone

class_stabilization.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 class_stabilization.h
30 * @brief class with functions for dual variable smoothing
31 * @author Martin Bergner
32 * @author Jonas Witt
33 */
34
35/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
36
37#ifndef CLASS_STABILIZATION_H_
38#define CLASS_STABILIZATION_H_
39
42#include <scip/type_misc.h>
43#include <scip/type_retcode.h>
44
45namespace gcg {
46
47/**
48 * @ingroup PRICING_PRIV
49 * @{
50 */
51
53{
54private:
55 GCG* gcg;
56 SCIP* masterprob;
57 SCIP_Real* stabcenterconsvals;
58 int stabcenterconsvalssize;
59 int nstabcenterconsvals;
60 SCIP_Real* stabcenteroriginalsepacutvals;
61 int stabcenteroriginalsepacutvalssize;
62 int nstabcenteroriginalsepacutvals;
63 GCG_EXTENDEDMASTERCONSDATA** stabcenterbranchmasterconss;
64 int nstabcenterextendedmasterconss;
65 int stabcenterextendedmasterconsssize;
66 SCIP_Real* stabcenterbranchmasterconsvals;
67 SCIP_Real* stabcenterlinkingconsvals;
68 int nstabcenterlinkingconsvals;
69 int stabcenterlinkingconsvalssize;
70 SCIP_Real* stabcenterconv;
71 int nstabcenterconv;
72 SCIP_Real dualdiffnorm; /**< norm of difference between stabcenter and current duals */
73 SCIP_Real* subgradientconsvals;
74 int subgradientconsvalssize;
75 int nsubgradientconsvals;
76 SCIP_Real* subgradientoriginalsepacutvals;
77 int subgradientoriginalsepacutvalssize;
78 int nsubgradientoriginalsepacutvals;
79 GCG_EXTENDEDMASTERCONSDATA** subgradientextendedmasterconss;
80 int nsubgradientextendedmasterconss;
81 int subgradientextendedmasterconsssize;
82 SCIP_Real* subgradientextendedmasterconsvals;
83 SCIP_Real* subgradientlinkingconsvals;
84 int subgradientlinkingconsvalssize;
85 SCIP_Real subgradientnorm;
86 SCIP_Real hybridfactor;
87 PricingType* pricingtype;
88 SCIP_Real alpha;
89 SCIP_Real alphabar; /**< alpha that is used and updated in a mispricing schedule */
90 SCIP_Bool hybridascent; /**< hybridize smoothing with an ascent method? */
91 SCIP_Real beta;
92 SCIP_Longint nodenr;
93 int k; /**< counter for the number of stabilized pricing rounds in B&B node, excluding the mispricing schedule iterations */
94 int t; /**< counter for the number of pricing rounds during a mispricing schedule, restarted after a mispricing schedule is finished */
95 SCIP_Bool hasstabilitycenter;
96 SCIP_Real stabcenterbound;
97 SCIP_Bool inmispricingschedule; /**< currently in mispricing schedule */
98 SCIP_Real subgradientproduct;
99
100public:
101 /** constructor */
103 GCG* gcgstruct, /**< SCIP data structure */
104 PricingType* pricingtype, /**< the pricing type when the stabilization should run */
105 SCIP_Bool hybridascent /**< enable hybridization of smoothing with an ascent method? */
106 );
107 /** constructor */
109
110 /** destructor */
111 virtual ~Stabilization();
112
113 /** gets the stabilized dual solution of constraint at position i */
115 int i, /**< index of the constraint */
116 SCIP_Real* dual /**< return pointer for dual value */
117 );
118
119 /** gets the stabilized dual solution of cut at position i */
121 int i, /**< index of the row */
122 SCIP_Real* dual /**< return pointer for dual value */
123 );
124
125 /** gets the stabilized dual of the convexity constraint at position i */
127 int i
128 );
129
131 int i /**< index of extendedmasterconsdata */
132 );
133
135 int i /**< index of extendedmasterconsdata */
136 );
137
138 /** updates the stability center if the bound has increased */
140 SCIP_Real lowerbound, /**< lower bound due to lagrange function corresponding to current (stabilized) dual vars */
141 SCIP_Real* dualsolconv, /**< corresponding feasible dual solution for convexity constraints */
142 GCG_COL** pricingcols /**< columns of the pricing problems */
143 );
144
145 /** updates the alpha after unsuccessful pricing */
146 void updateAlphaMisprice();
147
148 /** updates the alpha after successful pricing */
149 void updateAlpha();
150
151 /** returns whether the stabilization is active */
153
154 /** enabling mispricing schedule */
156
157 /** disabling mispricing schedule */
159
160 /** is mispricing schedule enabled */
162
163 /** increases the number of new variable linking constraints */
165 int nlinkingconssnew /**< number of new linking constraints */
166 );
167
168 /** increases the number of new convexity constraints */
170 int nconvconssnew
171 );
172
173 /** gets the dual of variable linking constraints at index i */
175 int i
176 );
177
178 /**< update node */
179 void updateNode();
180
181 /**< update information for hybrid stablization with dual ascent */
183
184 /** update subgradient product */
186 GCG_COL** pricingcols /**< solutions of the pricing problems */
187 );
188
189 /** updates the extended master conss in the stability center (and allocates more memory) */
191
193
194private:
195 /** updates the number of iterations */
196 void updateIterationCount();
197
198 /** updates the number of iterations in the current mispricing schedule */
199 void updateIterationCountMispricing();
200
201 /** updates the constraints in the stability center (and allocates more memory) */
202 SCIP_RETCODE updateStabcenterconsvals();
203
204 /** updates the original cuts in the stability center (and allocates more memory) */
205 SCIP_RETCODE updateStabcenteroriginalcutvals();
206
207 /** updates the constraints in the subgradient (and allocates more memory) */
208 SCIP_RETCODE updateSubgradientconsvals();
209
210 /** updates the original cuts in the subgradient (and allocates more memory) */
211 SCIP_RETCODE updateSubgradientoriginalcutvals();
212
213 /** updates the extended master conss in the subgradient (and allocates more memory) */
214 SCIP_RETCODE updateSubgradientextendedmasterconsvals();
215
216 /** increase the alpha value */
217 void increaseAlpha();
218
219 /** decrease the alpha value */
220 void decreaseAlpha();
221
222 /** calculates the product of subgradient (with linking variables)
223 * with the difference of current duals and the stability center */
224 SCIP_Real calculateSubgradientProduct(
225 GCG_COL** pricingcols /**< columns of the pricing problems */
226 );
227
228 /** calculates the normalized subgradient (with linking variables) multiplied
229 * with the norm of the difference of current duals and the stability center */
230 SCIP_RETCODE calculateSubgradient(
231 GCG_COL** pricingcols /**< columns of the pricing problems */
232 );
233
234 /**< calculate norm of difference between stabcenter and current duals */
235 void calculateDualdiffnorm();
236
237 /**< calculate beta */
238 void calculateBeta();
239
240 /**< calculate factor that is needed in hybrid stabilization */
241 void calculateHybridFactor();
242
243 /** computes the new dual value based on the current and the stability center values */
244 SCIP_Real computeDual(
245 SCIP_Real center, /**< value of stabilility center */
246 SCIP_Real current, /**< current dual value */
247 SCIP_Real subgradient, /**< subgradient (or 0.0 if not needed) */
248 SCIP_Real lhs, /**< lhs (or 0.0 if not needed) */
249 SCIP_Real rhs /**< rhs (or 0.0 if not needed) */
250 ) const;
251};
252
253/** @} */
254} /* namespace gcg */
255#endif /* CLASS_STABILIZATION_H_ */
abstraction for SCIP pricing types
SCIP_Real branchmasterconsGetStabCenter(int i)
SCIP_RETCODE rowGetDual(int i, SCIP_Real *dual)
SCIP_RETCODE consGetDual(int i, SCIP_Real *dual)
SCIP_Real branchmasterconsGetDual(int i)
SCIP_RETCODE updateStabilityCenter(SCIP_Real lowerbound, SCIP_Real *dualsolconv, GCG_COL **pricingcols)
SCIP_RETCODE updateStabcenterextendedmasterconsvals()
SCIP_Bool isInMispricingSchedule() const
SCIP_Real convGetDual(int i)
SCIP_RETCODE setNConvconsvals(int nconvconssnew)
SCIP_RETCODE setNLinkingconsvals(int nlinkingconssnew)
SCIP_RETCODE updateSubgradientProduct(GCG_COL **pricingcols)
SCIP_Real linkingconsGetDual(int i)
SCIP_Bool hasStabilityCenter() const
#define SCIP_Longint
#define SCIP_Bool
#define SCIP_Real
Definition: struct_gcg.h:55
type definitions for extended master conss in GCG projects
enum SCIP_Retcode SCIP_RETCODE