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