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 pub_nlhdlr.h 26 * @brief public functions of nonlinear handlers of nonlinear constraints 27 * @ingroup PUBLICCOREAPI 28 * @author Ksenia Bestuzheva 29 * @author Benjamin Mueller 30 * @author Felipe Serrano 31 * @author Stefan Vigerske 32 */ 33 34 #ifndef SCIP_PUB_NLHDLR_H_ 35 #define SCIP_PUB_NLHDLR_H_ 36 37 #include "scip/def.h" 38 #include "scip/type_scip.h" 39 #include "scip/type_nlhdlr.h" 40 41 #ifdef NDEBUG 42 #include "scip/struct_nlhdlr.h" 43 #endif 44 45 #ifdef __cplusplus 46 extern "C" { 47 #endif 48 49 /**@addtogroup PublicNlhdlrInterfaceMethods 50 * @{ 51 */ 52 53 /** sets the copy handler callback of a nonlinear handler */ 54 SCIP_EXPORT 55 void SCIPnlhdlrSetCopyHdlr( 56 SCIP_NLHDLR* nlhdlr, /**< nonlinear handler */ 57 SCIP_DECL_NLHDLRCOPYHDLR((*copy)) /**< copy callback (can be NULL) */ 58 ); 59 60 /** sets the nonlinear handler callback to free the nonlinear handler data */ 61 SCIP_EXPORT 62 void SCIPnlhdlrSetFreeHdlrData( 63 SCIP_NLHDLR* nlhdlr, /**< nonlinear handler */ 64 SCIP_DECL_NLHDLRFREEHDLRDATA((*freehdlrdata)) /**< handler free callback (can be NULL) */ 65 ); 66 67 /** sets the nonlinear handler callback to free expression specific data of nonlinear handler */ 68 SCIP_EXPORT 69 void SCIPnlhdlrSetFreeExprData( 70 SCIP_NLHDLR* nlhdlr, /**< nonlinear handler */ 71 SCIP_DECL_NLHDLRFREEEXPRDATA((*freeexprdata)) /**< nonlinear handler expression data free callback (can be NULL if data does not need to be freed) */ 72 ); 73 74 /** sets the initialization and deinitialization callback of a nonlinear handler */ 75 SCIP_EXPORT 76 void SCIPnlhdlrSetInitExit( 77 SCIP_NLHDLR* nlhdlr, /**< nonlinear handler */ 78 SCIP_DECL_NLHDLRINIT((*init)), /**< initialization callback (can be NULL) */ 79 SCIP_DECL_NLHDLREXIT((*exit)) /**< deinitialization callback (can be NULL) */ 80 ); 81 82 /** sets the propagation callbacks of a nonlinear handler */ 83 SCIP_EXPORT 84 void SCIPnlhdlrSetProp( 85 SCIP_NLHDLR* nlhdlr, /**< nonlinear handler */ 86 SCIP_DECL_NLHDLRINTEVAL((*inteval)), /**< interval evaluation callback (can be NULL) */ 87 SCIP_DECL_NLHDLRREVERSEPROP((*reverseprop)) /**< reverse propagation callback (can be NULL) */ 88 ); 89 90 /** sets the enforcement callbacks of a nonlinear handler */ 91 SCIP_EXPORT 92 void SCIPnlhdlrSetSepa( 93 SCIP_NLHDLR* nlhdlr, /**< nonlinear handler */ 94 SCIP_DECL_NLHDLRINITSEPA((*initsepa)), /**< separation initialization callback (can be NULL) */ 95 SCIP_DECL_NLHDLRENFO((*enfo)), /**< enforcement callback (can be NULL if estimate is not NULL) */ 96 SCIP_DECL_NLHDLRESTIMATE((*estimate)), /**< estimation callback (can be NULL if sepa is not NULL) */ 97 SCIP_DECL_NLHDLREXITSEPA((*exitsepa)) /**< separation deinitialization callback (can be NULL) */ 98 ); 99 100 /** sets the solution linearization callback of a nonlinear handler */ 101 SCIP_EXPORT 102 void SCIPnlhdlrSetSollinearize( 103 SCIP_NLHDLR* nlhdlr, /**< nonlinear handler */ 104 SCIP_DECL_NLHDLRSOLLINEARIZE((*sollinearize)) /**< solution linearization callback */ 105 ); 106 107 /** gives name of nonlinear handler */ 108 SCIP_EXPORT 109 const char* SCIPnlhdlrGetName( 110 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */ 111 ); 112 113 /** gives description of nonlinear handler, can be NULL */ 114 SCIP_EXPORT 115 const char* SCIPnlhdlrGetDesc( 116 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */ 117 ); 118 119 /** gives detection priority of nonlinear handler */ 120 SCIP_EXPORT 121 int SCIPnlhdlrGetDetectPriority( 122 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */ 123 ); 124 125 /** gives enforcement priority of nonlinear handler */ 126 SCIP_EXPORT 127 int SCIPnlhdlrGetEnfoPriority( 128 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */ 129 ); 130 131 /** returns whether nonlinear handler is enabled */ 132 SCIP_EXPORT 133 SCIP_Bool SCIPnlhdlrIsEnabled( 134 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */ 135 ); 136 137 /** gives handler data of nonlinear handler */ 138 SCIP_EXPORT 139 SCIP_NLHDLRDATA* SCIPnlhdlrGetData( 140 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */ 141 ); 142 143 /** returns whether nonlinear handler implements the interval evaluation callback */ 144 SCIP_EXPORT 145 SCIP_Bool SCIPnlhdlrHasIntEval( 146 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */ 147 ); 148 149 /** returns whether nonlinear handler implements the reverse propagation callback */ 150 SCIP_EXPORT 151 SCIP_Bool SCIPnlhdlrHasReverseProp( 152 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */ 153 ); 154 155 /** returns whether nonlinear handler implements the separation initialization callback */ 156 SCIP_EXPORT 157 SCIP_Bool SCIPnlhdlrHasInitSepa( 158 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */ 159 ); 160 161 /** returns whether nonlinear handler implements the separation deinitialization callback */ 162 SCIP_EXPORT 163 SCIP_Bool SCIPnlhdlrHasExitSepa( 164 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */ 165 ); 166 167 /** returns whether nonlinear handler implements the enforcement callback */ 168 SCIP_EXPORT 169 SCIP_Bool SCIPnlhdlrHasEnfo( 170 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */ 171 ); 172 173 /** returns whether nonlinear handler implements the estimator callback */ 174 SCIP_EXPORT 175 SCIP_Bool SCIPnlhdlrHasEstimate( 176 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */ 177 ); 178 179 /** returns whether nonlinear handler implements the solution linearization callback */ 180 SCIP_EXPORT 181 SCIP_Bool SCIPnlhdlrHasSollinearize( 182 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */ 183 ); 184 185 /** compares two nonlinear handlers by detection priority 186 * 187 * if handlers have same detection priority, then compare by name 188 */ 189 SCIP_DECL_SORTPTRCOMP(SCIPnlhdlrComp); 190 191 #ifdef NDEBUG 192 /* If NDEBUG is defined, the function calls are overwritten by defines to reduce the number of function calls and 193 * speed up the algorithms. 194 */ 195 #define SCIPnlhdlrSetCopyHdlr(nlhdlr, copy) (nlhdlr)->copyhdlr = copy 196 #define SCIPnlhdlrSetFreeHdlrData(nlhdlr, freehdlrdata_) (nlhdlr)->freehdlrdata = freehdlrdata_ 197 #define SCIPnlhdlrSetFreeExprData(nlhdlr, freeexprdata_) (nlhdlr)->freeexprdata = freeexprdata_ 198 #define SCIPnlhdlrSetInitExit(nlhdlr, init_, exit_) do { (nlhdlr)->init = init_; nlhdlr->exit = exit_; } while (FALSE) 199 #define SCIPnlhdlrSetProp(nlhdlr, inteval_, reverseprop_) do { (nlhdlr)->inteval = inteval_; nlhdlr->reverseprop = reverseprop_; } while (FALSE) 200 #define SCIPnlhdlrSetSepa(nlhdlr, initsepa_, enfo_, estimate_, exitsepa_) do { (nlhdlr)->initsepa = initsepa_; (nlhdlr)->enfo = enfo_; (nlhdlr)->estimate = estimate_; (nlhdlr)->exitsepa = exitsepa_; } while (FALSE); 201 #define SCIPnlhdlrSetSollinearize(nlhdlr, sollinearize_) (nlhdlr)->sollinearize = sollinearize_ 202 #define SCIPnlhdlrGetName(nlhdlr) (nlhdlr)->name 203 #define SCIPnlhdlrGetDesc(nlhdlr) (nlhdlr)->desc 204 #define SCIPnlhdlrGetDetectPriority(nlhdlr) (nlhdlr)->detectpriority 205 #define SCIPnlhdlrGetEnfoPriority(nlhdlr) (nlhdlr)->enfopriority 206 #define SCIPnlhdlrIsEnabled(nlhdlr) (nlhdlr)->enabled 207 #define SCIPnlhdlrGetData(nlhdlr) (nlhdlr)->data 208 #define SCIPnlhdlrHasIntEval(nlhdlr) ((nlhdlr)->inteval != NULL) 209 #define SCIPnlhdlrHasReverseProp(nlhdlr) ((nlhdlr)->reverseprop != NULL) 210 #define SCIPnlhdlrHasInitSepa(nlhdlr) ((nlhdlr)->initsepa != NULL) 211 #define SCIPnlhdlrHasExitSepa(nlhdlr) ((nlhdlr)->exitsepa != NULL) 212 #define SCIPnlhdlrHasEnfo(nlhdlr) ((nlhdlr)->enfo != NULL) 213 #define SCIPnlhdlrHasEstimate(nlhdlr) ((nlhdlr)->estimate != NULL) 214 #define SCIPnlhdlrHasSollinearize(nlhdlr) ((nlhdlr)->sollinearize != NULL) 215 #endif 216 217 /** @} */ 218 219 #ifdef __cplusplus 220 } 221 #endif 222 223 #endif /* SCIP_PUB_NLHDLR_H_ */ 224