1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 2 /* */ 3 /* This file is part of the program and library */ 4 /* SCIP --- Solving Constraint Integer Programs */ 5 /* */ 6 /* Copyright (C) 2002-2021 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 scipopt.org. */ 13 /* */ 14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 15 16 /**@file type_concsolver.h 17 * @ingroup TYPEDEFINITIONS 18 * @brief type definitions for concurrent solvers 19 * @author Leona Gottwald 20 * 21 * This file defines the interface for concurrent solvers. 22 * 23 */ 24 25 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 26 27 #ifndef __SCIP_TYPE_CONCSOLVER_H__ 28 #define __SCIP_TYPE_CONCSOLVER_H__ 29 30 #include "scip/def.h" 31 #include "scip/type_scip.h" 32 #include "scip/type_stat.h" 33 #include "scip/type_lp.h" 34 #include "scip/type_syncstore.h" 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 typedef struct SCIP_ConcSolverType SCIP_CONCSOLVERTYPE; /**< the struct defining a concurrent solver class */ 41 typedef struct SCIP_ConcSolverTypeData SCIP_CONCSOLVERTYPEDATA; /**< concurrent solver class user data */ 42 typedef struct SCIP_ConcSolver SCIP_CONCSOLVER; /**< struct for an instance of a concurrent solver */ 43 typedef struct SCIP_ConcSolverData SCIP_CONCSOLVERDATA; /**< concurrent solver user data */ 44 45 /** creates a concurrent solver instance 46 * 47 * input: 48 * - scip : SCIP main data structure 49 * - concsolvertype : type of concurrent solver an instance should be created for 50 * - concsolverinstance : pointer to return concurrent solver instance 51 * 52 * returns SCIP_OKAY if everything worked, otherwise, a suitable error code 53 */ 54 #define SCIP_DECL_CONCSOLVERCREATEINST(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONCSOLVERTYPE* concsolvertype, SCIP_CONCSOLVER* concsolver) 55 56 /** destroys a concurrent solver instance 57 * 58 * input: 59 * - scip : SCIP main data structure 60 * - concsolverinstance : concurrent solver instance to destroy 61 * 62 * returns SCIP_OKAY if everything worked, otherwise, a suitable error code 63 */ 64 #define SCIP_DECL_CONCSOLVERDESTROYINST(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONCSOLVER* concsolver) 65 66 /** frees data of a concurrent solver type 67 * 68 * input: 69 * - scip : SCIP main data structure 70 * - data : concurrent solver type data to free 71 * 72 * returns SCIP_OKAY if everything worked, otherwise, a suitable error code 73 */ 74 #define SCIP_DECL_CONCSOLVERTYPEFREEDATA(x) void x (SCIP_CONCSOLVERTYPEDATA** data) 75 76 /** initialize random seeds of a concurrent solver 77 * 78 * input: 79 * - concsolver : concurrent solver data structure 80 * - seed : seed for initializing the solver's internal random seeds 81 * 82 * returns SCIP_OKAY if everything worked, otherwise, a suitable error code 83 */ 84 #define SCIP_DECL_CONCSOLVERINITSEEDS(x) SCIP_RETCODE x (SCIP_CONCSOLVER* concsolver, unsigned int seed) 85 86 /** synchronization method of concurrent solver for writing data 87 * 88 * Syncronizes with other solvers. The concurrent solver should pass new solutions 89 * and bounds to the syncstore. For the solutions, no more than maxcandsols of the best solution 90 * should be considered for sharing. Additionally a maximum if maxsharedsols should be 91 * passed to the syncstore. 92 * 93 * input: 94 * - concsolver : concurrent solver data structure 95 * - spi : pointer to the SCIP parallel interface 96 * - syncdata : concurrent solver data structure 97 * - maxcandsols : how many of the best solutions should be considered for sharing 98 * - maxsharedsols : the maximum number of solutions that should be shared 99 * 100 * returns SCIP_OKAY if everything worked, otherwise, a suitable error code 101 */ 102 #define SCIP_DECL_CONCSOLVERSYNCWRITE(x) SCIP_RETCODE x (SCIP_CONCSOLVER* concsolver, SCIP_SYNCSTORE* syncstore, SCIP_SYNCDATA* syncdata, int maxcandsols, int maxsharedsols, int* nsolsshared) 103 104 /** synchronization method of concurrent solver for reading data 105 * 106 * the concurrent solver should read the solutions and bounds stored in the 107 * given synchronization data 108 * 109 * input: 110 * - concsolver : concurrent solver data structure 111 * - spi : pointer to the SCIP parallel interface 112 * - syncdata : concurrent solver data structure 113 * 114 * returns SCIP_OKAY if everything worked, otherwise, a suitable error code 115 */ 116 #define SCIP_DECL_CONCSOLVERSYNCREAD(x) SCIP_RETCODE x (SCIP_CONCSOLVER* concsolver, SCIP_SYNCSTORE* syncstore, SCIP_SYNCDATA* syncdata, int* nsolsrecvd, int* ntighterbnds, int* ntighterintbnds) 117 118 /** execution method of concurrent solver 119 * 120 * start solving of the problem given during initialization 121 * 122 * input: 123 * - concsolver : concurrent solver data structure 124 * 125 * returns SCIP_OKAY if everything worked, otherwise, a suitable error code 126 */ 127 #define SCIP_DECL_CONCSOLVEREXEC(x) SCIP_RETCODE x (SCIP_CONCSOLVER* concsolver, SCIP_Real* solvingtime, SCIP_Longint* nlpiterations, SCIP_Longint* nnodes) 128 129 /** stop the solving as soon as possible 130 * 131 * input: 132 * - concsolver : concurrent solver data structure 133 * 134 * returns SCIP_OKAY if everything worked, otherwise, a suitable error code 135 */ 136 #define SCIP_DECL_CONCSOLVERSTOP(x) SCIP_RETCODE x (SCIP_CONCSOLVER* concsolver) 137 138 /** extract the solving data from the concurrent solver and store it into the SCIP datastructure, 139 * so that this SCIP instance has the optimal solution and reports the correct status and statistics. 140 * 141 * input: 142 * - concsolver : concurrent solver data structure 143 * - scip : SCIP datastructure 144 * 145 * returns SCIP_OKAY if everything worked, otherwise, a suitable error code 146 */ 147 #define SCIP_DECL_CONCSOLVERCOPYSOLVINGDATA(x) SCIP_RETCODE x (SCIP_CONCSOLVER* concsolver, SCIP* scip) 148 149 150 #ifdef __cplusplus 151 } 152 #endif 153 154 #endif 155