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-2024 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 #include "scip/type_message.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /** creates a concurrent solver type */
49  SCIP_CONCSOLVERTYPE** concsolvertype, /**< pointer to concurrent solver data structure */
50  SCIP_SET* set, /**< global SCIP settings */
51  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
52  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
53  const char* name, /**< name of concurrent solver */
54  SCIP_Real prefpriodefault, /**< the default preferred priority of this concurrent solver type */
55  SCIP_DECL_CONCSOLVERCREATEINST ((*concsolvercreateinst)),/**< data copy method of concurrent solver */
56  SCIP_DECL_CONCSOLVERDESTROYINST ((*concsolverdestroyinst)),/**< data copy method of concurrent solver */
57  SCIP_DECL_CONCSOLVERINITSEEDS ((*concsolverinitseeds)),/**< initialize random seeds of concurrent solver */
58  SCIP_DECL_CONCSOLVEREXEC ((*concsolverexec)),/**< execution method of concurrent solver */
59  SCIP_DECL_CONCSOLVERCOPYSOLVINGDATA ((*concsolvercopysolvdata)),/**< method to copy solving data */
60  SCIP_DECL_CONCSOLVERSTOP ((*concsolverstop)),/**< terminate solving in concurrent solver */
61  SCIP_DECL_CONCSOLVERSYNCWRITE ((*concsolversyncwrite)),/**< synchronization method of concurrent solver */
62  SCIP_DECL_CONCSOLVERSYNCREAD ((*concsolversyncread)),/**< synchronization method of concurrent solver */
63  SCIP_DECL_CONCSOLVERTYPEFREEDATA ((*concsolvertypefreedata)),/**< method to free data of concurrent solver type */
64  SCIP_CONCSOLVERTYPEDATA* data /**< the concurent solver type's data */
65  );
66 
67 /** frees all memory of a concurrent solver type */
69  SCIP_CONCSOLVERTYPE** concsolvertype /**< pointer to concurrent solver data structure */
70  );
71 
72 /** gets the data of a concurrent solver type */
74  SCIP_CONCSOLVERTYPE* concsolvertype /**< concurrent solver type */
75  );
76 
77 /** sets the data of a concurrent solver type */
79  SCIP_CONCSOLVERTYPE* concsolvertype, /**< concurrent solver type */
80  SCIP_CONCSOLVERTYPEDATA* data /**< the concurrent solver's data */
81  );
82 
83 /** gets the name of a concurrent solver type */
85  SCIP_CONCSOLVERTYPE* concsolvertype /**< concurrent solver type */
86  );
87 
88 /** gets the preferred priority from a concurrent solver type */
90  SCIP_CONCSOLVERTYPE* concsolvertype /**< concurrent solver type */
91  );
92 
93 /** creates an instance of the given concurrent solver type */
95  SCIP_SET* set, /**< global SCIP settings */
96  SCIP_CONCSOLVERTYPE* concsolvertype, /**< concurrent solver type to create */
97  SCIP_CONCSOLVER** concsolver /**< pointer to return concurrent solver instance */
98  );
99 
100 /** destroys an instance of the given concurrent solver */
102  SCIP_SET* set, /**< global SCIP settings */
103  SCIP_CONCSOLVER** concsolver /**< concurrent solver */
104  );
105 
106 /** gets the data of a concurrent solver */
108  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
109  );
110 
111 /** sets the data of a concurrent solver */
113  SCIP_CONCSOLVER* concsolver, /**< concurrent solver */
114  SCIP_CONCSOLVERDATA* data /**< the concurrent solver's data */
115  );
116 
117 /** gets the name of a concurrent solver */
119  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
120  );
121 
122 /** initializes the random seeds of a concurrent solver */
124  SCIP_CONCSOLVER* concsolver, /**< concurrent solver */
125  unsigned int seed /**< seed for initializing the solver's internal random seeds */
126  );
127 
128 /** start the solving process of a concurrent solver */
130  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
131  );
132 
133 /** gets solving data of concurrent solver and stores it in the given SCIP instance */
135  SCIP_CONCSOLVER* concsolver, /**< concurrent solver */
136  SCIP* scip /**< SCIP datastructure */
137  );
138 
139 /** interrupt solving in a concurrent solver */
141  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
142  );
143 
144 /** let the given concurrent solver synchronize, i.e. pass its own solutions and bounds to
145  * the SPI.
146  */
148  SCIP_CONCSOLVER* concsolver, /**< concurrent solver */
149  SCIP_SET* set /**< global SCIP settings */
150  );
151 
152 /** gets the current synchronization frequency of the concurent solver */
154  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
155  );
156 
157 /** gets the total memory used by the concurent solver */
159  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
160  );
161 
162 /** sets the time elapsed since the last synchronization. Must be set before the synchronization is
163  * started.
164  */
166  SCIP_CONCSOLVER* concsolver, /**< concurrent solver */
167  SCIP_Real time /**< the time passed since the last synchronization */
168  );
169 
170 /** gets the solving time of the concurrent solver */
172  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
173  );
174 
175 /** gets the time spent for synchronization for the concurrent solver */
177  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
178  );
179 
180 /** gets the number of lp iterations the concurrent solver used */
182  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
183  );
184 
185 /** gets the number of branch and bound nodes the concurrent solver used */
187  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
188  );
189 
190 /** gets the number of solutions the concurrent solver received during synchronization */
192  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
193  );
194 
195 /** gets the number of solutions the concurrent solver shared during synchronization */
197  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
198  );
199 
200 /** gets the number of tighter global variable bounds the solver received */
202  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
203  );
204 
205 /** gets the number of tighter global variable bounds of integer variables the solver received */
207  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
208  );
209 
210 /** gets index of concurrent solver */
212  SCIP_CONCSOLVER* concsolver /**< concurrent solver */
213  );
214 
215 #ifdef __cplusplus
216 }
217 #endif
218 
219 #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:173
#define SCIP_Longint
Definition: def.h:158
type definitions for message output methods
common defines and data types used in all packages of SCIP
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:437
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