Scippy

SCIP

Solving Constraint Integer Programs

scip_pricer.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2019 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scip.zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file scip_pricer.h
17  * @ingroup PUBLICCOREAPI
18  * @brief public methods for variable pricer plugins
19  * @author Tobias Achterberg
20  * @author Timo Berthold
21  * @author Thorsten Koch
22  * @author Alexander Martin
23  * @author Marc Pfetsch
24  * @author Kati Wolter
25  * @author Gregor Hendel
26  * @author Robert Lion Gottwald
27  */
28 
29 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
30 
31 #ifndef __SCIP_SCIP_PRICER_H__
32 #define __SCIP_SCIP_PRICER_H__
33 
34 
35 #include "scip/def.h"
36 #include "scip/type_pricer.h"
37 #include "scip/type_result.h"
38 #include "scip/type_retcode.h"
39 #include "scip/type_scip.h"
40 
41 /* In debug mode, we include the SCIP's structure in scip.c, such that no one can access
42  * this structure except the interface methods in scip.c.
43  * In optimized mode, the structure is included in scip.h, because some of the methods
44  * are implemented as defines for performance reasons (e.g. the numerical comparisons).
45  * Additionally, the internal "set.h" is included, such that the defines in set.h are
46  * available in optimized mode.
47  */
48 #ifdef NDEBUG
49 #include "scip/struct_scip.h"
50 #include "scip/struct_stat.h"
51 #include "scip/set.h"
52 #include "scip/tree.h"
53 #include "scip/misc.h"
54 #include "scip/var.h"
55 #include "scip/cons.h"
56 #include "scip/solve.h"
57 #include "scip/debug.h"
58 #endif
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
64 /**@addtogroup PublicPricerMethods
65  *
66  * @{
67  */
68 
69 /** creates a variable pricer and includes it in SCIP
70  * To use the variable pricer for solving a problem, it first has to be activated with a call to SCIPactivatePricer().
71  * This should be done during the problem creation stage.
72  *
73  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
74  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
75  *
76  * @pre This method can be called if SCIP is in one of the following stages:
77  * - \ref SCIP_STAGE_INIT
78  * - \ref SCIP_STAGE_PROBLEM
79  *
80  * @note method has all pricer callbacks as arguments and is thus changed every time a new callback is added
81  * in future releases; consider using SCIPincludePricerBasic() and setter functions
82  * if you seek for a method which is less likely to change in future releases
83  */
84 extern
86  SCIP* scip, /**< SCIP data structure */
87  const char* name, /**< name of variable pricer */
88  const char* desc, /**< description of variable pricer */
89  int priority, /**< priority of the variable pricer */
90  SCIP_Bool delay, /**< should the pricer be delayed until no other pricers or already existing
91  * problem variables with negative reduced costs are found?
92  * if this is set to FALSE it may happen that the pricer produces columns
93  * that already exist in the problem (which are also priced in by the
94  * default problem variable pricing in the same round) */
95  SCIP_DECL_PRICERCOPY ((*pricercopy)), /**< copy method of variable pricer or NULL if you don't want to copy your plugin into sub-SCIPs */
96  SCIP_DECL_PRICERFREE ((*pricerfree)), /**< destructor of variable pricer */
97  SCIP_DECL_PRICERINIT ((*pricerinit)), /**< initialize variable pricer */
98  SCIP_DECL_PRICEREXIT ((*pricerexit)), /**< deinitialize variable pricer */
99  SCIP_DECL_PRICERINITSOL((*pricerinitsol)),/**< solving process initialization method of variable pricer */
100  SCIP_DECL_PRICEREXITSOL((*pricerexitsol)),/**< solving process deinitialization method of variable pricer */
101  SCIP_DECL_PRICERREDCOST((*pricerredcost)),/**< reduced cost pricing method of variable pricer for feasible LPs */
102  SCIP_DECL_PRICERFARKAS((*pricerfarkas)), /**< Farkas pricing method of variable pricer for infeasible LPs */
103  SCIP_PRICERDATA* pricerdata /**< variable pricer data */
104  );
105 
106 /** creates a variable pricer and includes it in SCIP with all non-fundamental callbacks set to NULL;
107  * if needed, these can be added afterwards via setter functions SCIPsetPricerCopy(), SCIPsetPricerFree(),
108  * SCIPsetPricerInity(), SCIPsetPricerExit(), SCIPsetPricerInitsol(), SCIPsetPricerExitsol(),
109  * SCIPsetPricerFarkas();
110  *
111  * To use the variable pricer for solving a problem, it first has to be activated with a call to SCIPactivatePricer().
112  * This should be done during the problem creation stage.
113  *
114  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
115  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
116  *
117  * @pre This method can be called if SCIP is in one of the following stages:
118  * - \ref SCIP_STAGE_INIT
119  * - \ref SCIP_STAGE_PROBLEM
120  *
121  * @note if you want to set all callbacks with a single method call, consider using SCIPincludePricer() instead
122  */
123 extern
125  SCIP* scip, /**< SCIP data structure */
126  SCIP_PRICER** pricerptr, /**< reference to a pricer, or NULL */
127  const char* name, /**< name of variable pricer */
128  const char* desc, /**< description of variable pricer */
129  int priority, /**< priority of the variable pricer */
130  SCIP_Bool delay, /**< should the pricer be delayed until no other pricers or already existing
131  * problem variables with negative reduced costs are found?
132  * if this is set to FALSE it may happen that the pricer produces columns
133  * that already exist in the problem (which are also priced in by the
134  * default problem variable pricing in the same round) */
135  SCIP_DECL_PRICERREDCOST((*pricerredcost)),/**< reduced cost pricing method of variable pricer for feasible LPs */
136  SCIP_DECL_PRICERFARKAS((*pricerfarkas)), /**< Farkas pricing method of variable pricer for infeasible LPs */
137  SCIP_PRICERDATA* pricerdata /**< variable pricer data */
138  );
139 
140 /** sets copy method of pricer
141  *
142  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
143  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
144  *
145  * @pre This method can be called if SCIP is in one of the following stages:
146  * - \ref SCIP_STAGE_INIT
147  * - \ref SCIP_STAGE_PROBLEM
148  */
149 extern
151  SCIP* scip, /**< SCIP data structure */
152  SCIP_PRICER* pricer, /**< pricer */
153  SCIP_DECL_PRICERCOPY ((*pricercopy)) /**< copy method of pricer or NULL if you don't want to copy your plugin into sub-SCIPs */
154  );
155 
156 /** sets destructor method of pricer
157  *
158  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
159  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
160  *
161  * @pre This method can be called if SCIP is in one of the following stages:
162  * - \ref SCIP_STAGE_INIT
163  * - \ref SCIP_STAGE_PROBLEM
164  */
165 extern
167  SCIP* scip, /**< SCIP data structure */
168  SCIP_PRICER* pricer, /**< pricer */
169  SCIP_DECL_PRICERFREE ((*pricerfree)) /**< destructor of pricer */
170  );
171 
172 /** sets initialization method of pricer
173  *
174  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
175  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
176  *
177  * @pre This method can be called if SCIP is in one of the following stages:
178  * - \ref SCIP_STAGE_INIT
179  * - \ref SCIP_STAGE_PROBLEM
180  */
181 extern
183  SCIP* scip, /**< SCIP data structure */
184  SCIP_PRICER* pricer, /**< pricer */
185  SCIP_DECL_PRICERINIT ((*pricerinit)) /**< initialize pricer */
186  );
187 
188 /** sets deinitialization method of pricer
189  *
190  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
191  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
192  *
193  * @pre This method can be called if SCIP is in one of the following stages:
194  * - \ref SCIP_STAGE_INIT
195  * - \ref SCIP_STAGE_PROBLEM
196  */
197 extern
199  SCIP* scip, /**< SCIP data structure */
200  SCIP_PRICER* pricer, /**< pricer */
201  SCIP_DECL_PRICEREXIT ((*pricerexit)) /**< deinitialize pricer */
202  );
203 
204 /** sets solving process initialization method of pricer
205  *
206  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
207  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
208  *
209  * @pre This method can be called if SCIP is in one of the following stages:
210  * - \ref SCIP_STAGE_INIT
211  * - \ref SCIP_STAGE_PROBLEM
212  */
213 extern
215  SCIP* scip, /**< SCIP data structure */
216  SCIP_PRICER* pricer, /**< pricer */
217  SCIP_DECL_PRICERINITSOL ((*pricerinitsol))/**< solving process initialization method of pricer */
218  );
219 
220 /** sets solving process deinitialization method of pricer
221  *
222  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
223  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
224  *
225  * @pre This method can be called if SCIP is in one of the following stages:
226  * - \ref SCIP_STAGE_INIT
227  * - \ref SCIP_STAGE_PROBLEM
228  */
229 extern
231  SCIP* scip, /**< SCIP data structure */
232  SCIP_PRICER* pricer, /**< pricer */
233  SCIP_DECL_PRICEREXITSOL((*pricerexitsol)) /**< solving process deinitialization method of pricer */
234  );
235 
236 /** returns the variable pricer of the given name, or NULL if not existing */
237 extern
239  SCIP* scip, /**< SCIP data structure */
240  const char* name /**< name of variable pricer */
241  );
242 
243 /** returns the array of currently available variable pricers; active pricers are in the first slots of the array */
244 extern
246  SCIP* scip /**< SCIP data structure */
247  );
248 
249 /** returns the number of currently available variable pricers */
250 extern
251 int SCIPgetNPricers(
252  SCIP* scip /**< SCIP data structure */
253  );
254 
255 /** returns the number of currently active variable pricers, that are used in the LP solving loop */
256 extern
258  SCIP* scip /**< SCIP data structure */
259  );
260 
261 /** sets the priority of a variable pricer */
262 extern
264  SCIP* scip, /**< SCIP data structure */
265  SCIP_PRICER* pricer, /**< variable pricer */
266  int priority /**< new priority of the variable pricer */
267  );
268 
269 /** activates pricer to be used for the current problem
270  * This method should be called during the problem creation stage for all pricers that are necessary to solve
271  * the problem model.
272  * The pricers are automatically deactivated when the problem is freed.
273  *
274  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
275  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
276  *
277  * @pre This method can be called if SCIP is in one of the following stages:
278  * - \ref SCIP_STAGE_PROBLEM
279  */
280 extern
282  SCIP* scip, /**< SCIP data structure */
283  SCIP_PRICER* pricer /**< variable pricer */
284  );
285 
286 /** deactivates pricer
287  *
288  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
289  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
290  *
291  * @pre This method can be called if SCIP is in one of the following stages:
292  * - \ref SCIP_STAGE_PROBLEM
293  * - \ref SCIP_STAGE_EXITSOLVE
294  */
295 extern
297  SCIP* scip, /**< SCIP data structure */
298  SCIP_PRICER* pricer /**< variable pricer */
299  );
300 
301 /* @} */
302 
303 #ifdef __cplusplus
304 }
305 #endif
306 
307 #endif
SCIP_RETCODE SCIPsetPricerPriority(SCIP *scip, SCIP_PRICER *pricer, int priority)
Definition: scip_pricer.c:429
internal methods for branch and bound tree
#define SCIP_DECL_PRICEREXIT(x)
Definition: type_pricer.h:70
int SCIPgetNActivePricers(SCIP *scip)
Definition: scip_pricer.c:418
SCIP_PRICER * SCIPfindPricer(SCIP *scip, const char *name)
Definition: scip_pricer.c:381
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
type definitions for return codes for SCIP methods
#define SCIP_DECL_PRICEREXITSOL(x)
Definition: type_pricer.h:92
SCIP_RETCODE SCIPsetPricerExit(SCIP *scip, SCIP_PRICER *pricer, SCIP_DECL_PRICEREXIT((*pricerexit)))
Definition: scip_pricer.c:317
SCIP_RETCODE SCIPsetPricerExitsol(SCIP *scip, SCIP_PRICER *pricer, SCIP_DECL_PRICEREXITSOL((*pricerexitsol)))
Definition: scip_pricer.c:365
#define SCIP_DECL_PRICERCOPY(x)
Definition: type_pricer.h:46
SCIP_RETCODE SCIPdeactivatePricer(SCIP *scip, SCIP_PRICER *pricer)
Definition: scip_pricer.c:475
type definitions for variable pricers
SCIP_RETCODE SCIPincludePricerBasic(SCIP *scip, SCIP_PRICER **pricerptr, const char *name, const char *desc, int priority, SCIP_Bool delay, SCIP_DECL_PRICERREDCOST((*pricerredcost)), SCIP_DECL_PRICERFARKAS((*pricerfarkas)), SCIP_PRICERDATA *pricerdata)
Definition: scip_pricer.c:197
type definitions for SCIP&#39;s main datastructure
internal miscellaneous methods
SCIP_DECL_PRICERINIT(ObjPricerVRP::scip_init)
Definition: pricer_vrp.cpp:74
internal methods for global SCIP settings
SCIP main data structure.
SCIP_RETCODE SCIPsetPricerInit(SCIP *scip, SCIP_PRICER *pricer, SCIP_DECL_PRICERINIT((*pricerinit)))
Definition: scip_pricer.c:293
SCIP_DECL_PRICERFARKAS(ObjPricerVRP::scip_farkas)
Definition: pricer_vrp.cpp:237
internal methods for problem variables
SCIP_RETCODE SCIPactivatePricer(SCIP *scip, SCIP_PRICER *pricer)
Definition: scip_pricer.c:454
SCIP_DECL_PRICERREDCOST(ObjPricerVRP::scip_redcost)
Definition: pricer_vrp.cpp:216
#define SCIP_Bool
Definition: def.h:69
#define SCIP_DECL_PRICERINITSOL(x)
Definition: type_pricer.h:81
int SCIPgetNPricers(SCIP *scip)
Definition: scip_pricer.c:407
methods for debugging
SCIP_RETCODE SCIPsetPricerFree(SCIP *scip, SCIP_PRICER *pricer, SCIP_DECL_PRICERFREE((*pricerfree)))
Definition: scip_pricer.c:269
datastructures for problem statistics
SCIP_RETCODE SCIPsetPricerInitsol(SCIP *scip, SCIP_PRICER *pricer, SCIP_DECL_PRICERINITSOL((*pricerinitsol)))
Definition: scip_pricer.c:341
internal methods for main solving loop and node processing
result codes for SCIP callback methods
SCIP_RETCODE SCIPincludePricer(SCIP *scip, const char *name, const char *desc, int priority, SCIP_Bool delay, SCIP_DECL_PRICERCOPY((*pricercopy)), SCIP_DECL_PRICERFREE((*pricerfree)), SCIP_DECL_PRICERINIT((*pricerinit)), SCIP_DECL_PRICEREXIT((*pricerexit)), SCIP_DECL_PRICERINITSOL((*pricerinitsol)), SCIP_DECL_PRICEREXITSOL((*pricerexitsol)), SCIP_DECL_PRICERREDCOST((*pricerredcost)), SCIP_DECL_PRICERFARKAS((*pricerfarkas)), SCIP_PRICERDATA *pricerdata)
Definition: scip_pricer.c:139
internal methods for constraints and constraint handlers
struct SCIP_PricerData SCIP_PRICERDATA
Definition: type_pricer.h:36
#define SCIP_DECL_PRICERFREE(x)
Definition: type_pricer.h:54
SCIP_RETCODE SCIPsetPricerCopy(SCIP *scip, SCIP_PRICER *pricer, SCIP_DECL_PRICERCOPY((*pricercopy)))
Definition: scip_pricer.c:245
common defines and data types used in all packages of SCIP
SCIP_PRICER ** SCIPgetPricers(SCIP *scip)
Definition: scip_pricer.c:394