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_concurrent.h
17  * @ingroup PUBLICCOREAPI
18  * @brief  public methods for concurrent solving mode
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_CONCURRENT_H__
32 #define __SCIP_SCIP_CONCURRENT_H__
33 
34 
35 #include "scip/def.h"
36 #include "scip/type_concsolver.h"
37 #include "scip/type_retcode.h"
38 #include "scip/type_scip.h"
39 #include "scip/type_syncstore.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /**@addtogroup PublicConcsolverTypeMethods
46  *
47  * @{
48  */
49 
50 /** creates a concurrent solver type and includes it in SCIP.
51  *
52  *  @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
53  *          SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
54  *
55  *  @pre This method can be called if @p scip is in one of the following stages:
56  *       - \ref SCIP_STAGE_INIT
57  *       - \ref SCIP_STAGE_PROBLEM
58  */
59 SCIP_EXPORT
60 SCIP_RETCODE SCIPincludeConcsolverType(
61    SCIP*                               scip,                       /**< SCIP data structure */
62    const char*                         name,                       /**< name of concurrent_solver */
63    SCIP_Real                           prefpriodefault,            /**< the default preferred priority of this concurrent solver type */
64    SCIP_DECL_CONCSOLVERCREATEINST      ((*concsolvercreateinst)),  /**< data copy method of concurrent solver */
65    SCIP_DECL_CONCSOLVERDESTROYINST     ((*concsolverdestroyinst)), /**< data copy method of concurrent solver */
66    SCIP_DECL_CONCSOLVERINITSEEDS       ((*concsolverinitseeds)),   /**< initialize random seeds of concurrent solver */
67    SCIP_DECL_CONCSOLVEREXEC            ((*concsolverexec)),        /**< execution method of concurrent solver */
68    SCIP_DECL_CONCSOLVERCOPYSOLVINGDATA ((*concsolvercopysolvdata)),/**< method to copy solving data */
69    SCIP_DECL_CONCSOLVERSTOP            ((*concsolverstop)),        /**< terminate solving in concurrent solver */
70    SCIP_DECL_CONCSOLVERSYNCWRITE       ((*concsolversyncwrite)),   /**< synchronization method of concurrent solver */
71    SCIP_DECL_CONCSOLVERSYNCREAD        ((*concsolversyncread)),    /**< synchronization method of concurrent solver */
72    SCIP_DECL_CONCSOLVERTYPEFREEDATA    ((*concsolvertypefreedata)),/**< method to free data of concurrent solver type */
73    SCIP_CONCSOLVERTYPEDATA*            data                        /**< the concurent solver type's data */
74    );
75 
76 /** returns the concurrent solver type with the given name, or NULL if not existing */
77 SCIP_EXPORT
78 SCIP_CONCSOLVERTYPE* SCIPfindConcsolverType(
79    SCIP*                 scip,               /**< SCIP data structure */
80    const char*           name                /**< name of concurrent_solver */
81    );
82 
83 /** returns the array of included concurrent solver types */
84 SCIP_EXPORT
85 SCIP_CONCSOLVERTYPE** SCIPgetConcsolverTypes(
86    SCIP*                 scip                /**< SCIP data structure */
87    );
88 
89 /** returns the number of included concurrent solver types */
90 SCIP_EXPORT
91 int SCIPgetNConcsolverTypes(
92    SCIP*                 scip                /**< SCIP data structure */
93    );
94 
95 /** @} */
96 
97 /**@addtogroup PublicParallelMethods
98  *
99  * @{
100  */
101 
102 /** Constructs the parallel interface to execute processes concurrently.
103  *
104  *  @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
105  *          SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
106  *
107  *  @pre This method can be called if @p scip is in one of the following stages:
108  *       - \ref SCIP_STAGE_PROBLEM
109  *       - \ref SCIP_STAGE_TRANSFORMING
110  *       - \ref SCIP_STAGE_TRANSFORMED
111  *       - \ref SCIP_STAGE_INITPRESOLVE
112  *       - \ref SCIP_STAGE_PRESOLVING
113  *       - \ref SCIP_STAGE_EXITPRESOLVE
114  *       - \ref SCIP_STAGE_PRESOLVED
115  *       - \ref SCIP_STAGE_INITSOLVE
116  *       - \ref SCIP_STAGE_SOLVING
117  *       - \ref SCIP_STAGE_SOLVED
118  *       - \ref SCIP_STAGE_EXITSOLVE
119  *       - \ref SCIP_STAGE_FREETRANS
120  *
121  *  See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
122  */
123 SCIP_EXPORT
124 SCIP_RETCODE SCIPconstructSyncstore(
125    SCIP*                 scip                /**< SCIP data structure */
126    );
127 
128 /** releases the current synchronization store
129  *
130  *  @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
131  *          SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
132  *
133  *  @pre This method can be called if @p scip is in one of the following stages:
134  *       - \ref SCIP_STAGE_PROBLEM
135  *       - \ref SCIP_STAGE_TRANSFORMING
136  *       - \ref SCIP_STAGE_TRANSFORMED
137  *       - \ref SCIP_STAGE_INITPRESOLVE
138  *       - \ref SCIP_STAGE_PRESOLVING
139  *       - \ref SCIP_STAGE_EXITPRESOLVE
140  *       - \ref SCIP_STAGE_PRESOLVED
141  *       - \ref SCIP_STAGE_INITSOLVE
142  *       - \ref SCIP_STAGE_SOLVING
143  *       - \ref SCIP_STAGE_SOLVED
144  *       - \ref SCIP_STAGE_EXITSOLVE
145  *       - \ref SCIP_STAGE_FREETRANS
146  *       - \ref SCIP_STAGE_FREE
147  *
148  *  See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
149  */
150 SCIP_RETCODE SCIPfreeSyncstore(
151    SCIP*                 scip                /**< SCIP data structure */
152    );
153 
154 /** Gets the synchronization store.
155  *
156  *  @return the \ref SCIP_SYNCSTORE parallel interface pointer to submit jobs for concurrent processing.
157  *
158  *  @pre This method can be called if @p scip is in one of the following stages:
159  *       - \ref SCIP_STAGE_INIT
160  *       - \ref SCIP_STAGE_PROBLEM
161  *       - \ref SCIP_STAGE_TRANSFORMING
162  *       - \ref SCIP_STAGE_TRANSFORMED
163  *       - \ref SCIP_STAGE_INITPRESOLVE
164  *       - \ref SCIP_STAGE_PRESOLVING
165  *       - \ref SCIP_STAGE_EXITPRESOLVE
166  *       - \ref SCIP_STAGE_PRESOLVED
167  *       - \ref SCIP_STAGE_INITSOLVE
168  *       - \ref SCIP_STAGE_SOLVING
169  *       - \ref SCIP_STAGE_SOLVED
170  *       - \ref SCIP_STAGE_EXITSOLVE
171  *       - \ref SCIP_STAGE_FREETRANS
172  *
173  *  See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
174  */
175 SCIP_EXPORT
176 SCIP_SYNCSTORE* SCIPgetSyncstore(
177    SCIP*                 scip                /**< SCIP data structure */
178    );
179 
180 /**@} */
181 
182 #ifdef __cplusplus
183 }
184 #endif
185 
186 #endif
187