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