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_relax.h
17  * @ingroup PUBLICCOREAPI
18  * @brief  public methods for relaxator 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_RELAX_H__
32 #define __SCIP_SCIP_RELAX_H__
33 
34 
35 #include "scip/def.h"
36 #include "scip/type_relax.h"
37 #include "scip/type_result.h"
38 #include "scip/type_retcode.h"
39 #include "scip/type_scip.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /**@addtogroup PublicRelaxatorMethods
46  *
47  * @{
48  */
49 
50 /** creates a relaxation handler and includes it in SCIP
51  *
52  *  @note method has all relaxation handler callbacks as arguments and is thus changed every time a new
53  *        callback is added
54  *        in future releases; consider using SCIPincludeRelaxBasic() and setter functions
55  *        if you seek for a method which is less likely to change in future releases
56  */
57 SCIP_EXPORT
58 SCIP_RETCODE SCIPincludeRelax(
59    SCIP*                 scip,               /**< SCIP data structure */
60    const char*           name,               /**< name of relaxation handler */
61    const char*           desc,               /**< description of relaxation handler */
62    int                   priority,           /**< priority of the relaxation handler (negative: after LP, non-negative: before LP) */
63    int                   freq,               /**< frequency for calling relaxation handler */
64    SCIP_DECL_RELAXCOPY   ((*relaxcopy)),     /**< copy method of relaxation handler or NULL if you don't want to copy your plugin into sub-SCIPs */
65    SCIP_DECL_RELAXFREE   ((*relaxfree)),     /**< destructor of relaxation handler */
66    SCIP_DECL_RELAXINIT   ((*relaxinit)),     /**< initialize relaxation handler */
67    SCIP_DECL_RELAXEXIT   ((*relaxexit)),     /**< deinitialize relaxation handler */
68    SCIP_DECL_RELAXINITSOL((*relaxinitsol)),  /**< solving process initialization method of relaxation handler */
69    SCIP_DECL_RELAXEXITSOL((*relaxexitsol)),  /**< solving process deinitialization method of relaxation handler */
70    SCIP_DECL_RELAXEXEC   ((*relaxexec)),     /**< execution method of relaxation handler */
71    SCIP_RELAXDATA*       relaxdata           /**< relaxation handler data */
72    );
73 
74 /** creates a relaxation handler and includes it in SCIP. All non fundamental
75  *  (or optional) callbacks as, e.g., init and exit callbacks, will be set to NULL.
76  *  Optional callbacks can be set via specific setter functions, see SCIPsetRelaxInit(), SCIPsetRelaxExit(),
77  *  SCIPsetRelaxCopy(), SCIPsetRelaxFree(), SCIPsetRelaxInitsol(), and SCIPsetRelaxExitsol()
78  *
79  *  @note if you want to set all callbacks with a single method call, consider using SCIPincludeRelax() instead
80  */
81 SCIP_EXPORT
82 SCIP_RETCODE SCIPincludeRelaxBasic(
83    SCIP*                 scip,               /**< SCIP data structure */
84    SCIP_RELAX**          relaxptr,           /**< reference to relaxation pointer, or NULL */
85    const char*           name,               /**< name of relaxation handler */
86    const char*           desc,               /**< description of relaxation handler */
87    int                   priority,           /**< priority of the relaxation handler (negative: after LP, non-negative: before LP) */
88    int                   freq,               /**< frequency for calling relaxation handler */
89    SCIP_DECL_RELAXEXEC   ((*relaxexec)),     /**< execution method of relaxation handler */
90    SCIP_RELAXDATA*       relaxdata           /**< relaxation handler data */
91    );
92 
93 /** sets copy method of relaxation handler */
94 SCIP_EXPORT
95 SCIP_RETCODE SCIPsetRelaxCopy(
96    SCIP*                 scip,               /**< SCIP data structure */
97    SCIP_RELAX*           relax,              /**< relaxation handler */
98    SCIP_DECL_RELAXCOPY   ((*relaxcopy))      /**< copy method of relaxation handler or NULL if you don't want to copy your plugin into sub-SCIPs */
99    );
100 
101 /** sets destructor method of relaxation handler */
102 SCIP_EXPORT
103 SCIP_RETCODE SCIPsetRelaxFree(
104    SCIP*                 scip,               /**< SCIP data structure */
105    SCIP_RELAX*           relax,              /**< relaxation handler */
106    SCIP_DECL_RELAXFREE   ((*relaxfree))      /**< destructor of relaxation handler */
107    );
108 
109 /** sets initialization method of relaxation handler */
110 SCIP_EXPORT
111 SCIP_RETCODE SCIPsetRelaxInit(
112    SCIP*                 scip,               /**< SCIP data structure */
113    SCIP_RELAX*           relax,              /**< relaxation handler */
114    SCIP_DECL_RELAXINIT   ((*relaxinit))      /**< initialize relaxation handler */
115    );
116 
117 /** sets deinitialization method of relaxation handler */
118 SCIP_EXPORT
119 SCIP_RETCODE SCIPsetRelaxExit(
120    SCIP*                 scip,               /**< SCIP data structure */
121    SCIP_RELAX*           relax,              /**< relaxation handler */
122    SCIP_DECL_RELAXEXIT   ((*relaxexit))      /**< deinitialize relaxation handler */
123    );
124 
125 /** sets solving process initialization method of relaxation handler */
126 SCIP_EXPORT
127 SCIP_RETCODE SCIPsetRelaxInitsol(
128    SCIP*                 scip,               /**< SCIP data structure */
129    SCIP_RELAX*           relax,              /**< relaxation handler */
130    SCIP_DECL_RELAXINITSOL((*relaxinitsol))   /**< solving process initialization method of relaxation handler */
131    );
132 
133 /** sets solving process deinitialization method of relaxation handler */
134 SCIP_EXPORT
135 SCIP_RETCODE SCIPsetRelaxExitsol(
136    SCIP*                 scip,               /**< SCIP data structure */
137    SCIP_RELAX*           relax,              /**< relaxation handler */
138    SCIP_DECL_RELAXEXITSOL((*relaxexitsol))   /**< solving process deinitialization method of relaxation handler */
139    );
140 
141 /** returns the relaxation handler of the given name, or NULL if not existing */
142 SCIP_EXPORT
143 SCIP_RELAX* SCIPfindRelax(
144    SCIP*                 scip,               /**< SCIP data structure */
145    const char*           name                /**< name of relaxation handler */
146    );
147 
148 /** returns the array of currently available relaxation handlers  */
149 SCIP_EXPORT
150 SCIP_RELAX** SCIPgetRelaxs(
151    SCIP*                 scip                /**< SCIP data structure */
152    );
153 
154 /** returns the number of currently available relaxation handlers  */
155 SCIP_EXPORT
156 int SCIPgetNRelaxs(
157    SCIP*                 scip                /**< SCIP data structure */
158    );
159 
160 /** sets the priority of a relaxation handler*/
161 SCIP_EXPORT
162 SCIP_RETCODE SCIPsetRelaxPriority(
163    SCIP*                 scip,               /**< SCIP data structure */
164    SCIP_RELAX*           relax,              /**< relaxation handler */
165    int                   priority            /**< new priority of the relaxation handler */
166    );
167 
168 /** @} */
169 
170 #ifdef __cplusplus
171 }
172 #endif
173 
174 #endif
175