Scippy

SCIP

Solving Constraint Integer Programs

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-2023 Zuse Institute Berlin (ZIB) */
7 /* */
8 /* Licensed under the Apache License, Version 2.0 (the "License"); */
9 /* you may not use this file except in compliance with the License. */
10 /* You may obtain a copy of the License at */
11 /* */
12 /* http://www.apache.org/licenses/LICENSE-2.0 */
13 /* */
14 /* Unless required by applicable law or agreed to in writing, software */
15 /* distributed under the License is distributed on an "AS IS" BASIS, */
16 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17 /* See the License for the specific language governing permissions and */
18 /* limitations under the License. */
19 /* */
20 /* You should have received a copy of the Apache-2.0 license */
21 /* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22 /* */
23 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24 
25 /**@file pricer.h
26  * @ingroup INTERNALAPI
27  * @brief internal methods for variable pricers
28  * @author Tobias Achterberg
29  */
30 
31 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32 
33 #ifndef __SCIP_PRICER_H__
34 #define __SCIP_PRICER_H__
35 
36 
37 #include "scip/def.h"
38 #include "blockmemshell/memory.h"
39 #include "scip/type_retcode.h"
40 #include "scip/type_result.h"
41 #include "scip/type_set.h"
42 #include "scip/type_lp.h"
43 #include "scip/type_prob.h"
44 #include "scip/type_pricestore.h"
45 #include "scip/type_pricer.h"
46 #include "scip/pub_pricer.h"
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 
53 /** copies the given pricer to a new scip */
55  SCIP_PRICER* pricer, /**< pricer */
56  SCIP_SET* set, /**< SCIP_SET of SCIP to copy to */
57  SCIP_Bool* valid /**< was the copying process valid? */
58  );
59 
60 /** creates a variable pricer */
62  SCIP_PRICER** pricer, /**< pointer to variable pricer data structure */
63  SCIP_SET* set, /**< global SCIP settings */
64  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
65  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
66  const char* name, /**< name of variable pricer */
67  const char* desc, /**< description of variable pricer */
68  int priority, /**< priority of the variable pricer */
69  SCIP_Bool delay, /**< should the pricer be delayed until no other pricers or already existing
70  * problem variables with negative reduced costs are found */
71  SCIP_DECL_PRICERCOPY ((*pricercopy)), /**< copy method of pricer or NULL if you don't want to copy your plugin into sub-SCIPs */
72  SCIP_DECL_PRICERFREE ((*pricerfree)), /**< destructor of variable pricer */
73  SCIP_DECL_PRICERINIT ((*pricerinit)), /**< initialize variable pricer */
74  SCIP_DECL_PRICEREXIT ((*pricerexit)), /**< deinitialize variable pricer */
75  SCIP_DECL_PRICERINITSOL((*pricerinitsol)),/**< solving process initialization method of variable pricer */
76  SCIP_DECL_PRICEREXITSOL((*pricerexitsol)),/**< solving process deinitialization method of variable pricer */
77  SCIP_DECL_PRICERREDCOST((*pricerredcost)),/**< reduced cost pricing method of variable pricer for feasible LPs */
78  SCIP_DECL_PRICERFARKAS((*pricerfarkas)), /**< Farkas pricing method of variable pricer for infeasible LPs */
79  SCIP_PRICERDATA* pricerdata /**< variable pricer data */
80  );
81 
82 /** calls destructor and frees memory of variable pricer */
84  SCIP_PRICER** pricer, /**< pointer to variable pricer data structure */
85  SCIP_SET* set /**< global SCIP settings */
86  );
87 
88 /** initializes variable pricer */
90  SCIP_PRICER* pricer, /**< variable pricer */
91  SCIP_SET* set /**< global SCIP settings */
92  );
93 
94 /** calls exit method of variable pricer */
96  SCIP_PRICER* pricer, /**< variable pricer */
97  SCIP_SET* set /**< global SCIP settings */
98  );
99 
100 /** informs variable pricer that the branch and bound process is being started */
102  SCIP_PRICER* pricer, /**< variable pricer */
103  SCIP_SET* set /**< global SCIP settings */
104  );
105 
106 /** informs variable pricer that the branch and bound process data is being freed */
108  SCIP_PRICER* pricer, /**< variable pricer */
109  SCIP_SET* set /**< global SCIP settings */
110  );
111 
112 /** activates pricer such that it is called in LP solving loop */
114  SCIP_PRICER* pricer, /**< variable pricer */
115  SCIP_SET* set /**< global SCIP settings */
116  );
117 
118 /** deactivates pricer such that it is no longer called in LP solving loop */
120  SCIP_PRICER* pricer, /**< variable pricer */
121  SCIP_SET* set /**< global SCIP settings */
122  );
123 
124 /** enables or disables all clocks of \p pricer, depending on the value of the flag */
126  SCIP_PRICER* pricer, /**< the pricer for which all clocks should be enabled or disabled */
127  SCIP_Bool enable /**< should the clocks of the pricer be enabled? */
128  );
129 
130 /** calls reduced cost pricing method of variable pricer */
132  SCIP_PRICER* pricer, /**< variable pricer */
133  SCIP_SET* set, /**< global SCIP settings */
134  SCIP_PROB* prob, /**< transformed problem */
135  SCIP_Real* lowerbound, /**< local lower bound computed by the pricer */
136  SCIP_Bool* stopearly, /**< should pricing be stopped, although new variables were added? */
137  SCIP_RESULT* result /**< result of the pricing process */
138  );
139 
140 /** calls Farkas pricing method of variable pricer */
142  SCIP_PRICER* pricer, /**< variable pricer */
143  SCIP_SET* set, /**< global SCIP settings */
144  SCIP_PROB* prob, /**< transformed problem */
145  SCIP_RESULT* result /**< result of the pricing process */
146  );
147 
148 /** depending on the LP's solution status, calls reduced cost or Farkas pricing method of variable pricer */
150  SCIP_PRICER* pricer, /**< variable pricer */
151  SCIP_SET* set, /**< global SCIP settings */
152  SCIP_PROB* prob, /**< transformed problem */
153  SCIP_LP* lp, /**< LP data */
154  SCIP_PRICESTORE* pricestore, /**< pricing storage */
155  SCIP_Real* lowerbound, /**< local lower bound computed by the pricer */
156  SCIP_Bool* stopearly, /**< should pricing be stopped, although new variables were added? */
157  SCIP_RESULT* result /**< result of the pricing process */
158  );
159 
160 /** sets priority of variable pricer */
162  SCIP_PRICER* pricer, /**< variable pricer */
163  SCIP_SET* set, /**< global SCIP settings */
164  int priority /**< new priority of the variable pricer */
165  );
166 
167 /** sets copy callback of pricer */
168 void SCIPpricerSetCopy(
169  SCIP_PRICER* pricer, /**< variable pricer */
170  SCIP_DECL_PRICERCOPY ((*pricercopy)) /**< copy callback of pricer */
171  );
172 
173 /** sets destructor callback of pricer */
174 void SCIPpricerSetFree(
175  SCIP_PRICER* pricer, /**< pricer */
176  SCIP_DECL_PRICERFREE ((*pricerfree)) /**< destructor of pricer */
177  );
178 
179 /** sets initialization callback of pricer */
180 void SCIPpricerSetInit(
181  SCIP_PRICER* pricer, /**< pricer */
182  SCIP_DECL_PRICERINIT ((*pricerinit)) /**< initialize pricer */
183  );
184 
185 /** sets deinitialization callback of pricer */
186 void SCIPpricerSetExit(
187  SCIP_PRICER* pricer, /**< pricer */
188  SCIP_DECL_PRICEREXIT ((*pricerexit)) /**< deinitialize pricer */
189  );
190 
191 /** sets solving process initialization callback of pricer */
193  SCIP_PRICER* pricer, /**< pricer */
194  SCIP_DECL_PRICERINITSOL ((*pricerinitsol))/**< solving process initialization callback of pricer */
195  );
196 
197 /** sets solving process deinitialization callback of pricer */
199  SCIP_PRICER* pricer, /**< pricer */
200  SCIP_DECL_PRICEREXITSOL ((*pricerexitsol))/**< solving process deinitialization callback of pricer */
201  );
202 
203 #ifdef __cplusplus
204 }
205 #endif
206 
207 #endif
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:61
void SCIPpricerSetFree(SCIP_PRICER *pricer, SCIP_DECL_PRICERFREE((*pricerfree)))
Definition: pricer.c:542
SCIP_RETCODE SCIPpricerRedcost(SCIP_PRICER *pricer, SCIP_SET *set, SCIP_PROB *prob, SCIP_Real *lowerbound, SCIP_Bool *stopearly, SCIP_RESULT *result)
Definition: pricer.c:392
SCIP_RETCODE SCIPpricerInit(SCIP_PRICER *pricer, SCIP_SET *set)
Definition: pricer.c:234
void SCIPpricerSetExit(SCIP_PRICER *pricer, SCIP_DECL_PRICEREXIT((*pricerexit)))
Definition: pricer.c:564
#define SCIP_DECL_PRICEREXIT(x)
Definition: type_pricer.h:79
void SCIPpricerEnableOrDisableClocks(SCIP_PRICER *pricer, SCIP_Bool enable)
Definition: pricer.c:681
SCIP_RETCODE SCIPpricerFree(SCIP_PRICER **pricer, SCIP_SET *set)
Definition: pricer.c:207
type definitions for storing priced variables
void SCIPpricerSetInit(SCIP_PRICER *pricer, SCIP_DECL_PRICERINIT((*pricerinit)))
Definition: pricer.c:553
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
type definitions for global SCIP settings
type definitions for return codes for SCIP methods
#define SCIP_DECL_PRICEREXITSOL(x)
Definition: type_pricer.h:101
#define SCIP_DECL_PRICERCOPY(x)
Definition: type_pricer.h:55
type definitions for LP management
type definitions for variable pricers
SCIP_RETCODE SCIPpricerActivate(SCIP_PRICER *pricer, SCIP_SET *set)
Definition: pricer.c:353
void SCIPpricerSetPriority(SCIP_PRICER *pricer, SCIP_SET *set, int priority)
Definition: pricer.c:627
SCIP_DECL_PRICERINIT(ObjPricerVRP::scip_init)
Definition: pricer_vrp.cpp:83
SCIP_RETCODE SCIPpricerCopyInclude(SCIP_PRICER *pricer, SCIP_SET *set, SCIP_Bool *valid)
Definition: pricer.c:87
SCIP_DECL_PRICERFARKAS(ObjPricerVRP::scip_farkas)
Definition: pricer_vrp.cpp:246
SCIP_RETCODE SCIPpricerExit(SCIP_PRICER *pricer, SCIP_SET *set)
Definition: pricer.c:274
SCIP_DECL_PRICERREDCOST(ObjPricerVRP::scip_redcost)
Definition: pricer_vrp.cpp:225
#define SCIP_Bool
Definition: def.h:93
#define SCIP_DECL_PRICERINITSOL(x)
Definition: type_pricer.h:90
void SCIPpricerSetCopy(SCIP_PRICER *pricer, SCIP_DECL_PRICERCOPY((*pricercopy)))
Definition: pricer.c:531
public methods for variable pricers
type definitions for storing and manipulating the main problem
SCIP_RETCODE SCIPpricerCreate(SCIP_PRICER **pricer, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, 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: pricer.c:173
SCIP_RETCODE SCIPpricerExec(SCIP_PRICER *pricer, SCIP_SET *set, SCIP_PROB *prob, SCIP_LP *lp, SCIP_PRICESTORE *pricestore, SCIP_Real *lowerbound, SCIP_Bool *stopearly, SCIP_RESULT *result)
Definition: pricer.c:471
SCIP_RETCODE SCIPpricerExitsol(SCIP_PRICER *pricer, SCIP_SET *set)
Definition: pricer.c:329
#define SCIP_Real
Definition: def.h:186
result codes for SCIP callback methods
SCIP_RETCODE SCIPpricerFarkas(SCIP_PRICER *pricer, SCIP_SET *set, SCIP_PROB *prob, SCIP_RESULT *result)
Definition: pricer.c:432
SCIP_RETCODE SCIPpricerDeactivate(SCIP_PRICER *pricer, SCIP_SET *set)
Definition: pricer.c:373
void SCIPpricerSetExitsol(SCIP_PRICER *pricer, SCIP_DECL_PRICEREXITSOL((*pricerexitsol)))
Definition: pricer.c:586
void SCIPpricerSetInitsol(SCIP_PRICER *pricer, SCIP_DECL_PRICERINITSOL((*pricerinitsol)))
Definition: pricer.c:575
struct SCIP_PricerData SCIP_PRICERDATA
Definition: type_pricer.h:45
#define SCIP_DECL_PRICERFREE(x)
Definition: type_pricer.h:63
common defines and data types used in all packages of SCIP
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:439
SCIP_RETCODE SCIPpricerInitsol(SCIP_PRICER *pricer, SCIP_SET *set)
Definition: pricer.c:305
memory allocation routines