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 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /**@addtogroup PublicPricerMethods
46  *
47  * @{
48  */
49 
50 /** creates a variable pricer and includes it in SCIP
51  * To use the variable pricer for solving a problem, it first has to be activated with a call to SCIPactivatePricer().
52  * This should be done during the problem creation stage.
53  *
54  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
55  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
56  *
57  * @pre This method can be called if SCIP is in one of the following stages:
58  * - \ref SCIP_STAGE_INIT
59  * - \ref SCIP_STAGE_PROBLEM
60  *
61  * @note method has all pricer callbacks as arguments and is thus changed every time a new callback is added
62  * in future releases; consider using SCIPincludePricerBasic() and setter functions
63  * if you seek for a method which is less likely to change in future releases
64  */
67  SCIP* scip, /**< SCIP data structure */
68  const char* name, /**< name of variable pricer */
69  const char* desc, /**< description of variable pricer */
70  int priority, /**< priority of the variable pricer */
71  SCIP_Bool delay, /**< should the pricer be delayed until no other pricers or already existing
72  * problem variables with negative reduced costs are found?
73  * if this is set to FALSE it may happen that the pricer produces columns
74  * that already exist in the problem (which are also priced in by the
75  * default problem variable pricing in the same round) */
76  SCIP_DECL_PRICERCOPY ((*pricercopy)), /**< copy method of variable pricer or NULL if you don't want to copy your plugin into sub-SCIPs */
77  SCIP_DECL_PRICERFREE ((*pricerfree)), /**< destructor of variable pricer */
78  SCIP_DECL_PRICERINIT ((*pricerinit)), /**< initialize variable pricer */
79  SCIP_DECL_PRICEREXIT ((*pricerexit)), /**< deinitialize variable pricer */
80  SCIP_DECL_PRICERINITSOL((*pricerinitsol)),/**< solving process initialization method of variable pricer */
81  SCIP_DECL_PRICEREXITSOL((*pricerexitsol)),/**< solving process deinitialization method of variable pricer */
82  SCIP_DECL_PRICERREDCOST((*pricerredcost)),/**< reduced cost pricing method of variable pricer for feasible LPs */
83  SCIP_DECL_PRICERFARKAS((*pricerfarkas)), /**< Farkas pricing method of variable pricer for infeasible LPs */
84  SCIP_PRICERDATA* pricerdata /**< variable pricer data */
85  );
86 
87 /** creates a variable pricer and includes it in SCIP with all non-fundamental callbacks set to NULL;
88  * if needed, these can be added afterwards via setter functions SCIPsetPricerCopy(), SCIPsetPricerFree(),
89  * SCIPsetPricerInity(), SCIPsetPricerExit(), SCIPsetPricerInitsol(), SCIPsetPricerExitsol(),
90  * SCIPsetPricerFarkas();
91  *
92  * To use the variable pricer for solving a problem, it first has to be activated with a call to SCIPactivatePricer().
93  * This should be done during the problem creation stage.
94  *
95  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
96  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
97  *
98  * @pre This method can be called if SCIP is in one of the following stages:
99  * - \ref SCIP_STAGE_INIT
100  * - \ref SCIP_STAGE_PROBLEM
101  *
102  * @note if you want to set all callbacks with a single method call, consider using SCIPincludePricer() instead
103  */
106  SCIP* scip, /**< SCIP data structure */
107  SCIP_PRICER** pricerptr, /**< reference to a pricer, or NULL */
108  const char* name, /**< name of variable pricer */
109  const char* desc, /**< description of variable pricer */
110  int priority, /**< priority of the variable pricer */
111  SCIP_Bool delay, /**< should the pricer be delayed until no other pricers or already existing
112  * problem variables with negative reduced costs are found?
113  * if this is set to FALSE it may happen that the pricer produces columns
114  * that already exist in the problem (which are also priced in by the
115  * default problem variable pricing in the same round) */
116  SCIP_DECL_PRICERREDCOST((*pricerredcost)),/**< reduced cost pricing method of variable pricer for feasible LPs */
117  SCIP_DECL_PRICERFARKAS((*pricerfarkas)), /**< Farkas pricing method of variable pricer for infeasible LPs */
118  SCIP_PRICERDATA* pricerdata /**< variable pricer data */
119  );
120 
121 /** sets copy method of pricer
122  *
123  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
124  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
125  *
126  * @pre This method can be called if SCIP is in one of the following stages:
127  * - \ref SCIP_STAGE_INIT
128  * - \ref SCIP_STAGE_PROBLEM
129  */
132  SCIP* scip, /**< SCIP data structure */
133  SCIP_PRICER* pricer, /**< pricer */
134  SCIP_DECL_PRICERCOPY ((*pricercopy)) /**< copy method of pricer or NULL if you don't want to copy your plugin into sub-SCIPs */
135  );
136 
137 /** sets destructor method of pricer
138  *
139  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
140  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
141  *
142  * @pre This method can be called if SCIP is in one of the following stages:
143  * - \ref SCIP_STAGE_INIT
144  * - \ref SCIP_STAGE_PROBLEM
145  */
148  SCIP* scip, /**< SCIP data structure */
149  SCIP_PRICER* pricer, /**< pricer */
150  SCIP_DECL_PRICERFREE ((*pricerfree)) /**< destructor of pricer */
151  );
152 
153 /** sets initialization method of pricer
154  *
155  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
156  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
157  *
158  * @pre This method can be called if SCIP is in one of the following stages:
159  * - \ref SCIP_STAGE_INIT
160  * - \ref SCIP_STAGE_PROBLEM
161  */
164  SCIP* scip, /**< SCIP data structure */
165  SCIP_PRICER* pricer, /**< pricer */
166  SCIP_DECL_PRICERINIT ((*pricerinit)) /**< initialize pricer */
167  );
168 
169 /** sets deinitialization method of pricer
170  *
171  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
172  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
173  *
174  * @pre This method can be called if SCIP is in one of the following stages:
175  * - \ref SCIP_STAGE_INIT
176  * - \ref SCIP_STAGE_PROBLEM
177  */
180  SCIP* scip, /**< SCIP data structure */
181  SCIP_PRICER* pricer, /**< pricer */
182  SCIP_DECL_PRICEREXIT ((*pricerexit)) /**< deinitialize pricer */
183  );
184 
185 /** sets solving process initialization method of pricer
186  *
187  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
188  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
189  *
190  * @pre This method can be called if SCIP is in one of the following stages:
191  * - \ref SCIP_STAGE_INIT
192  * - \ref SCIP_STAGE_PROBLEM
193  */
196  SCIP* scip, /**< SCIP data structure */
197  SCIP_PRICER* pricer, /**< pricer */
198  SCIP_DECL_PRICERINITSOL ((*pricerinitsol))/**< solving process initialization method of pricer */
199  );
200 
201 /** sets solving process deinitialization method of pricer
202  *
203  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
204  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
205  *
206  * @pre This method can be called if SCIP is in one of the following stages:
207  * - \ref SCIP_STAGE_INIT
208  * - \ref SCIP_STAGE_PROBLEM
209  */
212  SCIP* scip, /**< SCIP data structure */
213  SCIP_PRICER* pricer, /**< pricer */
214  SCIP_DECL_PRICEREXITSOL((*pricerexitsol)) /**< solving process deinitialization method of pricer */
215  );
216 
217 /** returns the variable pricer of the given name, or NULL if not existing */
220  SCIP* scip, /**< SCIP data structure */
221  const char* name /**< name of variable pricer */
222  );
223 
224 /** returns the array of currently available variable pricers; active pricers are in the first slots of the array */
227  SCIP* scip /**< SCIP data structure */
228  );
229 
230 /** returns the number of currently available variable pricers */
232 int SCIPgetNPricers(
233  SCIP* scip /**< SCIP data structure */
234  );
235 
236 /** returns the number of currently active variable pricers, that are used in the LP solving loop */
239  SCIP* scip /**< SCIP data structure */
240  );
241 
242 /** sets the priority of a variable pricer */
245  SCIP* scip, /**< SCIP data structure */
246  SCIP_PRICER* pricer, /**< variable pricer */
247  int priority /**< new priority of the variable pricer */
248  );
249 
250 /** activates pricer to be used for the current problem
251  * This method should be called during the problem creation stage for all pricers that are necessary to solve
252  * the problem model.
253  * The pricers are automatically deactivated when the problem is freed.
254  *
255  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
256  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
257  *
258  * @pre This method can be called if SCIP is in one of the following stages:
259  * - \ref SCIP_STAGE_PROBLEM
260  */
263  SCIP* scip, /**< SCIP data structure */
264  SCIP_PRICER* pricer /**< variable pricer */
265  );
266 
267 /** deactivates pricer
268  *
269  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
270  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
271  *
272  * @pre This method can be called if SCIP is in one of the following stages:
273  * - \ref SCIP_STAGE_PROBLEM
274  * - \ref SCIP_STAGE_EXITSOLVE
275  */
278  SCIP* scip, /**< SCIP data structure */
279  SCIP_PRICER* pricer /**< variable pricer */
280  );
281 
282 /* @} */
283 
284 #ifdef __cplusplus
285 }
286 #endif
287 
288 #endif
SCIP_EXPORT int SCIPgetNPricers(SCIP *scip)
Definition: scip_pricer.c:327
SCIP_EXPORT SCIP_RETCODE SCIPsetPricerInit(SCIP *scip, SCIP_PRICER *pricer, SCIP_DECL_PRICERINIT((*pricerinit)))
Definition: scip_pricer.c:213
#define SCIP_EXPORT
Definition: def.h:98
#define SCIP_DECL_PRICEREXIT(x)
Definition: type_pricer.h:70
SCIP_EXPORT SCIP_RETCODE SCIPsetPricerFree(SCIP *scip, SCIP_PRICER *pricer, SCIP_DECL_PRICERFREE((*pricerfree)))
Definition: scip_pricer.c:189
SCIP_EXPORT SCIP_PRICER * SCIPfindPricer(SCIP *scip, const char *name)
Definition: scip_pricer.c:301
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_EXPORT SCIP_PRICER ** SCIPgetPricers(SCIP *scip)
Definition: scip_pricer.c:314
type definitions for return codes for SCIP methods
#define SCIP_DECL_PRICEREXITSOL(x)
Definition: type_pricer.h:92
#define SCIP_DECL_PRICERCOPY(x)
Definition: type_pricer.h:46
SCIP_EXPORT SCIP_RETCODE SCIPsetPricerCopy(SCIP *scip, SCIP_PRICER *pricer, SCIP_DECL_PRICERCOPY((*pricercopy)))
Definition: scip_pricer.c:165
SCIP_EXPORT SCIP_RETCODE SCIPdeactivatePricer(SCIP *scip, SCIP_PRICER *pricer)
Definition: scip_pricer.c:395
type definitions for variable pricers
SCIP_EXPORT 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:59
type definitions for SCIP&#39;s main datastructure
SCIP_EXPORT SCIP_RETCODE SCIPsetPricerExitsol(SCIP *scip, SCIP_PRICER *pricer, SCIP_DECL_PRICEREXITSOL((*pricerexitsol)))
Definition: scip_pricer.c:285
SCIP_DECL_PRICERINIT(ObjPricerVRP::scip_init)
Definition: pricer_vrp.cpp:74
SCIP_EXPORT SCIP_RETCODE SCIPsetPricerInitsol(SCIP *scip, SCIP_PRICER *pricer, SCIP_DECL_PRICERINITSOL((*pricerinitsol)))
Definition: scip_pricer.c:261
SCIP_DECL_PRICERFARKAS(ObjPricerVRP::scip_farkas)
Definition: pricer_vrp.cpp:237
SCIP_DECL_PRICERREDCOST(ObjPricerVRP::scip_redcost)
Definition: pricer_vrp.cpp:216
#define SCIP_Bool
Definition: def.h:70
#define SCIP_DECL_PRICERINITSOL(x)
Definition: type_pricer.h:81
SCIP_EXPORT 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:117
SCIP_EXPORT int SCIPgetNActivePricers(SCIP *scip)
Definition: scip_pricer.c:338
SCIP_EXPORT SCIP_RETCODE SCIPsetPricerPriority(SCIP *scip, SCIP_PRICER *pricer, int priority)
Definition: scip_pricer.c:349
result codes for SCIP callback methods
SCIP_EXPORT SCIP_RETCODE SCIPsetPricerExit(SCIP *scip, SCIP_PRICER *pricer, SCIP_DECL_PRICEREXIT((*pricerexit)))
Definition: scip_pricer.c:237
struct SCIP_PricerData SCIP_PRICERDATA
Definition: type_pricer.h:36
SCIP_EXPORT SCIP_RETCODE SCIPactivatePricer(SCIP *scip, SCIP_PRICER *pricer)
Definition: scip_pricer.c:374
#define SCIP_DECL_PRICERFREE(x)
Definition: type_pricer.h:54
common defines and data types used in all packages of SCIP