GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
pricer_gcg.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 pricer_gcg.h
30 * @brief GCG variable pricer
31 * @author Gerald Gamrath
32 * @author Martin Bergner
33 * @ingroup PRICERS
34 */
35
36/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
37
38#ifndef GCG_PRICER_GCG__
39#define GCG_PRICER_GCG__
40
41#include "gcg/gcgvarhistory.h"
42#include "scip/scip.h"
43#include "gcg/gcg.h"
44#include "gcg/type_solver.h"
45#include "gcg/type_colpool.h"
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51/**@defgroup GCGPRICER GCG Variable Pricer
52 * @ingroup PRICING_PUB
53 * @{
54 */
55
56/** creates the GCG variable pricer and includes it in SCIP */
59 GCG* gcg /**< GCG data structure */
60 );
61
62/** returns the array of variables that were priced in during the solving process */
65 GCG* gcg /**< GCG data structure */
66 );
67
68/** returns the number of variables that were priced in during the solving process */
71 GCG* gcg /**< GCG data structure */
72 );
73
74/** adds the given constraint and the given position to the hashmap of the pricer */
77 GCG* gcg, /**< GCG data structure */
78 SCIP_CONS* cons, /**< the constraint that should be added */
79 int pos /**< the position of the constraint in the relaxator's masterconss array */
80 );
81
82/** sets the optimal LP solution in the pricerdata */
85 GCG* gcg, /**< GCG data structure */
86 SCIP_SOL** sol /**< pointer to optimal solution to root LP */
87 );
88
89#ifdef SCIP_STATISTIC
90/** gets the optimal LP solution in the pricerdata */
92SCIP_SOL* GCGmasterGetRootLPSol(
93 GCG* gcg /**< GCG data structure */
94 );
95#endif
96
97/** includes a solver into the pricer data */
100 GCG* gcg, /**< GCG data structure */
101 const char* name, /**< name of solver */
102 const char* desc, /**< description of solver */
103 int priority, /**< priority of solver */
104 SCIP_Bool heurenabled, /**< flag to indicate whether heuristic solving method of the solver is enabled */
105 SCIP_Bool exactenabled, /**< flag to indicate whether exact solving method of the solver is enabled */
106 GCG_DECL_SOLVERUPDATE((*solverupdate)), /**< update method for solver */
107 GCG_DECL_SOLVERSOLVE ((*solversolve)), /**< solving method for solver */
108 GCG_DECL_SOLVERSOLVEHEUR((*solveheur)), /**< heuristic solving method for solver */
109 GCG_DECL_SOLVERFREE ((*solverfree)), /**< free method of solver */
110 GCG_DECL_SOLVERINIT ((*solverinit)), /**< init method of solver */
111 GCG_DECL_SOLVEREXIT ((*solverexit)), /**< exit method of solver */
112 GCG_DECL_SOLVERINITSOL((*solverinitsol)), /**< initsol method of solver */
113 GCG_DECL_SOLVEREXITSOL((*solverexitsol)), /**< exitsol method of solver */
114 GCG_SOLVERDATA* solverdata /**< pricing solver data */
115 );
116
117
118/** returns the available pricing solvers */
121 GCG* gcg /**< GCG data structure */
122 );
123
124/** returns the number of available pricing solvers */
127 GCG* gcg /**< GCG data structure */
128 );
129
130/** writes out a list of all pricing problem solvers */
133 GCG* gcg /**< GCG data structure */
134 );
135
136/** prints pricing solver statistics */
139 GCG* gcg, /**< GCG data structure */
140 FILE* file /**< output file */
141 );
142
145 GCG* gcg, /**< GCG data structure */
146 FILE* file /**< output file */
147 );
148
149/** method to get existence of rays */
152 GCG* gcg, /**< GCG data structure */
153 SCIP_Bool* exist /**< pointer to store if there exists any ray */
154 );
155
156/** get the number of extreme points that a pricing problem has generated so far */
159 GCG* gcg, /**< GCG data structure */
160 int probnr /**< index of pricing problem */
161 );
162
163/** get the number of extreme rays that a pricing problem has generated so far */
166 GCG* gcg, /**< GCG data structure */
167 int probnr /**< index of pricing problem */
168 );
169
170/** get the number of columns to be added to the master LP in the current pricing round */
173 GCG* gcg /**< GCG data structure */
174 );
175
176/** get the number of columns per pricing problem to be added to the master LP in the current pricing round */
179 GCG* gcg /**< GCG data structure */
180 );
181
182/** add a new column to the pricing storage */
185 GCG* gcg, /**< GCG data structure */
186 GCG_COL* col /**< priced col */
187 );
188
189/** add a new column to the pricing storage and store result*/
192 GCG* gcg, /**< GCG data structure */
193 GCG_COL* col, /**< priced col */
194 SCIP_Bool* added /**< pointer to var that indicates whether the col was added */
195 );
196
197/** transfers a primal solution of the original problem into the master variable space,
198 * i.e. creates one master variable for each block and adds the solution to the master problem */
201 GCG* gcg, /**< GCG data structure */
202 SCIP_SOL* origsol, /**< the solution that should be transferred */
203 SCIP_Bool* stored /**< pointer to store if transferred solution is feasible (or NULL) */
204 );
205
206/** create initial master variables */
209 GCG* gcg /**< GCG data structure */
210 );
211
212/** get root node degeneracy */
215 GCG* gcg /**< GCG data structure */
216 );
217
218/** return if artifical variables are used in current solution */
221 GCG* gcg /**< GCG data structure */
222 );
223
226 GCG* gcg /**< GCG data structure */
227 );
228
231 GCG* gcg, /**< GCG data structure */
232 SCIP_SOL* mastersol /**< solution of the master problem, or NULL for current LP solution */
233 );
234
235/** get number of iterations in pricing problems */
238 GCG* gcg /**< GCG data structure */
239 );
240
241/** print simplex iteration statistics */
244 GCG* gcg, /**< GCG data structure */
245 FILE* file /**< output file */
246 );
247
248/** set pricing objectives */
251 GCG* gcg, /**< GCG data structure */
252 SCIP_Real* dualsolconv /**< array of dual solutions corresponding to convexity constraints */
253 );
254
255/** sets the dual weight for the pricing objective */
258 GCG* gcg, /**< GCG data structure */
259 SCIP_Real dualweight /**< the weighting applied to the dual variables */
260 );
261
262/** sets the Lagrangian relaxation weight for the pricing objective */
265 GCG* gcg, /**< GCG data structure */
266 SCIP_Real* weights, /**< the Lagrangian relaxation weight applied to the master constraints */
267 int* weightids, /**< the constraint ids for the relaxation weights */
268 int nweights /**< the number of weights */
269 );
270
271/** creates a new master variable corresponding to the given gcg column */
274 GCG* gcg, /**< GCG data structure */
275 SCIP_Bool infarkas, /**< in Farkas pricing? */
276 GCG_COL* gcgcol, /**< GCG column data structure */
277 SCIP_Bool force, /**< should the given variable be added also if it has non-negative reduced cost? */
278 SCIP_Bool* added, /**< pointer to store whether the variable was successfully added */
279 SCIP_VAR** addedvar, /**< pointer to store the created variable */
280 SCIP_Real score /**< score of column (or -1.0 if not specified) */
281 );
282
283/** computes the reduced cost of a column */
286 GCG* gcg, /**< GCG data structure */
287 SCIP_Bool infarkas, /**< in Farkas pricing? */
288 GCG_COL* gcgcol, /**< gcg column to compute reduced cost for */
289 SCIP_Real* objvalptr /**< pointer to store the computed objective value */
290 );
291
292/** compute master and cut coefficients of column */
295 GCG* gcg, /**< GCG data structure */
296 GCG_COL* gcgcol /**< GCG column data structure */
297 );
298
299/** includes a pricing callback plugin into the pricer data */
302 GCG* gcg, /**< GCG data structure */
303 const char* name, /**< name of pricing callback plugin */
304 const char* desc, /**< description of pricing callback plugin */
305 int priority, /**< priority of pricing callback plugin */
306 GCG_DECL_PRICINGCBFREE((*pricingcbfree)), /**< destructor of the pricing callback */
307 GCG_DECL_PRICINGCBINIT((*pricingcbinit)), /**< initialize the pricing callback */
308 GCG_DECL_PRICINGCBEXIT((*pricingcbexit)), /**< deinitialize the pricing callback */
309 GCG_DECL_PRICINGCBINITSOL((*pricingcbinitsol)),/**< solving process initialization method of the pricing callback */
310 GCG_DECL_PRICINGCBEXITSOL((*pricingcbexitsol)),/**< solving process deinitialization method of the pricing callback */
311 GCG_DECL_PRICINGCBPREPRICING((*pricingcbprepricing)),/**< pre-pricing method of the pricing callback */
312 GCG_DECL_PRICINGCBPOSTPRICING((*pricingcbpostpricing)),/**< post-pricing method of the pricing callback */
313 GCG_PRICINGCBDATA* pricingcbdata /**< pricing callback data */
314 );
315
316/** returns the available pricing callback plugins */
319 GCG* gcg /**< GCG data structure */
320 );
321
322/** returns the number of available pricing callback plugins */
325 GCG* gcg /**< GCG data structure */
326 );
327
328/** returns the pricing callback plugin of the given name, or NULL if it doesn't exist */
331 GCG* gcg, /**< GCG data structure */
332 const char* name /**< the name of the pricing callback plugin */
333 );
334
335/** get colpool */
338 GCG* gcg /**< GCG data structure */
339 );
340
341/** get a weak reference to the current and latest varhistory pointer */
344 GCG* gcg /**< GCG data structure */
345 );
346
347#ifdef _OPENMP
348/** get maximal number of pricing threads */
350int GCGpricerGetMaxNThreads(
351 GCG* gcg /**< GCG data structure */
352 );
353#endif
354
355/** returns the GCG data structure */
358 SCIP* masterprob /**< SCIP data structure */
359 );
360
361/** return number of active pricing modifications for a specific pricing problem */
364 GCG* gcg, /**< GCG data structure */
365 int probnr /**< number of pricing problem */
366 );
367
368/** return number of actually applied pricing modifications for a specific pricing problem */
371 GCG* gcg, /**< GCG data structure */
372 int probnr /**< number of pricing problem */
373 );
374
375/**@} */
376#ifdef __cplusplus
377}
378
379#endif
380
381#endif
#define GCG_EXPORT
Definition def.h:59
#define SCIP_Longint
#define SCIP_Bool
#define SCIP_Real
GCG interface methods.
methods for managing variable history
SCIP_Bool GCGmasterIsBestsolValid(GCG *gcg)
int GCGpricerGetNSolvers(GCG *gcg)
SCIP_Real GCGmasterGetDegeneracy(GCG *gcg)
SCIP_RETCODE GCGcreateNewMasterVarFromGcgCol(GCG *gcg, SCIP_Bool infarkas, GCG_COL *gcgcol, SCIP_Bool force, SCIP_Bool *added, SCIP_VAR **addedvar, SCIP_Real score)
SCIP_RETCODE GCGpricerAddColResult(GCG *gcg, GCG_COL *col, SCIP_Bool *added)
SCIP_RETCODE GCGmasterPrintSimplexIters(GCG *gcg, FILE *file)
int GCGmasterGetNPricedvars(GCG *gcg)
SCIP_RETCODE GCGsetPricingObjs(GCG *gcg, SCIP_Real *dualsolconv)
SCIP_RETCODE GCGmasterTransOrigSolToMasterVars(GCG *gcg, SCIP_SOL *origsol, SCIP_Bool *stored)
GCG_PRICINGCB ** GCGpricerGetPricingcbs(GCG *gcg)
int GCGpricerGetNRaysProb(GCG *gcg, int probnr)
SCIP_RETCODE GCGmasterAddMasterconsToHashmap(GCG *gcg, SCIP_CONS *cons, int pos)
void GCGsetPricingObjDualWeight(GCG *gcg, SCIP_Real dualweight)
int GCGpricerGetMaxColsRound(GCG *gcg)
SCIP_Bool GCGmasterIsCurrentSolValid(GCG *gcg)
SCIP_RETCODE GCGcomputeColMastercoefs(GCG *gcg, GCG_COL *gcgcol)
GCG_VARHISTORY * GCGgetCurrentVarhistoryReference(GCG *gcg)
SCIP_RETCODE GCGpricerAddCol(GCG *gcg, GCG_COL *col)
SCIP_RETCODE GCGpricerExistRays(GCG *gcg, SCIP_Bool *exist)
int GCGgetNAppliedPricingproblemModifications(GCG *gcg, int probnr)
void GCGsetPricingObjRelaxWeight(GCG *gcg, SCIP_Real *weights, int *weightids, int nweights)
GCG_SOLVER ** GCGpricerGetSolvers(GCG *gcg)
GCG * GCGpricerGetGcg(SCIP *masterprob)
int GCGpricerGetMaxColsProb(GCG *gcg)
SCIP_Bool GCGmasterIsSolValid(GCG *gcg, SCIP_SOL *mastersol)
int GCGpricerGetNPricingcbs(GCG *gcg)
void GCGpricerPrintListOfSolvers(GCG *gcg)
void GCGpricerPrintStatistics(GCG *gcg, FILE *file)
SCIP_Longint GCGmasterGetPricingSimplexIters(GCG *gcg)
SCIP_RETCODE GCGincludePricerGcg(GCG *gcg)
GCG_EXPORT SCIP_RETCODE GCGmasterSetRootLPSol(GCG *gcg, SCIP_SOL **sol)
GCG_COLPOOL * GCGgetColpool(GCG *gcg)
GCG_PRICINGCB * GCGpricerFindPricingcb(GCG *gcg, const char *name)
SCIP_Real GCGcomputeRedCostGcgCol(GCG *gcg, SCIP_Bool infarkas, GCG_COL *gcgcol, SCIP_Real *objvalptr)
int GCGgetNActivePricingproblemModifications(GCG *gcg, int probnr)
SCIP_RETCODE GCGmasterCreateInitialMastervars(GCG *gcg)
void GCGpricerPrintPricingStatistics(GCG *gcg, FILE *file)
SCIP_VAR ** GCGmasterGetPricedvars(GCG *gcg)
SCIP_RETCODE GCGpricerIncludePricingcb(GCG *gcg, const char *name, const char *desc, int priority, GCG_DECL_PRICINGCBFREE((*pricingcbfree)), GCG_DECL_PRICINGCBINIT((*pricingcbinit)), GCG_DECL_PRICINGCBEXIT((*pricingcbexit)), GCG_DECL_PRICINGCBINITSOL((*pricingcbinitsol)), GCG_DECL_PRICINGCBEXITSOL((*pricingcbexitsol)), GCG_DECL_PRICINGCBPREPRICING((*pricingcbprepricing)), GCG_DECL_PRICINGCBPOSTPRICING((*pricingcbpostpricing)), GCG_PRICINGCBDATA *pricingcbdata)
int GCGpricerGetNPointsProb(GCG *gcg, int probnr)
SCIP_SOL * sol
SCIP_RETCODE GCGpricerIncludeSolver(GCG *gcg, const char *name, const char *desc, int priority, SCIP_Bool heurenabled, SCIP_Bool exactenabled, GCG_DECL_SOLVERUPDATE((*solverupdate)), GCG_DECL_SOLVERSOLVE((*solversolve)), GCG_DECL_SOLVERSOLVEHEUR((*solversolveheur)), GCG_DECL_SOLVERFREE((*solverfree)), GCG_DECL_SOLVERINIT((*solverinit)), GCG_DECL_SOLVEREXIT((*solverexit)), GCG_DECL_SOLVERINITSOL((*solverinitsol)), GCG_DECL_SOLVEREXITSOL((*solverexitsol)), GCG_SOLVERDATA *solverdata)
type definitions for storing cols in a col pool
struct GCG_Colpool GCG_COLPOOL
struct SCIP_Cons SCIP_CONS
struct Gcg GCG
Definition type_gcg.h:44
struct GCG_Col GCG_COL
Definition type_gcgcol.h:44
struct GCG_VarHistory GCG_VARHISTORY
#define GCG_DECL_PRICINGCBPREPRICING(x)
#define GCG_DECL_PRICINGCBPOSTPRICING(x)
#define GCG_DECL_PRICINGCBINITSOL(x)
struct GCG_PricingcbData GCG_PRICINGCBDATA
#define GCG_DECL_PRICINGCBEXIT(x)
#define GCG_DECL_PRICINGCBINIT(x)
#define GCG_DECL_PRICINGCBEXITSOL(x)
struct GCG_Pricingcb GCG_PRICINGCB
#define GCG_DECL_PRICINGCBFREE(x)
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP
struct SCIP_Sol SCIP_SOL
type definitions for pricing problem solvers in GCG project
struct GCG_Solver GCG_SOLVER
Definition type_solver.h:51
#define GCG_DECL_SOLVERFREE(x)
Definition type_solver.h:60
#define GCG_DECL_SOLVERUPDATE(x)
#define GCG_DECL_SOLVEREXITSOL(x)
Definition type_solver.h:98
#define GCG_DECL_SOLVERINITSOL(x)
Definition type_solver.h:87
#define GCG_DECL_SOLVERSOLVE(x)
#define GCG_DECL_SOLVERINIT(x)
Definition type_solver.h:68
#define GCG_DECL_SOLVEREXIT(x)
Definition type_solver.h:76
#define GCG_DECL_SOLVERSOLVEHEUR(x)
struct GCG_SolverData GCG_SOLVERDATA
Definition type_solver.h:50
struct SCIP_Var SCIP_VAR