1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /*                                                                           */
3 /*                  This file is part of the program and library             */
4 /*         SCIP --- Solving Constraint Integer Programs                      */
5 /*                                                                           */
6 /*    Copyright (C) 2002-2021 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 scipopt.org.         */
13 /*                                                                           */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file   pricer.h
17  * @ingroup INTERNALAPI
18  * @brief  internal methods for variable pricers
19  * @author Tobias Achterberg
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_PRICER_H__
25 #define __SCIP_PRICER_H__
26 
27 
28 #include "scip/def.h"
29 #include "blockmemshell/memory.h"
30 #include "scip/type_retcode.h"
31 #include "scip/type_result.h"
32 #include "scip/type_set.h"
33 #include "scip/type_lp.h"
34 #include "scip/type_prob.h"
35 #include "scip/type_pricestore.h"
36 #include "scip/type_pricer.h"
37 #include "scip/pub_pricer.h"
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 
44 /** copies the given pricer to a new scip */
45 SCIP_RETCODE SCIPpricerCopyInclude(
46    SCIP_PRICER*          pricer,             /**< pricer */
47    SCIP_SET*             set,                /**< SCIP_SET of SCIP to copy to */
48    SCIP_Bool*            valid               /**< was the copying process valid? */
49    );
50 
51 /** creates a variable pricer */
52 SCIP_RETCODE SCIPpricerCreate(
53    SCIP_PRICER**         pricer,             /**< pointer to variable pricer data structure */
54    SCIP_SET*             set,                /**< global SCIP settings */
55    SCIP_MESSAGEHDLR*     messagehdlr,        /**< message handler */
56    BMS_BLKMEM*           blkmem,             /**< block memory for parameter settings */
57    const char*           name,               /**< name of variable pricer */
58    const char*           desc,               /**< description of variable pricer */
59    int                   priority,           /**< priority of the variable pricer */
60    SCIP_Bool             delay,              /**< should the pricer be delayed until no other pricers or already existing
61                                               *   problem variables with negative reduced costs are found */
62    SCIP_DECL_PRICERCOPY  ((*pricercopy)),    /**< copy method of pricer or NULL if you don't want to copy your plugin into sub-SCIPs */
63    SCIP_DECL_PRICERFREE  ((*pricerfree)),    /**< destructor of variable pricer */
64    SCIP_DECL_PRICERINIT  ((*pricerinit)),    /**< initialize variable pricer */
65    SCIP_DECL_PRICEREXIT  ((*pricerexit)),    /**< deinitialize variable pricer */
66    SCIP_DECL_PRICERINITSOL((*pricerinitsol)),/**< solving process initialization method of variable pricer */
67    SCIP_DECL_PRICEREXITSOL((*pricerexitsol)),/**< solving process deinitialization method of variable pricer */
68    SCIP_DECL_PRICERREDCOST((*pricerredcost)),/**< reduced cost pricing method of variable pricer for feasible LPs */
69    SCIP_DECL_PRICERFARKAS((*pricerfarkas)),  /**< Farkas pricing method of variable pricer for infeasible LPs */
70    SCIP_PRICERDATA*      pricerdata          /**< variable pricer data */
71    );
72 
73 /** calls destructor and frees memory of variable pricer */
74 SCIP_RETCODE SCIPpricerFree(
75    SCIP_PRICER**         pricer,             /**< pointer to variable pricer data structure */
76    SCIP_SET*             set                 /**< global SCIP settings */
77    );
78 
79 /** initializes variable pricer */
80 SCIP_RETCODE SCIPpricerInit(
81    SCIP_PRICER*          pricer,             /**< variable pricer */
82    SCIP_SET*             set                 /**< global SCIP settings */
83    );
84 
85 /** calls exit method of variable pricer */
86 SCIP_RETCODE SCIPpricerExit(
87    SCIP_PRICER*          pricer,             /**< variable pricer */
88    SCIP_SET*             set                 /**< global SCIP settings */
89    );
90 
91 /** informs variable pricer that the branch and bound process is being started */
92 SCIP_RETCODE SCIPpricerInitsol(
93    SCIP_PRICER*          pricer,             /**< variable pricer */
94    SCIP_SET*             set                 /**< global SCIP settings */
95    );
96 
97 /** informs variable pricer that the branch and bound process data is being freed */
98 SCIP_RETCODE SCIPpricerExitsol(
99    SCIP_PRICER*          pricer,             /**< variable pricer */
100    SCIP_SET*             set                 /**< global SCIP settings */
101    );
102 
103 /** activates pricer such that it is called in LP solving loop */
104 SCIP_RETCODE SCIPpricerActivate(
105    SCIP_PRICER*          pricer,             /**< variable pricer */
106    SCIP_SET*             set                 /**< global SCIP settings */
107    );
108 
109 /** deactivates pricer such that it is no longer called in LP solving loop */
110 SCIP_RETCODE SCIPpricerDeactivate(
111    SCIP_PRICER*          pricer,             /**< variable pricer */
112    SCIP_SET*             set                 /**< global SCIP settings */
113    );
114 
115 /** enables or disables all clocks of \p pricer, depending on the value of the flag */
116 void SCIPpricerEnableOrDisableClocks(
117    SCIP_PRICER*          pricer,             /**< the pricer for which all clocks should be enabled or disabled */
118    SCIP_Bool             enable              /**< should the clocks of the pricer be enabled? */
119    );
120 
121 /** calls reduced cost pricing method of variable pricer */
122 SCIP_RETCODE SCIPpricerRedcost(
123    SCIP_PRICER*          pricer,             /**< variable pricer */
124    SCIP_SET*             set,                /**< global SCIP settings */
125    SCIP_PROB*            prob,               /**< transformed problem */
126    SCIP_Real*            lowerbound,         /**< local lower bound computed by the pricer */
127    SCIP_Bool*            stopearly,          /**< should pricing be stopped, although new variables were added? */
128    SCIP_RESULT*          result              /**< result of the pricing process */
129    );
130 
131 /** calls Farkas pricing method of variable pricer */
132 SCIP_RETCODE SCIPpricerFarkas(
133    SCIP_PRICER*          pricer,             /**< variable pricer */
134    SCIP_SET*             set,                /**< global SCIP settings */
135    SCIP_PROB*            prob,               /**< transformed problem */
136    SCIP_RESULT*          result              /**< result of the pricing process */
137    );
138 
139 /** depending on the LP's solution status, calls reduced cost or Farkas pricing method of variable pricer */
140 SCIP_RETCODE SCIPpricerExec(
141    SCIP_PRICER*          pricer,             /**< variable pricer */
142    SCIP_SET*             set,                /**< global SCIP settings */
143    SCIP_PROB*            prob,               /**< transformed problem */
144    SCIP_LP*              lp,                 /**< LP data */
145    SCIP_PRICESTORE*      pricestore,         /**< pricing storage */
146    SCIP_Real*            lowerbound,         /**< local lower bound computed by the pricer */
147    SCIP_Bool*            stopearly,          /**< should pricing be stopped, although new variables were added? */
148    SCIP_RESULT*          result              /**< result of the pricing process */
149    );
150 
151 /** sets priority of variable pricer */
152 void SCIPpricerSetPriority(
153    SCIP_PRICER*          pricer,             /**< variable pricer */
154    SCIP_SET*             set,                /**< global SCIP settings */
155    int                   priority            /**< new priority of the variable pricer */
156    );
157 
158 /** sets copy callback of pricer */
159 void SCIPpricerSetCopy(
160    SCIP_PRICER*          pricer,             /**< variable pricer */
161    SCIP_DECL_PRICERCOPY  ((*pricercopy))     /**< copy callback of pricer */
162    );
163 
164 /** sets destructor callback of pricer */
165 void SCIPpricerSetFree(
166    SCIP_PRICER*          pricer,             /**< pricer */
167    SCIP_DECL_PRICERFREE  ((*pricerfree))     /**< destructor of pricer */
168    );
169 
170 /** sets initialization callback of pricer */
171 void SCIPpricerSetInit(
172    SCIP_PRICER*          pricer,             /**< pricer */
173    SCIP_DECL_PRICERINIT ((*pricerinit))      /**< initialize pricer */
174    );
175 
176 /** sets deinitialization callback of pricer */
177 void SCIPpricerSetExit(
178    SCIP_PRICER*          pricer,             /**< pricer */
179    SCIP_DECL_PRICEREXIT ((*pricerexit))      /**< deinitialize pricer */
180    );
181 
182 /** sets solving process initialization callback of pricer */
183 void SCIPpricerSetInitsol(
184    SCIP_PRICER*          pricer,             /**< pricer */
185    SCIP_DECL_PRICERINITSOL ((*pricerinitsol))/**< solving process initialization callback of pricer */
186    );
187 
188 /** sets solving process deinitialization callback of pricer */
189 void SCIPpricerSetExitsol(
190    SCIP_PRICER*          pricer,             /**< pricer */
191    SCIP_DECL_PRICEREXITSOL ((*pricerexitsol))/**< solving process deinitialization callback of pricer */
192    );
193 
194 #ifdef __cplusplus
195 }
196 #endif
197 
198 #endif
199