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   scip_presol.h
26   	 * @ingroup PUBLICCOREAPI
27   	 * @brief  public methods for presolving plugins
28   	 * @author Tobias Achterberg
29   	 * @author Timo Berthold
30   	 * @author Thorsten Koch
31   	 * @author Alexander Martin
32   	 * @author Marc Pfetsch
33   	 * @author Kati Wolter
34   	 * @author Gregor Hendel
35   	 * @author Leona Gottwald
36   	 */
37   	
38   	/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
39   	
40   	#ifndef __SCIP_SCIP_PRESOL_H__
41   	#define __SCIP_SCIP_PRESOL_H__
42   	
43   	
44   	#include "scip/def.h"
45   	#include "scip/type_presol.h"
46   	#include "scip/type_result.h"
47   	#include "scip/type_retcode.h"
48   	#include "scip/type_scip.h"
49   	#include "scip/type_timing.h"
50   	
51   	#ifdef __cplusplus
52   	extern "C" {
53   	#endif
54   	
55   	/**@addtogroup PublicPresolverMethods
56   	 *
57   	 * @{
58   	 */
59   	
60   	/** creates a presolver and includes it in SCIP
61   	 *
62   	 *  @note method has all presolver callbacks as arguments and is thus changed every time a new
63   	 *        callback is added
64   	 *        in future releases; consider using SCIPincludePresolBasic() and setter functions
65   	 *        if you seek for a method which is less likely to change in future releases
66   	 */
67   	SCIP_EXPORT
68   	SCIP_RETCODE SCIPincludePresol(
69   	   SCIP*                 scip,               /**< SCIP data structure */
70   	   const char*           name,               /**< name of presolver */
71   	   const char*           desc,               /**< description of presolver */
72   	   int                   priority,           /**< priority of the presolver (>= 0: before, < 0: after constraint handlers) */
73   	   int                   maxrounds,          /**< maximal number of presolving rounds the presolver participates in (-1: no limit) */
74   	   SCIP_PRESOLTIMING     timing,             /**< timing mask of the presolver */
75   	   SCIP_DECL_PRESOLCOPY  ((*presolcopy)),    /**< copy method of presolver or NULL if you don't want to copy your plugin into sub-SCIPs */
76   	   SCIP_DECL_PRESOLFREE  ((*presolfree)),    /**< destructor of presolver to free user data (called when SCIP is exiting) */
77   	   SCIP_DECL_PRESOLINIT  ((*presolinit)),    /**< initialization method of presolver (called after problem was transformed) */
78   	   SCIP_DECL_PRESOLEXIT  ((*presolexit)),    /**< deinitialization method of presolver (called before transformed problem is freed) */
79   	   SCIP_DECL_PRESOLINITPRE((*presolinitpre)),/**< presolving initialization method of presolver (called when presolving is about to begin) */
80   	   SCIP_DECL_PRESOLEXITPRE((*presolexitpre)),/**< presolving deinitialization method of presolver (called after presolving has been finished) */
81   	   SCIP_DECL_PRESOLEXEC  ((*presolexec)),    /**< execution method of presolver */
82   	   SCIP_PRESOLDATA*      presoldata          /**< presolver data */
83   	   );
84   	
85   	/** Creates a presolver and includes it in SCIP with its fundamental callback. All non-fundamental (or optional)
86   	 *  callbacks as, e.g., init and exit callbacks, will be set to NULL. Optional callbacks can be set via specific setter
87   	 *  functions. These are SCIPsetPresolCopy(), SCIPsetPresolFree(), SCIPsetPresolInit(), SCIPsetPresolExit(),
88   	 *  SCIPsetPresolInitpre(), and SCIPsetPresolExitPre().
89   	 *
90   	 *  @note if you want to set all callbacks with a single method call, consider using SCIPincludePresol() instead
91   	 */
92   	SCIP_EXPORT
93   	SCIP_RETCODE SCIPincludePresolBasic(
94   	   SCIP*                 scip,               /**< SCIP data structure */
95   	   SCIP_PRESOL**         presolptr,          /**< reference to presolver, or NULL */
96   	   const char*           name,               /**< name of presolver */
97   	   const char*           desc,               /**< description of presolver */
98   	   int                   priority,           /**< priority of the presolver (>= 0: before, < 0: after constraint handlers) */
99   	   int                   maxrounds,          /**< maximal number of presolving rounds the presolver participates in (-1: no limit) */
100  	   SCIP_PRESOLTIMING     timing,             /**< timing mask of the presolver */
101  	   SCIP_DECL_PRESOLEXEC  ((*presolexec)),    /**< execution method of presolver */
102  	   SCIP_PRESOLDATA*      presoldata          /**< presolver data */
103  	   );
104  	
105  	/** sets copy method of presolver */
106  	SCIP_EXPORT
107  	SCIP_RETCODE SCIPsetPresolCopy(
108  	   SCIP*                 scip,               /**< SCIP data structure */
109  	   SCIP_PRESOL*          presol,             /**< presolver */
110  	   SCIP_DECL_PRESOLCOPY  ((*presolcopy))     /**< copy method of presolver or NULL if you don't want to copy your plugin into sub-SCIPs */
111  	   );
112  	
113  	/** sets destructor method of presolver */
114  	SCIP_EXPORT
115  	SCIP_RETCODE SCIPsetPresolFree(
116  	   SCIP*                 scip,               /**< SCIP data structure */
117  	   SCIP_PRESOL*          presol,             /**< presolver */
118  	   SCIP_DECL_PRESOLFREE ((*presolfree))      /**< destructor of presolver */
119  	   );
120  	
121  	/** sets initialization method of presolver */
122  	SCIP_EXPORT
123  	SCIP_RETCODE SCIPsetPresolInit(
124  	   SCIP*                 scip,               /**< SCIP data structure */
125  	   SCIP_PRESOL*          presol,             /**< presolver */
126  	   SCIP_DECL_PRESOLINIT  ((*presolinit))     /**< initialize presolver */
127  	   );
128  	
129  	/** sets deinitialization method of presolver */
130  	SCIP_EXPORT
131  	SCIP_RETCODE SCIPsetPresolExit(
132  	   SCIP*                 scip,               /**< SCIP data structure */
133  	   SCIP_PRESOL*          presol,             /**< presolver */
134  	   SCIP_DECL_PRESOLEXIT  ((*presolexit))     /**< deinitialize presolver */
135  	   );
136  	
137  	/** sets solving process initialization method of presolver */
138  	SCIP_EXPORT
139  	SCIP_RETCODE SCIPsetPresolInitpre(
140  	   SCIP*                 scip,               /**< SCIP data structure */
141  	   SCIP_PRESOL*          presol,             /**< presolver */
142  	   SCIP_DECL_PRESOLINITPRE ((*presolinitpre))/**< solving process initialization method of presolver */
143  	   );
144  	
145  	/** sets solving process deinitialization method of presolver */
146  	SCIP_RETCODE SCIPsetPresolExitpre(
147  	   SCIP*                 scip,               /**< SCIP data structure */
148  	   SCIP_PRESOL*          presol,             /**< presolver */
149  	   SCIP_DECL_PRESOLEXITPRE ((*presolexitpre))/**< solving process deinitialization method of presolver */
150  	   );
151  	
152  	/** returns the presolver of the given name, or NULL if not existing */
153  	SCIP_EXPORT
154  	SCIP_PRESOL* SCIPfindPresol(
155  	   SCIP*                 scip,               /**< SCIP data structure */
156  	   const char*           name                /**< name of presolver */
157  	   );
158  	
159  	/** returns the array of currently available presolvers */
160  	SCIP_EXPORT
161  	SCIP_PRESOL** SCIPgetPresols(
162  	   SCIP*                 scip                /**< SCIP data structure */
163  	   );
164  	
165  	/** returns the number of currently available presolvers */
166  	SCIP_EXPORT
167  	int SCIPgetNPresols(
168  	   SCIP*                 scip                /**< SCIP data structure */
169  	   );
170  	
171  	/** sets the priority of a presolver */
172  	SCIP_EXPORT
173  	SCIP_RETCODE SCIPsetPresolPriority(
174  	   SCIP*                 scip,               /**< SCIP data structure */
175  	   SCIP_PRESOL*          presol,             /**< presolver */
176  	   int                   priority            /**< new priority of the presolver */
177  	   );
178  	
179  	/** returns the number of presolve rounds (current or last presolve) */
180  	SCIP_EXPORT
181  	int SCIPgetNPresolRounds(
182  	   SCIP*                 scip                /**< SCIP data structure */
183  	);
184  	
185  	/** @} */
186  	
187  	#ifdef __cplusplus
188  	}
189  	#endif
190  	
191  	#endif
192