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 */ 47 SCIP_RETCODE SCIPconcsolverTypeCreate( 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 */ 67 void SCIPconcsolverTypeFree( 68 SCIP_CONCSOLVERTYPE** concsolvertype /**< pointer to concurrent solver data structure */ 69 ); 70 71 /** gets the data of a concurrent solver type */ 72 SCIP_CONCSOLVERTYPEDATA* SCIPconcsolverTypeGetData( 73 SCIP_CONCSOLVERTYPE* concsolvertype /**< concurrent solver type */ 74 ); 75 76 /** sets the data of a concurrent solver type */ 77 void SCIPconcsolverTypeSetData( 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 */ 83 char* SCIPconcsolverTypeGetName( 84 SCIP_CONCSOLVERTYPE* concsolvertype /**< concurrent solver type */ 85 ); 86 87 /** gets the preferred priority from a concurrent solver type */ 88 SCIP_Real SCIPconcsolverTypeGetPrefPrio( 89 SCIP_CONCSOLVERTYPE* concsolvertype /**< concurrent solver type */ 90 ); 91 92 /** creates an instance of the given concurrent solver type */ 93 SCIP_RETCODE SCIPconcsolverCreateInstance( 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 */ 100 SCIP_RETCODE SCIPconcsolverDestroyInstance( 101 SCIP_SET* set, /**< global SCIP settings */ 102 SCIP_CONCSOLVER** concsolver /**< concurrent solver */ 103 ); 104 105 /** gets the data of a concurrent solver */ 106 SCIP_CONCSOLVERDATA* SCIPconcsolverGetData( 107 SCIP_CONCSOLVER* concsolver /**< concurrent solver */ 108 ); 109 110 /** sets the data of a concurrent solver */ 111 void SCIPconcsolverSetData( 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 */ 117 char* SCIPconcsolverGetName( 118 SCIP_CONCSOLVER* concsolver /**< concurrent solver */ 119 ); 120 121 /** initializes the random seeds of a concurrent solver */ 122 SCIP_RETCODE SCIPconcsolverInitSeeds( 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 */ 128 SCIP_RETCODE SCIPconcsolverExec( 129 SCIP_CONCSOLVER* concsolver /**< concurrent solver */ 130 ); 131 132 /** gets solving data of concurrent solver and stores it in the given SCIP instance */ 133 SCIP_RETCODE SCIPconcsolverGetSolvingData( 134 SCIP_CONCSOLVER* concsolver, /**< concurrent solver */ 135 SCIP* scip /**< SCIP datastructure */ 136 ); 137 138 /** interrupt solving in a concurrent solver */ 139 SCIP_RETCODE SCIPconcsolverStop( 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 */ 146 SCIP_RETCODE SCIPconcsolverSync( 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 */ 152 SCIP_Real SCIPconcsolverGetSyncFreq( 153 SCIP_CONCSOLVER* concsolver /**< concurrent solver */ 154 ); 155 156 /** gets the total memory used by the concurent solver */ 157 SCIP_Longint SCIPconcsolverGetMemTotal( 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 */ 164 void SCIPconcsolverSetTimeSinceLastSync( 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 */ 170 SCIP_Real SCIPconcsolverGetSolvingTime( 171 SCIP_CONCSOLVER* concsolver /**< concurrent solver */ 172 ); 173 174 /** gets the time spent for synchronization for the concurrent solver */ 175 SCIP_Real SCIPconcsolverGetSyncTime( 176 SCIP_CONCSOLVER* concsolver /**< concurrent solver */ 177 ); 178 179 /** gets the number of lp iterations the concurrent solver used */ 180 SCIP_Longint SCIPconcsolverGetNLPIterations( 181 SCIP_CONCSOLVER* concsolver /**< concurrent solver */ 182 ); 183 184 /** gets the number of branch and bound nodes the concurrent solver used */ 185 SCIP_Longint SCIPconcsolverGetNNodes( 186 SCIP_CONCSOLVER* concsolver /**< concurrent solver */ 187 ); 188 189 /** gets the number of solutions the concurrent solver received during synchronization */ 190 SCIP_Longint SCIPconcsolverGetNSolsRecvd( 191 SCIP_CONCSOLVER* concsolver /**< concurrent solver */ 192 ); 193 194 /** gets the number of solutions the concurrent solver shared during synchronization */ 195 SCIP_Longint SCIPconcsolverGetNSolsShared( 196 SCIP_CONCSOLVER* concsolver /**< concurrent solver */ 197 ); 198 199 /** gets the number of tighter global variable bounds the solver received */ 200 SCIP_Longint SCIPconcsolverGetNTighterBnds( 201 SCIP_CONCSOLVER* concsolver /**< concurrent solver */ 202 ); 203 204 /** gets the number of tighter global variable bounds of integer variables the solver received */ 205 SCIP_Longint SCIPconcsolverGetNTighterIntBnds( 206 SCIP_CONCSOLVER* concsolver /**< concurrent solver */ 207 ); 208 209 /** gets index of concurrent solver */ 210 int SCIPconcsolverGetIdx( 211 SCIP_CONCSOLVER* concsolver /**< concurrent solver */ 212 ); 213 214 #ifdef __cplusplus 215 } 216 #endif 217 218 #endif 219