Scippy

SCIP

Solving Constraint Integer Programs

concsolver.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 concsolver.h
26  * @brief datastructures for concurrent solvers
27  * @author Leona Gottwald
28  */
29 
30 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
31 
32 #ifndef __SCIP_CONCSOLVER_H__
33 #define __SCIP_CONCSOLVER_H__
34 
35 #include "scip/def.h"
36 #include "blockmemshell/memory.h"
37 #include "scip/type_retcode.h"
38 #include "scip/type_set.h"
39 #include "scip/type_concsolver.h"
40 #include "scip/type_syncstore.h"
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /** creates a concurrent solver type */
48  SCIP_CONCSOLVERTYPE** concsolvertype, /**< pointer to concurrent solver data structure */
49  SCIP_SET* set, /**< global SCIP settings */
50  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
51  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
52  const char* name, /**< name of concurrent solver */
53  SCIP_Real prefpriodefault, /**< the default preferred priority of this concurrent solver type */
54  SCIP_DECL_CONCSOLVERCREATEINST ((*concsolvercreateinst)),/**< data copy method of concurrent solver */
55  SCIP_DECL_CONCSOLVERDESTROYINST ((*concsolverdestroyinst)),/**< data copy method of concurrent solver */
56  SCIP_DECL_CONCSOLVERINITSEEDS ((*concsolverinitseeds)),/**< initialize random seeds of concurrent solver */
57  SCIP_DECL_CONCSOLVEREXEC ((*concsolverexec)),/**< execution method of concurrent solver */
58  SCIP_DECL_CONCSOLVERCOPYSOLVINGDATA ((*concsolvercopysolvdata)),/**< method to copy solving data */
59  SCIP_DECL_CONCSOLVERSTOP ((*concsolverstop)),/**< terminate solving in concurrent solver */
60  SCIP_DECL_CONCSOLVERSYNCWRITE ((*concsolversyncwrite)),/**< synchronization method of concurrent solver */
61  SCIP_DECL_CONCSOLVERSYNCREAD ((*concsolversyncread)),/**< synchronization method of concurrent solver */
62  SCIP_DECL_CONCSOLVERTYPEFREEDATA ((*concsolvertypefreedata)),/**< method to free data of concurrent solver type */
63  SCIP_CONCSOLVERTYPEDATA* data /**< the concurent solver type's data */
64  );
65 
66 /** frees all memory of a concurrent solver type */
68  SCIP_CONCSOLVERTYPE** concsolvertype /**< pointer to concurrent solver data structure */
69  );
70 
71 /** gets the data of a concurrent solver type */
73  SCIP_CONCSOLVERTYPE* concsolvertype /**< concurrent solver type */
74  );
75 
76 /** sets the data of a concurrent solver type */
78  SCIP_CONCSOLVERTYPE* concsolvertype, /**< concurrent solver type */
79  SCIP_CONCSOLVERTYPEDATA* data /**< the concurrent solver's data */
80  );
81 
82 /** gets the name of a concurrent solver type */
84  SCIP_CONCSOLVERTYPE* concsolvertype /**< concurrent solver type */
85  );
86 
87 /** gets the preferred priority from a concurrent solver type */
89  SCIP_CONCSOLVERTYPE* concsolvertype /**< concurrent solver type */
90  );
91 
92 /** creates an instance of the given concurrent solver type */
94  SCIP_SET* set, /**< global SCIP settings */
95  SCIP_CONCSOLVERTYPE* concsolvertype, /**< concurrent solver type to create */
96  SCIP_CONCSOLVER** concsolver /**< pointer to return concurrent solver instance */
97  );
98 
99 /** destroys an instance of the given concurrent solver */
101  SCIP_SET* set, /**< global SCIP settings */
102  SCIP_CONCSOLVER** concsolver /**< concurrent solver */
103  );
104 
105 /** gets the data of a concurrent solver */
107  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
108  );
109 
110 /** sets the data of a concurrent solver */
112  SCIP_CONCSOLVER* concsolver, /**< concurrent solver */
113  SCIP_CONCSOLVERDATA* data /**< the concurrent solver's data */
114  );
115 
116 /** gets the name of a concurrent solver */
118  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
119  );
120 
121 /** initializes the random seeds of a concurrent solver */
123  SCIP_CONCSOLVER* concsolver, /**< concurrent solver */
124  unsigned int seed /**< seed for initializing the solver's internal random seeds */
125  );
126 
127 /** start the solving process of a concurrent solver */
129  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
130  );
131 
132 /** gets solving data of concurrent solver and stores it in the given SCIP instance */
134  SCIP_CONCSOLVER* concsolver, /**< concurrent solver */
135  SCIP* scip /**< SCIP datastructure */
136  );
137 
138 /** interrupt solving in a concurrent solver */
140  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
141  );
142 
143 /** let the given concurrent solver synchronize, i.e. pass its own solutions and bounds to
144  * the SPI.
145  */
147  SCIP_CONCSOLVER* concsolver, /**< concurrent solver */
148  SCIP_SET* set /**< global SCIP settings */
149  );
150 
151 /** gets the current synchronization frequency of the concurent solver */
153  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
154  );
155 
156 /** gets the total memory used by the concurent solver */
158  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
159  );
160 
161 /** sets the time elapsed since the last synchronization. Must be set before the synchronization is
162  * started.
163  */
165  SCIP_CONCSOLVER* concsolver, /**< concurrent solver */
166  SCIP_Real time /**< the time passed since the last synchronization */
167  );
168 
169 /** gets the solving time of the concurrent solver */
171  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
172  );
173 
174 /** gets the time spent for synchronization for the concurrent solver */
176  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
177  );
178 
179 /** gets the number of lp iterations the concurrent solver used */
181  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
182  );
183 
184 /** gets the number of branch and bound nodes the concurrent solver used */
186  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
187  );
188 
189 /** gets the number of solutions the concurrent solver received during synchronization */
191  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
192  );
193 
194 /** gets the number of solutions the concurrent solver shared during synchronization */
196  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
197  );
198 
199 /** gets the number of tighter global variable bounds the solver received */
201  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
202  );
203 
204 /** gets the number of tighter global variable bounds of integer variables the solver received */
206  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
207  );
208 
209 /** gets index of concurrent solver */
211  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
212  );
213 
214 #ifdef __cplusplus
215 }
216 #endif
217 
218 #endif
SCIP_Longint SCIPconcsolverGetNTighterBnds(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:603
char * SCIPconcsolverGetName(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:300
struct SCIP_ConcSolverTypeData SCIP_CONCSOLVERTYPEDATA
#define SCIP_DECL_CONCSOLVERSYNCREAD(x)
void SCIPconcsolverTypeFree(SCIP_CONCSOLVERTYPE **concsolvertype)
Definition: concsolver.c:153
char * SCIPconcsolverTypeGetName(SCIP_CONCSOLVERTYPE *concsolvertype)
Definition: concsolver.c:190
#define SCIP_DECL_CONCSOLVEREXEC(x)
SCIP_RETCODE SCIPconcsolverGetSolvingData(SCIP_CONCSOLVER *concsolver, SCIP *scip)
Definition: concsolver.c:343
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
type definitions for global SCIP settings
SCIP_Real SCIPconcsolverGetSyncFreq(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:510
type definitions for return codes for SCIP methods
SCIP_RETCODE SCIPconcsolverCreateInstance(SCIP_SET *set, SCIP_CONCSOLVERTYPE *concsolvertype, SCIP_CONCSOLVER **concsolver)
Definition: concsolver.c:210
#define SCIP_DECL_CONCSOLVERDESTROYINST(x)
SCIP_RETCODE SCIPconcsolverTypeCreate(SCIP_CONCSOLVERTYPE **concsolvertype, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, SCIP_Real prefpriodefault, SCIP_DECL_CONCSOLVERCREATEINST((*concsolvercreateinst)), SCIP_DECL_CONCSOLVERDESTROYINST((*concsolverdestroyinst)), SCIP_DECL_CONCSOLVERINITSEEDS((*concsolverinitseeds)), SCIP_DECL_CONCSOLVEREXEC((*concsolverexec)), SCIP_DECL_CONCSOLVERCOPYSOLVINGDATA((*concsolvercopysolvdata)), SCIP_DECL_CONCSOLVERSTOP((*concsolverstop)), SCIP_DECL_CONCSOLVERSYNCWRITE((*concsolversyncwrite)), SCIP_DECL_CONCSOLVERSYNCREAD((*concsolversyncread)), SCIP_DECL_CONCSOLVERTYPEFREEDATA((*concsolvertypefreedata)), SCIP_CONCSOLVERTYPEDATA *data)
Definition: concsolver.c:113
SCIP_Longint SCIPconcsolverGetNSolsShared(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:593
SCIP_Longint SCIPconcsolverGetMemTotal(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:520
#define SCIP_DECL_CONCSOLVERSTOP(x)
SCIP_Longint SCIPconcsolverGetNNodes(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:573
void SCIPconcsolverSetTimeSinceLastSync(SCIP_CONCSOLVER *concsolver, SCIP_Real time)
Definition: concsolver.c:532
void SCIPconcsolverSetData(SCIP_CONCSOLVER *concsolver, SCIP_CONCSOLVERDATA *data)
Definition: concsolver.c:289
SCIP_RETCODE SCIPconcsolverSync(SCIP_CONCSOLVER *concsolver, SCIP_SET *set)
Definition: concsolver.c:375
SCIP_Real SCIPconcsolverGetSolvingTime(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:543
SCIP_Longint SCIPconcsolverGetNSolsRecvd(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:583
SCIP_RETCODE SCIPconcsolverStop(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:356
SCIP_RETCODE SCIPconcsolverDestroyInstance(SCIP_SET *set, SCIP_CONCSOLVER **concsolver)
Definition: concsolver.c:257
#define SCIP_DECL_CONCSOLVERINITSEEDS(x)
int SCIPconcsolverGetIdx(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:623
SCIP_Real SCIPconcsolverGetSyncTime(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:553
SCIP_RETCODE SCIPconcsolverExec(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:325
#define SCIP_DECL_CONCSOLVERCOPYSOLVINGDATA(x)
SCIP_RETCODE SCIPconcsolverInitSeeds(SCIP_CONCSOLVER *concsolver, unsigned int seed)
Definition: concsolver.c:310
SCIP_Longint SCIPconcsolverGetNTighterIntBnds(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:613
#define SCIP_DECL_CONCSOLVERTYPEFREEDATA(x)
SCIP_Longint SCIPconcsolverGetNLPIterations(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:563
the type definitions for the synchronization store
SCIP_CONCSOLVERDATA * SCIPconcsolverGetData(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:279
SCIP_CONCSOLVERTYPEDATA * SCIPconcsolverTypeGetData(SCIP_CONCSOLVERTYPE *concsolvertype)
Definition: concsolver.c:169
#define SCIP_Real
Definition: def.h:186
#define SCIP_Longint
Definition: def.h:171
common defines and data types used in all packages of SCIP
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:439
void SCIPconcsolverTypeSetData(SCIP_CONCSOLVERTYPE *concsolvertype, SCIP_CONCSOLVERTYPEDATA *data)
Definition: concsolver.c:179
#define SCIP_DECL_CONCSOLVERSYNCWRITE(x)
SCIP_Real SCIPconcsolverTypeGetPrefPrio(SCIP_CONCSOLVERTYPE *concsolvertype)
Definition: concsolver.c:200
#define SCIP_DECL_CONCSOLVERCREATEINST(x)
struct SCIP_ConcSolverData SCIP_CONCSOLVERDATA
type definitions for concurrent solvers
memory allocation routines