GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
class_pricingtype.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_pricingtype.h
30 * @brief abstraction for SCIP pricing types
31 * @author Martin Bergner
32 * @author Christian Puchert
33 */
34
35/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
36#ifndef GCG_CLASS_PRICINGTYPE_H__
37#define GCG_CLASS_PRICINGTYPE_H__
38
39#include "objscip/objscip.h"
40#include "gcg/pricer_gcg.h"
42
43/**
44 * @ingroup PRICING_PRIV
45 * @{
46 */
47
49{
50protected:
51 GCG* gcg; /**< GCG data structure */
52 SCIP* masterprob; /**< SCIP instance (master problem) */
53 GCG_PRICETYPE type; /**< type of pricing */
54 SCIP_CLOCK* clock; /**< CPU clock */
55
56 int calls; /**< number of times this type of pricing was called */
57 int maxrounds; /**< maximal number of pricing rounds */
58 int maxcolsroundroot; /**< maximal number of columns per pricing round at root node */
59 int maxcolsround; /**< maximal number of columns per pricing round */
60 int maxcolsprobroot; /**< maximal number of columns per problem to be generated at root node */
61 int maxcolsprob; /**< maximal number of columns per problem to be generated */
62 int maxsuccessfulprobs; /**< maximal number of successfully solved pricing problems until pricing
63 * loop is aborted */
64 SCIP_Real relmaxprobsroot; /**< maximal percentage of pricing problems that are solved at root node if
65 * variables have already been found */
66 SCIP_Real relmaxprobs; /**< maximal percentage of pricing problems that are solved if variables
67 * have already been found */
68 SCIP_Real relmaxsuccessfulprobs; /**< maximal percentage of pricing problems that need to be solved successfully */
69
70public:
71 /** constructor */
72 PricingType() = delete;
73
75 GCG* gcgstruct
76 );
77
78 /** destructor */
79 virtual ~PricingType();
80
81 /** get dual value of a constraint */
83 SCIP_CONS* cons /**< constraint to get dual for */
84 ) const = 0;
85
86 /** get dual value of a row */
88 SCIP_ROW* row /**< row to get dual value for */
89 ) const = 0;
90
91 /** get dual value of an extended master cons */
93 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata /**< extended master cons data */
94 ) const = 0;
95
96 /** get objective value of variable */
98 SCIP_VAR* var /**< variable to get objective value for */
99 ) const = 0;
100
101 /** adds parameters to the SCIP data structure */
103
104 /** starts the clock */
105 virtual SCIP_RETCODE startClock();
106
107 /** stops the clock */
108 virtual SCIP_RETCODE stopClock();
109
110 /** returns the time of the clock */
111 virtual SCIP_Real getClockTime() const;
112
113 /** returns the maximal number of rounds */
114 virtual int getMaxrounds() const
115 {
116 return maxrounds;
117 }
118
119 /** returns the maximal number of columns per pricing round */
120 virtual int getMaxcolsround() const = 0;
121
122 /** returns the maximal number of columns per problem to be generated during pricing */
123 virtual int getMaxcolsprob() const = 0;
124
125 /** returns the maximal number of successfully solved pricing problems */
127 {
128 return maxsuccessfulprobs;
129 }
130
131 /** returns the maximal percentage of pricing problems that are solved if variables have already been found */
132 virtual SCIP_Real getRelmaxprobs() const = 0;
133
134 /** returns the maximal percentage of pricing problems that need to be solved successfully */
139
140 /** returns the type of this pricing type */
142 {
143 return type;
144 }
145
146 /** returns the number of calls so far */
147 int getCalls() const
148 {
149 return calls;
150 }
151
152 /** increases the number of calls */
153 virtual void incCalls()
154 {
155 calls++;
156 }
157
158 /** resets the number of calls and the clock for a restart */
160 {
161 calls = 0;
163 return SCIP_OKAY;
164 }
165
166};
167
169{
170public:
171 /** constructor */
173
175 GCG* gcgstruct
176 );
177
178 /** destructor */
180
181 virtual SCIP_RETCODE addParameters();
182
183 virtual SCIP_Real consGetDual(
184 SCIP_CONS* cons
185 ) const;
186
187 virtual SCIP_Real rowGetDual(
188 SCIP_ROW* row
189 ) const;
190
192 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata
193 ) const;
194
195 virtual SCIP_Real varGetObj(
197 ) const ;
198
199 /** returns the maximal number of columns per pricing round */
200 virtual int getMaxcolsround() const;
201
202 /** returns the maximal number of columns per problem to be generated during pricing */
203 virtual int getMaxcolsprob() const;
204
205 /** returns the maximal percentage of pricing problems that are solved if variables have already been found */
206 virtual SCIP_Real getRelmaxprobs() const;
207};
208
210{
211public:
212 /** constructor */
213 FarkasPricing() = delete;
214
216 GCG* gcgstruct
217 );
218
219 /** destructor */
220 virtual ~FarkasPricing() {}
221
222 virtual SCIP_RETCODE addParameters();
223
224 virtual SCIP_Real consGetDual(
225 SCIP_CONS* cons
226 ) const;
227
228 virtual SCIP_Real rowGetDual(
229 SCIP_ROW* row
230 ) const;
231
233 GCG_EXTENDEDMASTERCONSDATA* extendedmasterconsdata
234 ) const;
235
236 virtual SCIP_Real varGetObj(
238 ) const;
239
240 /** returns the maximal number of columns per pricing round */
241 virtual int getMaxcolsround() const;
242
243 /** returns the maximal number of columns per problem to be generated during pricing */
244 virtual int getMaxcolsprob() const;
245
246 /** returns the maximal percentage of pricing problems that are solved if variables have already been found */
247 virtual SCIP_Real getRelmaxprobs() const;
248};
249
250/** @} */
251#endif /* CLASS_PRICINGTYPE_H_ */
static SCIP_Real varGetObj(SCIP_VAR *var)
Definition benders_gcg.c:79
virtual SCIP_Real rowGetDual(SCIP_ROW *row) const
virtual SCIP_RETCODE addParameters()
virtual ~FarkasPricing()
virtual int getMaxcolsround() const
virtual SCIP_Real getRelmaxprobs() const
FarkasPricing()=delete
virtual SCIP_Real extendedmasterconsGetDual(GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata) const
virtual SCIP_Real consGetDual(SCIP_CONS *cons) const
virtual int getMaxcolsprob() const
int getCalls() const
SCIP_Real getRelmaxsuccessfulprobs() const
virtual void incCalls()
virtual SCIP_Real rowGetDual(SCIP_ROW *row) const =0
SCIP_Real relmaxprobs
virtual int getMaxrounds() const
virtual SCIP_RETCODE stopClock()
virtual SCIP_Real extendedmasterconsGetDual(GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata) const =0
virtual SCIP_Real consGetDual(SCIP_CONS *cons) const =0
int getMaxsuccessfulprobs() const
virtual int getMaxcolsround() const =0
GCG_PRICETYPE getType() const
virtual SCIP_RETCODE startClock()
SCIP_Real relmaxprobsroot
SCIP_RETCODE resetCalls()
SCIP_CLOCK * clock
PricingType()=delete
virtual SCIP_Real varGetObj(SCIP_VAR *var) const =0
virtual SCIP_Real getClockTime() const
virtual SCIP_Real getRelmaxprobs() const =0
SCIP_Real relmaxsuccessfulprobs
GCG_PRICETYPE type
virtual int getMaxcolsprob() const =0
virtual SCIP_RETCODE addParameters()=0
virtual SCIP_Real extendedmasterconsGetDual(GCG_EXTENDEDMASTERCONSDATA *extendedmasterconsdata) const
virtual SCIP_Real getRelmaxprobs() const
virtual SCIP_RETCODE addParameters()
ReducedCostPricing()=delete
virtual SCIP_Real consGetDual(SCIP_CONS *cons) const
virtual int getMaxcolsprob() const
virtual int getMaxcolsround() const
virtual SCIP_Real rowGetDual(SCIP_ROW *row) const
#define SCIP_Real
SCIP_RETCODE SCIPresetClock(SCIP *scip, SCIP_CLOCK *clck)
SCIP_CALL(SCIPgetExternBranchCands(origprob, &lpcands, &lpcandssol, NULL, &nlpcands, NULL, NULL, NULL, NULL))
SCIP_VAR * var
GCG variable pricer.
struct SCIP_Clock SCIP_CLOCK
struct SCIP_Cons SCIP_CONS
type definitions for extended master conss in GCG projects
struct GCG_ExtendedMasterConsData GCG_EXTENDEDMASTERCONSDATA
struct Gcg GCG
Definition type_gcg.h:44
struct SCIP_Row SCIP_ROW
enum GCG_Pricetype GCG_PRICETYPE
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP
struct SCIP_Var SCIP_VAR