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