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_nlpi.h 26 * @ingroup TYPEDEFINITIONS 27 * @brief type definitions for NLP solver interfaces 28 * @author Stefan Vigerske 29 * @author Thorsten Gellermann 30 */ 31 32 /** @defgroup DEFPLUGINS_NLPI Default NLP solver interfaces 33 * @ingroup DEFPLUGINS 34 * @brief implementation files (.c/.cpp files) of the default NLP solver interfaces of SCIP 35 */ 36 37 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 38 39 #ifndef __SCIP_TYPE_NLPI_H__ 40 #define __SCIP_TYPE_NLPI_H__ 41 42 #include "scip/def.h" 43 #include "scip/type_scip.h" 44 #include "scip/type_expr.h" 45 #include "scip/type_nlp.h" 46 47 #ifdef __cplusplus 48 extern "C" { 49 #endif 50 51 typedef struct SCIP_Nlpi SCIP_NLPI; /**< NLP solver interface */ 52 typedef struct SCIP_NlpiData SCIP_NLPIDATA; /**< locally defined NLP solver interface data */ 53 typedef struct SCIP_NlpiProblem SCIP_NLPIPROBLEM; /**< locally defined NLP solver interface data for a specific problem instance */ 54 55 /** NLP solver fast-fail levels */ 56 enum SCIP_NlpParam_FastFail 57 { 58 SCIP_NLPPARAM_FASTFAIL_OFF = 0, /**< never stop if progress is still possible */ 59 SCIP_NLPPARAM_FASTFAIL_CONSERVATIVE = 1, /**< stop if it seems unlikely that an improving point can be found */ 60 SCIP_NLPPARAM_FASTFAIL_AGGRESSIVE = 2 /**< stop if convergence rate is low */ 61 }; 62 /** NLP solver fast-fail levels */ 63 typedef enum SCIP_NlpParam_FastFail SCIP_NLPPARAM_FASTFAIL; 64 65 /** parameters for NLP solve */ 66 struct SCIP_NlpParam 67 { 68 SCIP_Real lobjlimit; /**< lower objective limit (cutoff) */ 69 SCIP_Real feastol; /**< feasibility tolerance (maximal allowed absolute violation of constraints and variable bounds) */ 70 SCIP_Real opttol; /**< optimality tolerance (maximal allowed absolute violation of optimality conditions) */ 71 SCIP_Real solvertol; /**< solver-specific tolerance on accuracy, e.g., maximal violation of feasibility and optimality in scaled problem (0.0: use solver default) */ 72 SCIP_Real timelimit; /**< time limit in seconds: use SCIP_REAL_MAX to use remaining time available for SCIP solve (limits/time - currenttime) */ 73 int iterlimit; /**< iteration limit */ 74 unsigned short verblevel; /**< verbosity level of output of NLP solver to the screen: 0 off, 1 normal, 2 debug, > 2 more debug */ 75 SCIP_NLPPARAM_FASTFAIL fastfail; /**< whether the NLP solver should stop early if convergence is slow */ 76 SCIP_Bool expectinfeas; /**< whether to expect an infeasible problem */ 77 SCIP_Bool warmstart; /**< whether to try to use solution of previous solve as starting point (if available) */ 78 const char* caller; /**< name of file from which NLP is solved (it's fine to set this to NULL) */ 79 }; 80 /** parameters for NLP solve */ 81 typedef struct SCIP_NlpParam SCIP_NLPPARAM; 82 83 /** default verbosity level in NLP parameters */ 84 #if defined(SCIP_DEBUG) || defined(SCIP_MOREDEBUG) || defined(SCIP_EVENMOREDEBUG) 85 #define SCIP_NLPPARAM_DEFAULT_VERBLEVEL 1 86 #else 87 #define SCIP_NLPPARAM_DEFAULT_VERBLEVEL 0 88 #endif 89 90 #if !defined(_MSC_VER) || _MSC_VER >= 1800 91 /** default values for parameters 92 * 93 * Typical use for this define is the initialization of a SCIP_NLPPARAM struct, e.g., 94 * 95 * SCIP_NLPPARAM nlpparam = { SCIP_NLPPARAM_DEFAULT(scip); } //lint !e446 96 * 97 * or 98 * 99 * SCIP_NLPPARAM nlpparam; 100 * nlpparam = (SCIP_NLPPARAM){ SCIP_NLPPARAM_DEFAULT(scip); } //lint !e446 101 */ 102 #define SCIP_NLPPARAM_DEFAULT_INITS(scip) \ 103 .lobjlimit = SCIP_REAL_MIN, \ 104 .feastol = SCIPfeastol(scip), \ 105 .opttol = SCIPdualfeastol(scip), \ 106 .solvertol = 0.0, \ 107 .timelimit = SCIP_REAL_MAX, \ 108 .iterlimit = INT_MAX, \ 109 .verblevel = SCIP_NLPPARAM_DEFAULT_VERBLEVEL, \ 110 .fastfail = SCIP_NLPPARAM_FASTFAIL_CONSERVATIVE, \ 111 .expectinfeas= FALSE, \ 112 .warmstart = FALSE, \ 113 .caller = __FILE__ 114 115 /** default values for parameters 116 * 117 * Typical use for this define is the initialization of a SCIP_NLPPARAM struct, e.g., 118 * 119 * SCIP_NLPPARAM nlpparam = SCIP_NLPPARAM_DEFAULT(scip); //lint !e446 120 * 121 * or 122 * 123 * SCIP_NLPPARAM nlpparam; 124 * nlpparam = SCIP_NLPPARAM_DEFAULT(scip); //lint !e446 125 */ 126 #define SCIP_NLPPARAM_DEFAULT(scip) (SCIP_NLPPARAM){ SCIP_NLPPARAM_DEFAULT_INITS(scip) } 127 128 #else 129 /** default NLP parameters with static initialization; required for SCIPsolveNlpi macro with ancient MSVC */ 130 static const SCIP_NLPPARAM SCIP_NLPPARAM_DEFAULT_STATIC = { 131 SCIP_REAL_MIN, SCIP_DEFAULT_FEASTOL, SCIP_DEFAULT_DUALFEASTOL, 0.0, SCIP_REAL_MAX, INT_MAX, SCIP_NLPPARAM_DEFAULT_VERBLEVEL, SCIP_NLPPARAM_FASTFAIL_CONSERVATIVE, FALSE, FALSE, __FILE__ 132 }; 133 #define SCIP_NLPPARAM_DEFAULT(scip) SCIP_NLPPARAM_DEFAULT_STATIC 134 #endif 135 136 /** macro to help printing values of SCIP_NLPPARAM struct 137 * 138 * Typical use for this define is something like 139 * 140 * SCIPdebugMsg(scip, "calling NLP solver with parameters " SCIP_NLPPARAM_PRINT(param)); 141 */ 142 #define SCIP_NLPPARAM_PRINT(param) \ 143 "lobjlimit = %g, " \ 144 "feastol = %g, " \ 145 "opttol = %g, " \ 146 "solvertol = %g, " \ 147 "timelimit = %g, " \ 148 "iterlimit = %d, " \ 149 "verblevel = %hd, " \ 150 "fastfail = %d, " \ 151 "expectinfeas = %d, " \ 152 "warmstart = %d, " \ 153 "called by %s\n", \ 154 (param).lobjlimit, (param).feastol, (param).opttol, (param).solvertol, (param).timelimit, (param).iterlimit, \ 155 (param).verblevel, (param).fastfail, (param).expectinfeas, (param).warmstart, (param).caller != NULL ? (param).caller : "unknown" 156 157 /** NLP solution status */ 158 enum SCIP_NlpSolStat 159 { 160 SCIP_NLPSOLSTAT_GLOBOPT = 0, /**< solved to global optimality */ 161 SCIP_NLPSOLSTAT_LOCOPT = 1, /**< solved to local optimality */ 162 SCIP_NLPSOLSTAT_FEASIBLE = 2, /**< feasible solution found */ 163 SCIP_NLPSOLSTAT_LOCINFEASIBLE = 3, /**< solution found is local infeasible */ 164 SCIP_NLPSOLSTAT_GLOBINFEASIBLE = 4, /**< problem is proven infeasible */ 165 SCIP_NLPSOLSTAT_UNBOUNDED = 5, /**< problem is unbounded */ 166 SCIP_NLPSOLSTAT_UNKNOWN = 6 /**< unknown solution status (e.g., problem not solved yet) */ 167 }; 168 typedef enum SCIP_NlpSolStat SCIP_NLPSOLSTAT; /**< NLP solution status */ 169 170 /** NLP solver termination status */ 171 enum SCIP_NlpTermStat 172 { 173 SCIP_NLPTERMSTAT_OKAY = 0, /**< terminated successfully */ 174 SCIP_NLPTERMSTAT_TIMELIMIT = 1, /**< time limit exceeded */ 175 SCIP_NLPTERMSTAT_ITERLIMIT = 2, /**< iteration limit exceeded */ 176 SCIP_NLPTERMSTAT_LOBJLIMIT = 3, /**< lower objective limit reached */ 177 SCIP_NLPTERMSTAT_INTERRUPT = 4, /**< SCIP has been asked to stop (SCIPinterruptSolve() called) */ 178 SCIP_NLPTERMSTAT_NUMERICERROR = 5, /**< stopped on numerical error */ 179 SCIP_NLPTERMSTAT_EVALERROR = 6, /**< stopped on function evaluation error */ 180 SCIP_NLPTERMSTAT_OUTOFMEMORY = 7, /**< memory exceeded */ 181 SCIP_NLPTERMSTAT_LICENSEERROR = 8, /**< problems with license of NLP solver */ 182 SCIP_NLPTERMSTAT_OTHER = 9 /**< other error (= this should never happen) */ 183 #if defined(GCC_VERSION) && GCC_VERSION >= 600 && !defined(__INTEL_COMPILER) /* _attribute__ ((deprecated)) within enums not allowed for older GCCs; ICC ignores attributes */ 184 ,/* for some backward compatibility */ 185 SCIP_NLPTERMSTAT_TILIM SCIP_DEPRECATED = SCIP_NLPTERMSTAT_TIMELIMIT, 186 SCIP_NLPTERMSTAT_ITLIM SCIP_DEPRECATED = SCIP_NLPTERMSTAT_ITERLIMIT, 187 SCIP_NLPTERMSTAT_LOBJLIM SCIP_DEPRECATED = SCIP_NLPTERMSTAT_LOBJLIMIT, 188 SCIP_NLPTERMSTAT_NUMERR SCIP_DEPRECATED = SCIP_NLPTERMSTAT_NUMERICERROR, 189 SCIP_NLPTERMSTAT_EVALERR SCIP_DEPRECATED = SCIP_NLPTERMSTAT_EVALERROR, 190 SCIP_NLPTERMSTAT_MEMERR SCIP_DEPRECATED = SCIP_NLPTERMSTAT_OUTOFMEMORY, 191 SCIP_NLPTERMSTAT_LICERR SCIP_DEPRECATED = SCIP_NLPTERMSTAT_LICENSEERROR 192 #endif 193 }; 194 typedef enum SCIP_NlpTermStat SCIP_NLPTERMSTAT; /**< NLP solver termination status */ 195 196 /** Statistics from an NLP solve */ 197 struct SCIP_NlpStatistics 198 { 199 int niterations; /**< number of iterations the NLP solver spend in the last solve command */ 200 SCIP_Real totaltime; /**< total time in CPU sections the NLP solver spend in the last solve command */ 201 SCIP_Real evaltime; /**< time spend in evaluation of functions and their derivatives (only measured if timing/nlpieval = TRUE) */ 202 203 SCIP_Real consviol; /**< maximal absolute constraint violation in current solution, or SCIP_INVALID if not available */ 204 SCIP_Real boundviol; /**< maximal absolute variable bound violation in current solution, or SCIP_INVALID if not available */ 205 }; 206 typedef struct SCIP_NlpStatistics SCIP_NLPSTATISTICS; /**< NLP solve statistics */ 207 208 /** copy method of NLP interface (called when SCIP copies plugins) 209 * 210 * Implementation of this callback is optional. 211 * 212 * \param[in] scip target SCIP where to include copy of NLPI 213 * \param[in] sourcenlpi the NLP interface to copy 214 */ 215 #define SCIP_DECL_NLPICOPY(x) SCIP_RETCODE x (\ 216 SCIP* scip, \ 217 SCIP_NLPI* sourcenlpi) 218 219 /** frees the data of the NLP interface 220 * 221 * \param[in] scip SCIP data structure 222 * \param[in] nlpi datastructure for solver interface 223 * \param[in] nlpidata NLPI data to free 224 */ 225 #define SCIP_DECL_NLPIFREE(x) SCIP_RETCODE x (\ 226 SCIP* scip, \ 227 SCIP_NLPI* nlpi, \ 228 SCIP_NLPIDATA** nlpidata) 229 230 /** gets pointer to solver-internal NLP solver 231 * 232 * Implementation of this callback is optional. 233 * 234 * Depending on the solver interface, a solver pointer may exist for every NLP problem instance. 235 * For this case, a nlpiproblem can be passed in as well. 236 * 237 * \param[in] scip SCIP data structure 238 * \param[in] nlpi datastructure for solver interface 239 * \param[in] problem datastructure for problem instance, or NULL 240 * 241 * \return void pointer to solver 242 */ 243 #define SCIP_DECL_NLPIGETSOLVERPOINTER(x) void* x (\ 244 SCIP* scip, \ 245 SCIP_NLPI* nlpi, \ 246 SCIP_NLPIPROBLEM* problem) 247 248 /** creates a problem instance 249 * 250 * \param[in] scip SCIP data structure 251 * \param[in] nlpi datastructure for solver interface 252 * \param[out] problem pointer to store the problem data 253 * \param[in] name name of problem, can be NULL 254 */ 255 #define SCIP_DECL_NLPICREATEPROBLEM(x) SCIP_RETCODE x (\ 256 SCIP* scip, \ 257 SCIP_NLPI* nlpi, \ 258 SCIP_NLPIPROBLEM** problem, \ 259 const char* name) 260 261 /** free a problem instance 262 * 263 * \param[in] scip SCIP data structure 264 * \param[in] nlpi datastructure for solver interface 265 * \param[in] problem pointer where problem data is stored 266 */ 267 #define SCIP_DECL_NLPIFREEPROBLEM(x) SCIP_RETCODE x (\ 268 SCIP* scip, \ 269 SCIP_NLPI* nlpi, \ 270 SCIP_NLPIPROBLEM** problem) 271 272 /** gets pointer to solver-internal problem instance 273 * 274 * Implementation of this callback is optional. 275 * 276 * \param[in] scip SCIP data structure 277 * \param[in] nlpi datastructure for solver interface 278 * \param[in] problem datastructure for problem instance 279 * 280 * \return void pointer to problem instance 281 */ 282 #define SCIP_DECL_NLPIGETPROBLEMPOINTER(x) void* x (\ 283 SCIP* scip, \ 284 SCIP_NLPI* nlpi, \ 285 SCIP_NLPIPROBLEM* problem) 286 287 /** adds variables 288 * 289 * \param[in] scip SCIP data structure 290 * \param[in] nlpi datastructure for solver interface 291 * \param[in] problem datastructure for problem instance 292 * \param[in] nvars number of variables 293 * \param[in] lbs lower bounds of variables, can be NULL if -infinity 294 * \param[in] ubs upper bounds of variables, can be NULL if +infinity 295 * \param[in] varnames names of variables, can be NULL 296 */ 297 #define SCIP_DECL_NLPIADDVARS(x) SCIP_RETCODE x (\ 298 SCIP* scip, \ 299 SCIP_NLPI* nlpi, \ 300 SCIP_NLPIPROBLEM* problem, \ 301 int nvars, \ 302 const SCIP_Real* lbs, \ 303 const SCIP_Real* ubs, \ 304 const char** varnames) 305 306 /** add constraints 307 * 308 * \param[in] scip SCIP data structure 309 * \param[in] nlpi datastructure for solver interface 310 * \param[in] problem datastructure for problem instance 311 * \param[in] ncons number of added constraints 312 * \param[in] lhss left hand sides of constraints, can be NULL if -infinity 313 * \param[in] rhss right hand sides of constraints, can be NULL if +infinity 314 * \param[in] nlininds number of linear coefficients for each constraint; may be NULL in case of no linear part 315 * \param[in] lininds indices of variables for linear coefficients for each constraint; may be NULL in case of no linear part 316 * \param[in] linvals values of linear coefficient for each constraint; may be NULL in case of no linear part 317 * \param[in] exprs expressions for nonlinear part of constraints; may be NULL or entries may be NULL when no nonlinear parts 318 * \param[in] names names of constraints; may be NULL or entries may be NULL 319 */ 320 #define SCIP_DECL_NLPIADDCONSTRAINTS(x) SCIP_RETCODE x (\ 321 SCIP* scip, \ 322 SCIP_NLPI* nlpi, \ 323 SCIP_NLPIPROBLEM* problem, \ 324 int nconss, \ 325 const SCIP_Real* lhss, \ 326 const SCIP_Real* rhss, \ 327 const int* nlininds, \ 328 int* const* lininds, \ 329 SCIP_Real* const* linvals, \ 330 SCIP_EXPR** exprs, \ 331 const char** names) 332 333 /** sets or overwrites objective, a minimization problem is expected 334 * 335 * \param[in] scip SCIP data structure 336 * \param[in] nlpi datastructure for solver interface 337 * \param[in] problem datastructure for problem instance 338 * \param[in] nlins number of linear variables 339 * \param[in] lininds variable indices; may be NULL in case of no linear part 340 * \param[in] linvals coefficient values; may be NULL in case of no linear part 341 * \param[in] expr expression for nonlinear part of objective function; may be NULL in case of no nonlinear part 342 * \param[in] constant objective value offset 343 */ 344 #define SCIP_DECL_NLPISETOBJECTIVE(x) SCIP_RETCODE x (\ 345 SCIP* scip, \ 346 SCIP_NLPI* nlpi, \ 347 SCIP_NLPIPROBLEM* problem, \ 348 int nlins, \ 349 const int* lininds, \ 350 const SCIP_Real* linvals, \ 351 SCIP_EXPR* expr, \ 352 const SCIP_Real constant) 353 354 /** change variable bounds 355 * 356 * \param[in] scip SCIP data structure 357 * \param[in] nlpi datastructure for solver interface 358 * \param[in] problem datastructure for problem instance 359 * \param[in] nvars number of variables to change bounds 360 * \param[in] indices indices of variables to change bounds 361 * \param[in] lbs new lower bounds 362 * \param[in] ubs new upper bounds 363 */ 364 #define SCIP_DECL_NLPICHGVARBOUNDS(x) SCIP_RETCODE x (\ 365 SCIP* scip, \ 366 SCIP_NLPI* nlpi, \ 367 SCIP_NLPIPROBLEM* problem, \ 368 const int nvars, \ 369 const int* indices, \ 370 const SCIP_Real* lbs, \ 371 const SCIP_Real* ubs) 372 373 /** change constraint sides 374 * 375 * \param[in] scip SCIP data structure 376 * \param[in] nlpi datastructure for solver interface 377 * \param[in] problem datastructure for problem instance 378 * \param[in] nconss number of constraints to change sides 379 * \param[in] indices indices of constraints to change sides 380 * \param[in] lhss new left hand sides 381 * \param[in] rhss new right hand sides 382 */ 383 #define SCIP_DECL_NLPICHGCONSSIDES(x) SCIP_RETCODE x (\ 384 SCIP* scip, \ 385 SCIP_NLPI* nlpi, \ 386 SCIP_NLPIPROBLEM* problem, \ 387 int nconss, \ 388 const int* indices, \ 389 const SCIP_Real* lhss, \ 390 const SCIP_Real* rhss) 391 392 /** delete a set of variables 393 * 394 * \param[in] scip SCIP data structure 395 * \param[in] nlpi datastructure for solver interface 396 * \param[in] problem datastructure for problem instance 397 * \param[in,out] dstats deletion status of vars on input (1 if var should be deleted, 0 if not); new position of var on output, -1 if var was deleted 398 * \param[in] dstatssize size of the dstats array 399 */ 400 #define SCIP_DECL_NLPIDELVARSET(x) SCIP_RETCODE x (\ 401 SCIP* scip, \ 402 SCIP_NLPI* nlpi, \ 403 SCIP_NLPIPROBLEM* problem, \ 404 int* dstats, \ 405 int dstatssize) 406 407 /** delete a set of constraints 408 * 409 * \param[in] scip SCIP data structure 410 * \param[in] nlpi datastructure for solver interface 411 * \param[in] problem datastructure for problem instance 412 * \param[in,out] dstats deletion status of constraints on input (1 if constraint should be deleted, 0 if not); new position of constraint on output, -1 if constraint was deleted 413 * \param[in] dstatssize size of the dstats array 414 */ 415 #define SCIP_DECL_NLPIDELCONSSET(x) SCIP_RETCODE x (\ 416 SCIP* scip, \ 417 SCIP_NLPI* nlpi, \ 418 SCIP_NLPIPROBLEM* problem, \ 419 int* dstats, \ 420 int dstatssize) 421 422 /** changes (or adds) linear coefficients in a constraint or objective 423 * 424 * \param[in] scip SCIP data structure 425 * \param[in] nlpi datastructure for solver interface 426 * \param[in] problem datastructure for problem instance 427 * \param[in] idx index of constraint or -1 for objective 428 * \param[in] nvals number of values in linear constraint to change 429 * \param[in] varidxs indices of variables which coefficient to change 430 * \param[in] vals new values for coefficients 431 */ 432 #define SCIP_DECL_NLPICHGLINEARCOEFS(x) SCIP_RETCODE x (\ 433 SCIP* scip, \ 434 SCIP_NLPI* nlpi, \ 435 SCIP_NLPIPROBLEM* problem, \ 436 int idx, \ 437 int nvals, \ 438 const int* varidxs, \ 439 const SCIP_Real* vals) 440 441 /** replaces the expression of a constraint or objective 442 * 443 * \param[in] scip SCIP data structure 444 * \param[in] nlpi datastructure for solver interface 445 * \param[in] problem datastructure for problem instance 446 * \param[in] idxcons index of constraint or -1 for objective 447 * \param[in] expr new expression for constraint or objective, or NULL to only remove previous tree 448 */ 449 #define SCIP_DECL_NLPICHGEXPR(x) SCIP_RETCODE x (\ 450 SCIP* scip, \ 451 SCIP_NLPI* nlpi, \ 452 SCIP_NLPIPROBLEM* problem, \ 453 int idxcons, \ 454 SCIP_EXPR* expr) 455 456 /** changes the constant offset in the objective 457 * 458 * \param[in] scip SCIP data structure 459 * \param[in] nlpi datastructure for solver interface 460 * \param[in] problem datastructure for problem instance 461 * \param[in] objconstant new value for objective constant 462 */ 463 #define SCIP_DECL_NLPICHGOBJCONSTANT(x) SCIP_RETCODE x (\ 464 SCIP* scip, \ 465 SCIP_NLPI* nlpi, \ 466 SCIP_NLPIPROBLEM* problem, \ 467 SCIP_Real objconstant) 468 469 /** sets initial guess 470 * 471 * Implementation of this callback is optional. 472 * 473 * \param[in] scip SCIP data structure 474 * \param[in] nlpi datastructure for solver interface 475 * \param[in] problem datastructure for problem instance 476 * \param[in] primalvalues initial primal values for variables, or NULL to clear previous values 477 * \param[in] consdualvalues initial dual values for constraints, or NULL to clear previous values 478 * \param[in] varlbdualvalues initial dual values for variable lower bounds, or NULL to clear previous values 479 * \param[in] varubdualvalues initial dual values for variable upper bounds, or NULL to clear previous values 480 */ 481 #define SCIP_DECL_NLPISETINITIALGUESS(x) SCIP_RETCODE x (\ 482 SCIP* scip, \ 483 SCIP_NLPI* nlpi, \ 484 SCIP_NLPIPROBLEM* problem, \ 485 SCIP_Real* primalvalues, \ 486 SCIP_Real* consdualvalues, \ 487 SCIP_Real* varlbdualvalues, \ 488 SCIP_Real* varubdualvalues) 489 490 /** tries to solve NLP 491 * 492 * \param[in] scip SCIP data structure 493 * \param[in] nlpi datastructure for solver interface 494 * \param[in] problem datastructure for problem instance 495 * \param[in] param parameters (e.g., working limits) to use 496 */ 497 #define SCIP_DECL_NLPISOLVE(x) SCIP_RETCODE x (\ 498 SCIP* scip, \ 499 SCIP_NLPI* nlpi, \ 500 SCIP_NLPIPROBLEM* problem, \ 501 SCIP_NLPPARAM param) 502 503 /** gives solution status 504 * 505 * \param[in] scip SCIP data structure 506 * \param[in] nlpi datastructure for solver interface 507 * \param[in] problem datastructure for problem instance 508 * 509 * \return Solution Status 510 */ 511 #define SCIP_DECL_NLPIGETSOLSTAT(x) SCIP_NLPSOLSTAT x (\ 512 SCIP* scip, \ 513 SCIP_NLPI* nlpi, \ 514 SCIP_NLPIPROBLEM* problem) 515 516 /** gives termination reason 517 * 518 * \param[in] scip SCIP data structure 519 * \param[in] nlpi datastructure for solver interface 520 * \param[in] problem datastructure for problem instance 521 * 522 * \return Termination Status 523 */ 524 #define SCIP_DECL_NLPIGETTERMSTAT(x) SCIP_NLPTERMSTAT x (\ 525 SCIP* scip, \ 526 SCIP_NLPI* nlpi, \ 527 SCIP_NLPIPROBLEM* problem) 528 529 /** gives primal and dual solution values 530 * 531 * Solver can return NULL in dual values if not available, 532 * but if solver provides dual values for one side of variable bounds, then it must also provide those for the other side. 533 * 534 * For a ranged constraint, the dual variable is positive if the right hand side is active and negative if the left hand side is active. 535 * 536 * \param[in] scip SCIP data structure 537 * \param[in] nlpi datastructure for solver interface 538 * \param[in] problem datastructure for problem instance 539 * \param[out] primalvalues buffer to store pointer to array to primal values, or NULL if not needed 540 * \param[out] consdualvalues buffer to store pointer to array to dual values of constraints, or NULL if not needed 541 * \param[out] varlbdualvalues buffer to store pointer to array to dual values of variable lower bounds, or NULL if not needed 542 * \param[out] varubdualvalues buffer to store pointer to array to dual values of variable lower bounds, or NULL if not needed 543 * \param[out] objval pointer to store the objective value, or NULL if not needed 544 */ 545 #define SCIP_DECL_NLPIGETSOLUTION(x) SCIP_RETCODE x (\ 546 SCIP* scip, \ 547 SCIP_NLPI* nlpi, \ 548 SCIP_NLPIPROBLEM* problem, \ 549 SCIP_Real** primalvalues, \ 550 SCIP_Real** consdualvalues, \ 551 SCIP_Real** varlbdualvalues, \ 552 SCIP_Real** varubdualvalues, \ 553 SCIP_Real* objval) 554 555 /** gives solve statistics 556 * 557 * \param[in] scip SCIP data structure 558 * \param[in] nlpi datastructure for solver interface 559 * \param[in] problem datastructure for problem instance 560 * \param[out] statistics buffer where to store statistics 561 */ 562 #define SCIP_DECL_NLPIGETSTATISTICS(x) SCIP_RETCODE x (\ 563 SCIP* scip, \ 564 SCIP_NLPI* nlpi, \ 565 SCIP_NLPIPROBLEM* problem, \ 566 SCIP_NLPSTATISTICS* statistics) 567 568 #ifdef __cplusplus 569 } 570 #endif 571 572 #endif /*__SCIP_TYPE_NLPI_H__ */ 573