Scippy

SCIP

Solving Constraint Integer Programs

concurrent.h
Go to the documentation of this file.
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 concurrent.h
26  * @ingroup PARALLEL
27  * @brief helper functions for concurrent scip solvers
28  * @author Leona Gottwald
29  */
30 
31 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32 
33 #include "scip/type_concurrent.h"
34 #include "scip/type_scip.h"
35 #include "scip/type_concsolver.h"
36 #include "scip/type_sol.h"
37 #include "scip/type_var.h"
38 #include "scip/type_syncstore.h"
39 #include "scip/def.h"
40 
41 #ifndef __SCIP_CONCURRENT_H__
42 #define __SCIP_CONCURRENT_H__
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 /** create concurrent data */
50  SCIP* scip, /**< SCIP datastructure */
51  SCIP_CONCSOLVER* concsolver, /**< concurrent solver of given SCIP instance */
52  int* varperm /**< permutation of variables for communication */
53  );
54 
55 /** get number of initialized concurrent solvers */
57  SCIP* scip /**< SCIP datastructure */
58  );
59 
60 /** gets the concurrent solvers */
62  SCIP* scip /**< SCIP datastructure */
63  );
64 
65 /** adds a concurrent solver */
67  SCIP* scip, /**< SCIP datastructure */
68  SCIP_CONCSOLVER* concsolver /**< concurrent solver of given SCIP instance */
69  );
70 
71 /** frees concurrent data */
73  SCIP* scip /**< SCIP datastructure */
74  );
75 
76 /** increments the time counter for synchronization */
78  SCIP* scip, /**< SCIP datastructure */
79  SCIP_Real val /**< value by which the time counter for synchronization is incremented */
80  );
81 
82 /** synchronize with other concurrent solvers */
84  SCIP* scip /**< SCIP datastructure */
85  );
86 
87 /** pass a solution to the given SCIP instance using that was received via synchronization by using
88  * the sync heuristic */
90  SCIP* scip, /**< SCIP datastructure */
91  SCIP_SOL* sol /**< solution */
92  );
93 
94 /** adds a global boundchange to the given SCIP, by passing it to the sync propagator */
96  SCIP* scip, /**< SCIP data structure */
97  SCIP_VAR* var, /**< variable for bound */
98  SCIP_Real val, /**< value of bound */
99  SCIP_BOUNDTYPE bndtype /**< type of bound */
100  );
101 
102 /** copy the nodenumber, depth, time, and runnumber of one solution to another one */
104  SCIP_SOL* source, /**< source for solution statistics */
105  SCIP_SOL* target /**< target for solution statistics */
106  );
107 
108 /** copy solving statistics */
110  SCIP* source, /**< SCIP data structure */
111  SCIP* target /**< target SCIP data structure */
112  );
113 
114 /** get variable index of original variable that is the same between concurrent solvers */
116  SCIP* scip, /**< SCIP data structure */
117  SCIP_VAR* var /**< variable */
118  );
119 
120 /** has the solution been created after the last synchronization point */
122  SCIP* scip, /**< SCIP data structure */
123  SCIP_SOL* sol /**< the solution */
124  );
125 
126 /** gets the global bound changes since the last synchronization point */
128  SCIP* scip /**< SCIP data structure */
129  );
130 
131 /** start solving in parallel using the given set of concurrent solvers */
133  SCIP* scip /**< pointer to scip datastructure */
134  );
135 
136 /** disables storing global bound changes */
138  SCIP* scip /**< SCIP data structure */
139  );
140 
141 /** enables storing global bound changes */
143  SCIP* scip /**< SCIP data structure */
144  );
145 
146 /** gets total memory usage of all concurrent solvers together */
148  SCIP* scip /**< SCIP data structure */
149  );
150 
151 /** gets the dualbound in the last synchronization */
153  SCIP* scip /**< SCIP data structure */
154  );
155 
156 /** gets the primalbound in the last synchronization */
158  SCIP* scip /**< SCIP data structure */
159  );
160 
161 /** gets the gap in the last synchronization */
163  SCIP* scip /**< SCIP data structure */
164  );
165 
166 /** gives the total number of tightened bounds received from other concurrent solvers */
168  SCIP* scip /**< SCIP data structure */
169  );
170 
171 /** gives the total number of tightened bounds for integer variables received from
172  * other concurrent solvers */
174  SCIP* scip /**< SCIP data structure */
175  );
176 
177 #ifdef __cplusplus
178 }
179 #endif
180 
181 #endif
enum SCIP_BoundType SCIP_BOUNDTYPE
Definition: type_lp.h:59
void SCIPenableConcurrentBoundStorage(SCIP *scip)
Definition: concurrent.c:275
SCIP_RETCODE SCIPfreeConcurrent(SCIP *scip)
Definition: concurrent.c:151
SCIP_Longint SCIPgetConcurrentNTightenedIntBnds(SCIP *scip)
Definition: concurrent.c:360
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
SCIP_RETCODE SCIPincrementConcurrentTime(SCIP *scip, SCIP_Real val)
Definition: concurrent.c:189
SCIP_Real SCIPgetConcurrentDualbound(SCIP *scip)
Definition: concurrent.c:305
SCIP_RETCODE SCIPaddConcurrentSol(SCIP *scip, SCIP_SOL *sol)
Definition: concurrent.c:371
int SCIPgetNConcurrentSolvers(SCIP *scip)
Definition: concurrent.c:116
SCIP_RETCODE SCIPaddConcurrentSolver(SCIP *scip, SCIP_CONCSOLVER *concsolver)
Definition: concurrent.c:138
SCIP_Real SCIPgetConcurrentPrimalbound(SCIP *scip)
Definition: concurrent.c:320
SCIP_RETCODE SCIPsynchronize(SCIP *scip)
Definition: concurrent.c:245
type definitions for SCIP&#39;s main datastructure
type definition of concurrent data
int SCIPgetConcurrentVaridx(SCIP *scip, SCIP_VAR *var)
Definition: concurrent.c:422
SCIP_Bool SCIPIsConcurrentSolNew(SCIP *scip, SCIP_SOL *sol)
Definition: concurrent.c:438
type definitions for problem variables
#define SCIP_Bool
Definition: def.h:93
SCIP_RETCODE SCIPcopySolStats(SCIP_SOL *source, SCIP_SOL *target)
Definition: concurrent.c:404
type definitions for storing primal CIP solutions
SCIP_Longint SCIPgetConcurrentMemTotal(SCIP *scip)
Definition: concurrent.c:287
SCIP_Longint SCIPgetConcurrentNTightenedBnds(SCIP *scip)
Definition: concurrent.c:349
the type definitions for the synchronization store
SCIP_Real SCIPgetConcurrentGap(SCIP *scip)
Definition: concurrent.c:335
SCIP_RETCODE SCIPcopyConcurrentSolvingStats(SCIP *source, SCIP *target)
Definition: concurrent.c:539
SCIP_CONCSOLVER ** SCIPgetConcurrentSolvers(SCIP *scip)
Definition: concurrent.c:127
SCIP_BOUNDSTORE * SCIPgetConcurrentGlobalBoundChanges(SCIP *scip)
Definition: concurrent.c:451
#define SCIP_Real
Definition: def.h:186
SCIP_RETCODE SCIPconcurrentSolve(SCIP *scip)
Definition: concurrent.c:483
#define SCIP_Longint
Definition: def.h:171
SCIP_RETCODE SCIPaddConcurrentBndchg(SCIP *scip, SCIP_VAR *var, SCIP_Real val, SCIP_BOUNDTYPE bndtype)
Definition: concurrent.c:386
SCIP_RETCODE SCIPcreateConcurrent(SCIP *scip, SCIP_CONCSOLVER *concsolver, int *varperm)
Definition: concurrent.c:57
common defines and data types used in all packages of SCIP
void SCIPdisableConcurrentBoundStorage(SCIP *scip)
Definition: concurrent.c:263
type definitions for concurrent solvers