Scippy

SCIP

Solving Constraint Integer Programs

struct_syncstore.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-2019 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 scip.zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file struct_syncstore.h
17  * @ingroup PARALLEL
18  * @brief the struct definitions for the synchronization store
19  * @author Stephen J. Maher
20  * @author Robert Lion Gottwald
21  */
22 
23 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
24 
25 #ifndef __STRUCT_SYNCSTORE_H__
26 #define __STRUCT_SYNCSTORE_H__
27 
28 #include "scip/type_syncstore.h"
29 #include "tpi/type_tpi.h"
30 #include "scip/def.h"
31 #include "scip/type_scip.h"
32 #include "scip/type_stat.h"
33 #include "scip/type_lp.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
40 {
41  int nuses; /**< number of uses of the synchronization store */
42  SCIP_PARALLELMODE mode; /**< the mode for the parallel solving */
43  SCIP_Bool initialized; /**< flag to indicate whether the syncstore has been initialized */
44  int ninitvars; /**< number of variables it has been initialized for */
45  SCIP_SYNCDATA* syncdata; /**< array of size nsyncdata, containing the synchronization data
46  * for each active synchroization */
47  SCIP_SYNCDATA* lastsync; /**< pointer to the last synchronization data that has been synchronized
48  * by all threads */
49 
50  SCIP* mainscip; /**< the SCIP instance that was used for initializing the syncstore */
51  SCIP_Bool stopped; /**< flag to indicate if the solving is stopped */
52  SCIP_LOCK lock; /**< lock to protect the syncstore data structure from data races */
53 
54  /* SPI settings */
55  int nsyncdata; /**< the size of the synchronization data array */
56  SCIP_Real minsyncdelay; /**< the minimum delay before a synchronization data may be read */
57  int maxnsyncdelay; /**< maximum number of synchronizations before the reading of the next
58  * synchronization data is enforced regardless of the minimal synchroization
59  * delay */
60  SCIP_Real syncfreqinit; /**< the initial synchronization frequency which is read from the settings
61  * of the main SCIP when the syncstore is initialized */
62  SCIP_Real syncfreqmax; /**< the maximum synchronization frequency */
63  int maxnsols; /**< maximum number of solutions that can be shared in one synchronization */
64  int nsolvers; /**< number of solvers synchronizing with this syncstore */
65 };
66 
67 
68 struct SCIP_SyncData
69 {
70  SCIP_Real* solobj; /**< array with the objective value of all stored solutions */
71  SCIP_Real** sols; /**< array with the solution values of each variable for all stored solutions */
72  int* solsource; /**< the solverid of the solution came from */
73  int nsols; /**< number of solutions currently stored in the synchronization data */
74  SCIP_Real bestlowerbound; /**< largest lower bound on the objective value that was stored in this
75  * synchroization data */
76  SCIP_Real bestupperbound; /**< smalles upper bound on the objective value that was stored in this
77  * synchroization data */
78  SCIP_Longint syncnum; /**< the synchronization number of this synchronization data */
79  int winner; /**< the solverid of the solver with the best status */
80  SCIP_STATUS status; /**< the best status that was stored in this synchronization data */
81  SCIP_LOCK lock; /**< a lock to protect this synchronization data */
82  int syncedcount; /**< a counter of how many solvers have finished writing to this synchronization data */
83  SCIP_CONDITION allsynced; /**< a condition variable to signal when the last solver has finished writing to this
84  * synchronization data */
85  SCIP_BOUNDSTORE* boundstore; /**< a boundstore for storing all the bound changes that were added to this
86  * synchronization data */
87  SCIP_Real syncfreq; /**< the synchroization frequency that was set in this synchronization data */
88  SCIP_Longint memtotal; /**< the total amount of memory used by all solvers including the main SCIP */
89 };
90 
91 /** struct for storing the position of avariables lower and upper bound in the boundstore */
92 typedef struct
93 {
94  int pos[2]; /**< stores at pos[SCIP_BOUNDTYPE_LOWER] the position of the lowerbound and
95  * at pos[SCIP_BOUNDTYPE_UPPER] the position of the upperbound */
96 } BoundPos;
97 
98 /** struct for storing a single boundchange in the boundstore */
99 typedef struct
100 {
101  int varidx; /**< the variables position in the variable array of the main scip */
102  SCIP_Real newbound; /**< the variables new bound */
103  SCIP_BOUNDTYPE boundtype; /**< the type of the variables new bound */
104 } BoundChg;
105 
107 {
108  int nvars; /**< the number of variables to store bounds for */
109  BoundPos* bndpos; /**< array of size nvars to store the positions for all the bound changes
110  * stored in this boundstore */
111  BoundChg* bndchg; /**< array of boundchanges */
112  int nbndchg; /**< the number of boundchanges stored in this bound store */
113  int bndchgsize; /**< the size of the bound change array */
114 };
115 
116 #ifdef __cplusplus
117 }
118 #endif
119 
120 #endif
enum SCIP_BoundType SCIP_BOUNDTYPE
Definition: type_lp.h:50
SCIP_PARALLELMODE mode
SCIP_Real newbound
SCIP_SYNCDATA * lastsync
the type definitions for the task processing interface
type definitions for problem statistics
type definitions for LP management
SCIP_Real minsyncdelay
type definitions for SCIP&#39;s main datastructure
struct SCIP_SyncData SCIP_SYNCDATA
SCIP_BOUNDTYPE boundtype
SCIP_Bool initialized
SCIP_SYNCDATA * syncdata
#define SCIP_Bool
Definition: def.h:69
enum SCIP_Status SCIP_STATUS
Definition: type_stat.h:58
enum SCIP_Parallelmode SCIP_PARALLELMODE
the type definitions for the synchronization store
SCIP_Real syncfreqmax
#define SCIP_Real
Definition: def.h:157
SCIP_Real syncfreqinit
#define SCIP_Longint
Definition: def.h:142
common defines and data types used in all packages of SCIP