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_prob.h 17 * @ingroup TYPEDEFINITIONS 18 * @brief type definitions for storing and manipulating the main problem 19 * @author Tobias Achterberg 20 */ 21 22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 23 24 #ifndef __SCIP_TYPE_PROB_H__ 25 #define __SCIP_TYPE_PROB_H__ 26 27 #include "scip/def.h" 28 #include "scip/type_retcode.h" 29 #include "scip/type_scip.h" 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 /** objective sense: minimization or maximization */ 36 enum SCIP_Objsense 37 { 38 SCIP_OBJSENSE_MAXIMIZE = -1, /**< maximization of objective function */ 39 SCIP_OBJSENSE_MINIMIZE = +1 /**< minimization of objective function (the default) */ 40 }; 41 typedef enum SCIP_Objsense SCIP_OBJSENSE; 42 43 typedef struct SCIP_Prob SCIP_PROB; /**< main problem to solve */ 44 typedef struct SCIP_ProbData SCIP_PROBDATA; /**< user problem data set by the reader */ 45 46 47 /** frees user data of original problem (called when the original problem is freed) 48 * 49 * This method should free the user data of the original problem. 50 * 51 * input: 52 * - scip : SCIP main data structure 53 * - probdata : pointer to the user problem data to free 54 */ 55 #define SCIP_DECL_PROBDELORIG(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROBDATA** probdata) 56 57 /** creates user data of transformed problem by transforming the original user problem data 58 * (called after problem was transformed) 59 * 60 * Because the original problem and the user data of the original problem should not be 61 * modified during the solving process, a transformed problem is created as a copy of 62 * the original problem. If the user problem data is never modified during the solving 63 * process anyways, it is enough to simple copy the user data's pointer. This is the 64 * default implementation, which is used when a NULL is given as PROBTRANS method. 65 * If the user data may be modified during the solving process (e.g. during preprocessing), 66 * the PROBTRANS method must be given and has to copy the user problem data to a different 67 * memory location. 68 * 69 * input: 70 * - scip : SCIP main data structure 71 * - sourcedata : source problem data to transform 72 * - targetdata : pointer to store created transformed problem data 73 */ 74 #define SCIP_DECL_PROBTRANS(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROBDATA* sourcedata, SCIP_PROBDATA** targetdata) 75 76 /** frees user data of transformed problem (called when the transformed problem is freed) 77 * 78 * This method has to be implemented, if the PROBTRANS method is not a simple pointer 79 * copy operation like in the default PROBTRANS implementation. It should free the 80 * user data of the transformed problem, that was created in the PROBTRANS method. 81 * 82 * input: 83 * - scip : SCIP main data structure 84 * - probdata : pointer to the user problem data to free 85 */ 86 #define SCIP_DECL_PROBDELTRANS(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROBDATA** probdata) 87 88 /** solving process initialization method of transformed data (called before the branch and bound process begins) 89 * 90 * This method is called before the branch and bound process begins and can be used to initialize user problem 91 * data that depends for example on the number of active problem variables, because these are now fixed. 92 * 93 * input: 94 * - scip : SCIP main data structure 95 * - probdata : user problem data 96 */ 97 #define SCIP_DECL_PROBINITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROBDATA* probdata) 98 99 /** solving process deinitialization method of transformed data (called before the branch and bound data is freed) 100 * 101 * This method is called before the branch and bound data is freed and should be used to free all data that 102 * was allocated in the solving process initialization method. The user has to make sure, that all LP rows associated 103 * to the transformed user problem data are released. 104 * 105 * input: 106 * - scip : SCIP main data structure 107 * - probdata : user problem data 108 * - restart : was this exit solve call triggered by a restart? 109 */ 110 #define SCIP_DECL_PROBEXITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROBDATA* probdata, SCIP_Bool restart) 111 112 /** copies user data of source SCIP for the target SCIP 113 * 114 * This method should copy the problem data of the source SCIP and create a target problem data for (target) 115 * SCIP. Implementing this callback is optional. If the copying process was successful the target SCIP gets this 116 * problem data assigned. In case the result pointer is set to SCIP_DIDNOTRUN the target SCIP will have no problem data 117 * at all. 118 * 119 * The variable map and the constraint map can be used via the function SCIPgetVarCopy() and SCIPgetConsCopy(), 120 * respectively, to get for certain variables and constraints of the source SCIP the counter parts in the target 121 * SCIP. You should be very carefully in using these two methods since they could lead to an infinite loop due to 122 * recursion. 123 * 124 * input: 125 * - scip : target SCIP data structure 126 * - sourcescip : source SCIP main data structure 127 * - sourcedata : source user problem data 128 * - varmap, : a hashmap which stores the mapping of source variables to corresponding target variables 129 * - consmap, : a hashmap which stores the mapping of source constraints to corresponding target constraints 130 * - targetdata : pointer to the target user problem data to create 131 * - global : create a global or a local copy? 132 * 133 * output: 134 * - result : pointer to store the result of the call 135 * 136 * possible return values for *result: 137 * - SCIP_DIDNOTRUN : the copying process was not performed 138 * - SCIP_SUCCESS : the copying process was successfully performed 139 */ 140 #define SCIP_DECL_PROBCOPY(x) SCIP_RETCODE x (SCIP* scip, SCIP* sourcescip, SCIP_PROBDATA* sourcedata, \ 141 SCIP_HASHMAP* varmap, SCIP_HASHMAP* consmap, SCIP_PROBDATA** targetdata, SCIP_Bool global, SCIP_RESULT* result) 142 143 #ifdef __cplusplus 144 } 145 #endif 146 147 #endif 148