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 */
54   	SCIP_RETCODE SCIPpricerCopyInclude(
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 */
61   	SCIP_RETCODE SCIPpricerCreate(
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 */
83   	SCIP_RETCODE SCIPpricerFree(
84   	   SCIP_PRICER**         pricer,             /**< pointer to variable pricer data structure */
85   	   SCIP_SET*             set                 /**< global SCIP settings */
86   	   );
87   	
88   	/** initializes variable pricer */
89   	SCIP_RETCODE SCIPpricerInit(
90   	   SCIP_PRICER*          pricer,             /**< variable pricer */
91   	   SCIP_SET*             set                 /**< global SCIP settings */
92   	   );
93   	
94   	/** calls exit method of variable pricer */
95   	SCIP_RETCODE SCIPpricerExit(
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 */
101  	SCIP_RETCODE SCIPpricerInitsol(
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 */
107  	SCIP_RETCODE SCIPpricerExitsol(
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 */
113  	SCIP_RETCODE SCIPpricerActivate(
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 */
119  	SCIP_RETCODE SCIPpricerDeactivate(
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 */
125  	void SCIPpricerEnableOrDisableClocks(
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 */
131  	SCIP_RETCODE SCIPpricerRedcost(
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 */
141  	SCIP_RETCODE SCIPpricerFarkas(
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 */
149  	SCIP_RETCODE SCIPpricerExec(
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 */
161  	void SCIPpricerSetPriority(
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 */
192  	void SCIPpricerSetInitsol(
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 */
198  	void SCIPpricerSetExitsol(
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
208