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 nlp.h 26 * @ingroup INTERNALAPI 27 * @brief internal methods for NLP management 28 * @author Thorsten Gellermann 29 * @author Stefan Vigerske 30 */ 31 32 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 33 34 #ifndef __SCIP_NLP_H__ 35 #define __SCIP_NLP_H__ 36 37 38 #include <stdio.h> 39 40 #include "scip/def.h" 41 #include "blockmemshell/memory.h" 42 #include "scip/type_event.h" 43 #include "scip/type_set.h" 44 #include "scip/type_stat.h" 45 #include "scip/type_misc.h" 46 #include "scip/type_lp.h" 47 #include "scip/type_var.h" 48 #include "scip/type_prob.h" 49 #include "scip/type_sol.h" 50 #include "scip/type_primal.h" 51 #include "scip/pub_nlp.h" 52 53 #ifdef __cplusplus 54 extern "C" { 55 #endif 56 57 /**@name Nonlinear row methods */ 58 /**@{ */ 59 60 /** create a new nonlinear row 61 * 62 * the new row is already captured 63 */ 64 SCIP_RETCODE SCIPnlrowCreate( 65 SCIP_NLROW** nlrow, /**< buffer to store pointer to nonlinear row */ 66 BMS_BLKMEM* blkmem, /**< block memory */ 67 SCIP_SET* set, /**< global SCIP settings */ 68 SCIP_STAT* stat, /**< problem statistics data */ 69 const char* name, /**< name of nonlinear row */ 70 SCIP_Real constant, /**< constant */ 71 int nlinvars, /**< number of linear variables */ 72 SCIP_VAR** linvars, /**< linear variables, or NULL if nlinvars == 0 */ 73 SCIP_Real* lincoefs, /**< linear coefficients, or NULL if nlinvars == 0 */ 74 SCIP_EXPR* expr, /**< expression, or NULL */ 75 SCIP_Real lhs, /**< left hand side */ 76 SCIP_Real rhs, /**< right hand side */ 77 SCIP_EXPRCURV curvature /**< curvature of the nonlinear row */ 78 ); 79 80 /** create a nonlinear row that is a copy of a given row 81 * 82 * the new row is already captured 83 */ 84 SCIP_RETCODE SCIPnlrowCreateCopy( 85 SCIP_NLROW** nlrow, /**< buffer to store pointer to nonlinear row */ 86 BMS_BLKMEM* blkmem, /**< block memory */ 87 SCIP_SET* set, /**< global SCIP settings */ 88 SCIP_STAT* stat, /**< problem statistics data */ 89 SCIP_NLROW* sourcenlrow /**< nonlinear row to copy */ 90 ); 91 92 /** create a new nonlinear row from a linear row 93 * 94 * the new row is already captured 95 */ 96 SCIP_RETCODE SCIPnlrowCreateFromRow( 97 SCIP_NLROW** nlrow, /**< buffer to store pointer to nonlinear row */ 98 BMS_BLKMEM* blkmem, /**< block memory */ 99 SCIP_SET* set, /**< global SCIP settings */ 100 SCIP_STAT* stat, /**< problem statistics data */ 101 SCIP_ROW* row /**< the linear row to copy */ 102 ); 103 104 /** output nonlinear row to file stream */ 105 SCIP_RETCODE SCIPnlrowPrint( 106 SCIP_NLROW* nlrow, /**< NLP row */ 107 BMS_BLKMEM* blkmem, /**< block memory */ 108 SCIP_SET* set, /**< global SCIP settings */ 109 SCIP_STAT* stat, /**< problem statistics data */ 110 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 111 FILE* file /**< output file (or NULL for standard output) */ 112 ); 113 114 /** increases usage counter of nonlinear row */ 115 void SCIPnlrowCapture( 116 SCIP_NLROW* nlrow /**< nonlinear row to capture */ 117 ); 118 119 /** decreases usage counter of nonlinear row */ 120 SCIP_RETCODE SCIPnlrowRelease( 121 SCIP_NLROW** nlrow, /**< nonlinear row to free */ 122 BMS_BLKMEM* blkmem, /**< block memory */ 123 SCIP_SET* set, /**< global SCIP settings */ 124 SCIP_STAT* stat /**< problem statistics data */ 125 ); 126 127 /** ensures, that linear coefficient array of nonlinear row can store at least num entries */ 128 SCIP_RETCODE SCIPnlrowEnsureLinearSize( 129 SCIP_NLROW* nlrow, /**< NLP row */ 130 BMS_BLKMEM* blkmem, /**< block memory */ 131 SCIP_SET* set, /**< global SCIP settings */ 132 int num /**< minimum number of entries to store */ 133 ); 134 135 /** adds a previously non existing linear coefficient to a nonlinear row */ 136 SCIP_RETCODE SCIPnlrowAddLinearCoef( 137 SCIP_NLROW* nlrow, /**< NLP nonlinear row */ 138 BMS_BLKMEM* blkmem, /**< block memory */ 139 SCIP_SET* set, /**< global SCIP settings */ 140 SCIP_STAT* stat, /**< problem statistics data */ 141 SCIP_NLP* nlp, /**< current NLP data */ 142 SCIP_VAR* var, /**< variable */ 143 SCIP_Real val /**< value of coefficient */ 144 ); 145 146 /** deletes linear coefficient from nonlinear row */ 147 SCIP_RETCODE SCIPnlrowDelLinearCoef( 148 SCIP_NLROW* nlrow, /**< nonlinear row to be changed */ 149 SCIP_SET* set, /**< global SCIP settings */ 150 SCIP_STAT* stat, /**< problem statistics data */ 151 SCIP_NLP* nlp, /**< current NLP data */ 152 SCIP_VAR* var /**< coefficient to be deleted */ 153 ); 154 155 /** changes or adds a linear coefficient to a nonlinear row */ 156 SCIP_RETCODE SCIPnlrowChgLinearCoef( 157 SCIP_NLROW* nlrow, /**< nonlinear row */ 158 BMS_BLKMEM* blkmem, /**< block memory */ 159 SCIP_SET* set, /**< global SCIP settings */ 160 SCIP_STAT* stat, /**< problem statistics data */ 161 SCIP_NLP* nlp, /**< current NLP data */ 162 SCIP_VAR* var, /**< variable */ 163 SCIP_Real coef /**< new value of coefficient */ 164 ); 165 166 /** replaces or deletes an expression in a nonlinear row */ 167 SCIP_RETCODE SCIPnlrowChgExpr( 168 SCIP_NLROW* nlrow, /**< nonlinear row */ 169 BMS_BLKMEM* blkmem, /**< block memory */ 170 SCIP_SET* set, /**< global SCIP settings */ 171 SCIP_STAT* stat, /**< problem statistics data */ 172 SCIP_NLP* nlp, /**< current NLP data */ 173 SCIP_EXPR* expr /**< new expression, or NULL to delete current one */ 174 ); 175 176 /** changes constant of nonlinear row */ 177 SCIP_RETCODE SCIPnlrowChgConstant( 178 SCIP_NLROW* nlrow, /**< nonlinear row */ 179 SCIP_SET* set, /**< global SCIP settings */ 180 SCIP_STAT* stat, /**< problem statistics data */ 181 SCIP_NLP* nlp, /**< current NLP data */ 182 SCIP_Real constant /**< new constant */ 183 ); 184 185 /** changes left hand side of nonlinear row */ 186 SCIP_RETCODE SCIPnlrowChgLhs( 187 SCIP_NLROW* nlrow, /**< nonlinear row */ 188 SCIP_SET* set, /**< global SCIP settings */ 189 SCIP_STAT* stat, /**< problem statistics data */ 190 SCIP_NLP* nlp, /**< current NLP data */ 191 SCIP_Real lhs /**< new left hand side */ 192 ); 193 194 /** changes right hand side of nonlinear row */ 195 SCIP_RETCODE SCIPnlrowChgRhs( 196 SCIP_NLROW* nlrow, /**< nonlinear row */ 197 SCIP_SET* set, /**< global SCIP settings */ 198 SCIP_STAT* stat, /**< problem statistics data */ 199 SCIP_NLP* nlp, /**< current NLP data */ 200 SCIP_Real rhs /**< new right hand side */ 201 ); 202 203 /** sets the curvature of a nonlinear row */ 204 void SCIPnlrowSetCurvature( 205 SCIP_NLP* nlp, /**< NLP */ 206 SCIP_SET* set, /**< global SCIP settings */ 207 SCIP_NLROW* nlrow, /**< NLP row */ 208 SCIP_EXPRCURV curvature /**< curvature of NLP row */ 209 ); 210 211 /** removes (or substitutes) all fixed, negated, aggregated, multi-aggregated variables from the linear and nonlinear part of a nonlinear row and simplifies its expression */ 212 SCIP_RETCODE SCIPnlrowSimplify( 213 SCIP_NLROW* nlrow, /**< nonlinear row */ 214 BMS_BLKMEM* blkmem, /**< block memory */ 215 SCIP_SET* set, /**< global SCIP settings */ 216 SCIP_STAT* stat, /**< problem statistics data */ 217 SCIP_NLP* nlp /**< current NLP data */ 218 ); 219 220 /** recalculates the current activity of a nonlinear row in the current NLP solution */ 221 SCIP_RETCODE SCIPnlrowRecalcNLPActivity( 222 SCIP_NLROW* nlrow, /**< nonlinear row */ 223 BMS_BLKMEM* blkmem, /**< block memory */ 224 SCIP_SET* set, /**< global SCIP settings */ 225 SCIP_STAT* stat, /**< problem statistics data */ 226 SCIP_PRIMAL* primal, /**< primal data */ 227 SCIP_TREE* tree, /**< branch and bound tree */ 228 SCIP_NLP* nlp /**< current NLP data */ 229 ); 230 231 /** gives the activity of a nonlinear row in the current NLP solution */ 232 SCIP_RETCODE SCIPnlrowGetNLPActivity( 233 SCIP_NLROW* nlrow, /**< nonlinear row */ 234 BMS_BLKMEM* blkmem, /**< block memory */ 235 SCIP_SET* set, /**< global SCIP settings */ 236 SCIP_STAT* stat, /**< problem statistics data */ 237 SCIP_PRIMAL* primal, /**< primal data */ 238 SCIP_TREE* tree, /**< branch and bound tree */ 239 SCIP_NLP* nlp, /**< current NLP data */ 240 SCIP_Real* activity /**< buffer to store activity value */ 241 ); 242 243 /** gives the feasibility of a nonlinear row in the current NLP solution: negative value means infeasibility */ 244 SCIP_RETCODE SCIPnlrowGetNLPFeasibility( 245 SCIP_NLROW* nlrow, /**< nonlinear row */ 246 BMS_BLKMEM* blkmem, /**< block memory */ 247 SCIP_SET* set, /**< global SCIP settings */ 248 SCIP_STAT* stat, /**< problem statistics data */ 249 SCIP_PRIMAL* primal, /**< primal data */ 250 SCIP_TREE* tree, /**< branch and bound tree */ 251 SCIP_NLP* nlp, /**< current NLP data */ 252 SCIP_Real* feasibility /**< buffer to store feasibility value */ 253 ); 254 255 /** calculates the current pseudo activity of a nonlinear row */ 256 SCIP_RETCODE SCIPnlrowRecalcPseudoActivity( 257 SCIP_NLROW* nlrow, /**< nonlinear row */ 258 BMS_BLKMEM* blkmem, /**< block memory */ 259 SCIP_SET* set, /**< global SCIP settings */ 260 SCIP_STAT* stat, /**< problem statistics data */ 261 SCIP_PROB* prob, /**< SCIP problem */ 262 SCIP_PRIMAL* primal, /**< primal data */ 263 SCIP_TREE* tree, /**< branch and bound tree */ 264 SCIP_LP* lp /**< SCIP LP */ 265 ); 266 267 /** returns the pseudo activity of a nonlinear row in the current pseudo solution */ 268 SCIP_RETCODE SCIPnlrowGetPseudoActivity( 269 SCIP_NLROW* nlrow, /**< nonlinear row */ 270 BMS_BLKMEM* blkmem, /**< block memory */ 271 SCIP_SET* set, /**< global SCIP settings */ 272 SCIP_STAT* stat, /**< problem statistics data */ 273 SCIP_PROB* prob, /**< SCIP problem */ 274 SCIP_PRIMAL* primal, /**< primal data */ 275 SCIP_TREE* tree, /**< branch and bound tree */ 276 SCIP_LP* lp, /**< SCIP LP */ 277 SCIP_Real* pseudoactivity /**< buffer to store pseudo activity value */ 278 ); 279 280 /** returns the pseudo feasibility of a nonlinear row in the current pseudo solution: negative value means infeasibility */ 281 SCIP_RETCODE SCIPnlrowGetPseudoFeasibility( 282 SCIP_NLROW* nlrow, /**< nonlinear row */ 283 BMS_BLKMEM* blkmem, /**< block memory */ 284 SCIP_SET* set, /**< global SCIP settings */ 285 SCIP_STAT* stat, /**< problem statistics data */ 286 SCIP_PROB* prob, /**< SCIP problem */ 287 SCIP_PRIMAL* primal, /**< primal data */ 288 SCIP_TREE* tree, /**< branch and bound tree */ 289 SCIP_LP* lp, /**< SCIP LP */ 290 SCIP_Real* pseudofeasibility /**< buffer to store pseudo feasibility value */ 291 ); 292 293 /** returns the activity of a nonlinear row for a given solution */ 294 SCIP_RETCODE SCIPnlrowGetSolActivity( 295 SCIP_NLROW* nlrow, /**< nonlinear row */ 296 BMS_BLKMEM* blkmem, /**< block memory */ 297 SCIP_SET* set, /**< global SCIP settings */ 298 SCIP_STAT* stat, /**< problem statistics data */ 299 SCIP_SOL* sol, /**< primal CIP solution */ 300 SCIP_Real* activity /**< buffer to store activity value */ 301 ); 302 303 /** returns the feasibility of a nonlinear row for the given solution */ 304 SCIP_RETCODE SCIPnlrowGetSolFeasibility( 305 SCIP_NLROW* nlrow, /**< nonlinear row */ 306 BMS_BLKMEM* blkmem, /**< block memory */ 307 SCIP_SET* set, /**< global SCIP settings */ 308 SCIP_STAT* stat, /**< problem statistics data */ 309 SCIP_SOL* sol, /**< primal CIP solution */ 310 SCIP_Real* feasibility /**< buffer to store feasibility value */ 311 ); 312 313 /** returns the minimal activity of a nonlinear row w.r.t. the variables' bounds */ 314 SCIP_RETCODE SCIPnlrowGetActivityBounds( 315 SCIP_NLROW* nlrow, /**< nonlinear row */ 316 BMS_BLKMEM* blkmem, /**< block memory */ 317 SCIP_SET* set, /**< global SCIP settings */ 318 SCIP_STAT* stat, /**< problem statistics data */ 319 SCIP_Real* minactivity, /**< buffer to store minimal activity, or NULL */ 320 SCIP_Real* maxactivity /**< buffer to store maximal activity, or NULL */ 321 ); 322 323 /** returns whether the nonlinear row is redundant w.r.t. the variables' bounds */ 324 SCIP_RETCODE SCIPnlrowIsRedundant( 325 SCIP_NLROW* nlrow, /**< nonlinear row */ 326 BMS_BLKMEM* blkmem, /**< block memory */ 327 SCIP_SET* set, /**< global SCIP settings */ 328 SCIP_STAT* stat, /**< problem statistics data */ 329 SCIP_Bool* isredundant /**< buffer to store whether row is redundant */ 330 ); 331 332 /**@} */ 333 334 /**@name NLP methods */ 335 /**@{ */ 336 337 /** includes event handler that is used by NLP */ 338 SCIP_RETCODE SCIPnlpInclude( 339 SCIP_SET* set, /**< global SCIP settings */ 340 BMS_BLKMEM* blkmem /**< block memory */ 341 ); 342 343 /** construct a new empty NLP */ 344 SCIP_RETCODE SCIPnlpCreate( 345 SCIP_NLP** nlp, /**< NLP handler, call by reference */ 346 BMS_BLKMEM* blkmem, /**< block memory */ 347 SCIP_SET* set, /**< global SCIP settings */ 348 SCIP_STAT* stat, /**< problem statistics */ 349 const char* name, /**< problem name */ 350 int nvars_estimate /**< an estimate on the number of variables that may be added to the NLP later */ 351 ); 352 353 /** frees NLP data object */ 354 SCIP_RETCODE SCIPnlpFree( 355 SCIP_NLP** nlp, /**< pointer to NLP data object */ 356 BMS_BLKMEM* blkmem, /**< block memory */ 357 SCIP_SET* set, /**< global SCIP settings */ 358 SCIP_STAT* stat, /**< problem statistics */ 359 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 360 SCIP_LP* lp /**< SCIP LP, needed for releasing variables */ 361 ); 362 363 /** resets the NLP to the empty NLP by removing all variables and rows from NLP, 364 * releasing all rows, and flushing the changes to the NLP solver 365 */ 366 SCIP_RETCODE SCIPnlpReset( 367 SCIP_NLP* nlp, /**< NLP data */ 368 BMS_BLKMEM* blkmem, /**< block memory */ 369 SCIP_SET* set, /**< global SCIP settings */ 370 SCIP_STAT* stat, /**< problem statistics data */ 371 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 372 SCIP_LP* lp /**< SCIP LP, needed for releasing variables */ 373 ); 374 375 /** currently a dummy function that always returns TRUE */ 376 SCIP_Bool SCIPnlpHasCurrentNodeNLP( 377 SCIP_NLP* nlp /**< NLP data */ 378 ); 379 380 /** ensures, that variables array of NLP can store at least num entries */ 381 SCIP_RETCODE SCIPnlpEnsureVarsSize( 382 SCIP_NLP* nlp, /**< NLP data */ 383 BMS_BLKMEM* blkmem, /**< block memory */ 384 SCIP_SET* set, /**< global SCIP settings */ 385 int num /**< minimum number of entries to store */ 386 ); 387 388 /** adds a variable to the NLP and captures the variable */ 389 SCIP_RETCODE SCIPnlpAddVar( 390 SCIP_NLP* nlp, /**< NLP data */ 391 BMS_BLKMEM* blkmem, /**< block memory */ 392 SCIP_SET* set, /**< global SCIP settings */ 393 SCIP_VAR* var /**< variable */ 394 ); 395 396 /** adds a set of variables to the NLP and captures the variables */ 397 SCIP_RETCODE SCIPnlpAddVars( 398 SCIP_NLP* nlp, /**< NLP data */ 399 BMS_BLKMEM* blkmem, /**< block memory */ 400 SCIP_SET* set, /**< global SCIP settings */ 401 int nvars, /**< number of variables to add */ 402 SCIP_VAR** vars /**< variables to add */ 403 ); 404 405 /** deletes a variable from the NLP and releases the variable */ 406 SCIP_RETCODE SCIPnlpDelVar( 407 SCIP_NLP* nlp, /**< NLP data */ 408 BMS_BLKMEM* blkmem, /**< block memory */ 409 SCIP_SET* set, /**< global SCIP settings */ 410 SCIP_STAT* stat, /**< problem statistics data */ 411 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 412 SCIP_LP* lp, /**< SCIP LP, needed to release variable */ 413 SCIP_VAR* var /**< variable */ 414 ); 415 416 /** ensures, that nonlinear rows array of NLP can store at least num entries */ 417 SCIP_RETCODE SCIPnlpEnsureNlRowsSize( 418 SCIP_NLP* nlp, /**< NLP data */ 419 BMS_BLKMEM* blkmem, /**< block memory */ 420 SCIP_SET* set, /**< global SCIP settings */ 421 int num /**< minimum number of entries to store */ 422 ); 423 424 /** adds a nonlinear row to the NLP and captures it 425 * 426 * all variables of the row need to be present in the NLP 427 */ 428 SCIP_RETCODE SCIPnlpAddNlRow( 429 SCIP_NLP* nlp, /**< NLP data */ 430 BMS_BLKMEM* blkmem, /**< block memory */ 431 SCIP_SET* set, /**< global SCIP settings */ 432 SCIP_STAT* stat, /**< problem statistics data */ 433 SCIP_NLROW* nlrow /**< nonlinear row */ 434 ); 435 436 /** adds nonlinear rows to the NLP and captures them 437 * 438 * all variables of the row need to be present in the NLP 439 */ 440 SCIP_RETCODE SCIPnlpAddNlRows( 441 SCIP_NLP* nlp, /**< NLP data */ 442 BMS_BLKMEM* blkmem, /**< block memory */ 443 SCIP_SET* set, /**< global SCIP settings */ 444 SCIP_STAT* stat, /**< problem statistics data */ 445 int nnlrows, /**< number of rows to add */ 446 SCIP_NLROW** nlrows /**< rows to add */ 447 ); 448 449 /** deletes a nonlinear row from the NLP 450 * 451 * does nothing if nonlinear row is not in NLP 452 */ 453 SCIP_RETCODE SCIPnlpDelNlRow( 454 SCIP_NLP* nlp, /**< NLP data */ 455 BMS_BLKMEM* blkmem, /**< block memory */ 456 SCIP_SET* set, /**< global SCIP settings */ 457 SCIP_STAT* stat, /**< problem statistics data */ 458 SCIP_NLROW* nlrow /**< nonlinear row */ 459 ); 460 461 /** applies all cached changes to the NLP solver */ 462 SCIP_RETCODE SCIPnlpFlush( 463 SCIP_NLP* nlp, /**< current NLP data */ 464 BMS_BLKMEM* blkmem, /**< block memory */ 465 SCIP_SET* set, /**< global SCIP settings */ 466 SCIP_STAT* stat /**< problem statistics */ 467 ); 468 469 /** solves the NLP or diving NLP */ 470 SCIP_RETCODE SCIPnlpSolve( 471 SCIP_NLP* nlp, /**< NLP data */ 472 BMS_BLKMEM* blkmem, /**< block memory buffers */ 473 SCIP_SET* set, /**< global SCIP settings */ 474 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 475 SCIP_STAT* stat, /**< problem statistics */ 476 SCIP_PRIMAL* primal, /**< primal data */ 477 SCIP_TREE* tree, /**< branch and bound tree */ 478 SCIP_NLPPARAM* nlpparam /**< NLP solve parameters */ 479 ); 480 481 /** gets objective value of current NLP */ 482 SCIP_Real SCIPnlpGetObjval( 483 SCIP_NLP* nlp /**< current NLP data */ 484 ); 485 486 /** gives current pseudo objective value */ 487 SCIP_RETCODE SCIPnlpGetPseudoObjval( 488 SCIP_NLP* nlp, /**< current NLP data */ 489 BMS_BLKMEM* blkmem, /**< block memory */ 490 SCIP_SET* set, /**< global SCIP settings */ 491 SCIP_STAT* stat, /**< problem statistics data */ 492 SCIP_PROB* prob, /**< SCIP problem */ 493 SCIP_PRIMAL* primal, /**< primal data */ 494 SCIP_TREE* tree, /**< branch and bound tree */ 495 SCIP_LP* lp, /**< SCIP LP */ 496 SCIP_Real* pseudoobjval /**< buffer to store pseudo objective value */ 497 ); 498 499 /** gets fractional variables of last NLP solution along with solution values and fractionalities 500 */ 501 SCIP_RETCODE SCIPnlpGetFracVars( 502 SCIP_NLP* nlp, /**< NLP data structure */ 503 BMS_BLKMEM* blkmem, /**< block memory */ 504 SCIP_SET* set, /**< global SCIP settings */ 505 SCIP_STAT* stat, /**< problem statistics */ 506 SCIP_VAR*** fracvars, /**< pointer to store the array of NLP fractional variables, or NULL */ 507 SCIP_Real** fracvarssol, /**< pointer to store the array of NLP fractional variables solution values, or NULL */ 508 SCIP_Real** fracvarsfrac, /**< pointer to store the array of NLP fractional variables fractionalities, or NULL */ 509 int* nfracvars, /**< pointer to store the number of NLP fractional variables , or NULL */ 510 int* npriofracvars /**< pointer to store the number of NLP fractional variables with maximal branching priority, or NULL */ 511 ); 512 513 /** removes all redundant nonlinear rows */ 514 SCIP_RETCODE SCIPnlpRemoveRedundantNlRows( 515 SCIP_NLP* nlp, /**< current NLP data */ 516 BMS_BLKMEM* blkmem, /**< block memory buffers */ 517 SCIP_SET* set, /**< global SCIP settings */ 518 SCIP_STAT* stat /**< problem statistics */ 519 ); 520 521 /** set initial guess (approximate primal solution) for next solve 522 * 523 * array initguess must be NULL or have length at least SCIPnlpGetNVars() 524 */ 525 SCIP_RETCODE SCIPnlpSetInitialGuess( 526 SCIP_SET* set, /**< global SCIP settings */ 527 SCIP_NLP* nlp, /**< current NLP data */ 528 BMS_BLKMEM* blkmem, /**< block memory buffers */ 529 SCIP_Real* initguess /**< new initial guess, or NULL to clear previous one */ 530 ); 531 532 /** writes NLP to a file */ 533 SCIP_RETCODE SCIPnlpWrite( 534 SCIP_NLP* nlp, /**< current NLP data */ 535 BMS_BLKMEM* blkmem, /**< block memory buffers */ 536 SCIP_SET* set, /**< global SCIP settings */ 537 SCIP_STAT* stat, /**< problem statistics */ 538 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 539 const char* fname /**< file name */ 540 ); 541 542 /* 543 * NLP diving methods 544 */ 545 546 /** signals start of diving */ 547 SCIP_RETCODE SCIPnlpStartDive( 548 SCIP_NLP* nlp, /**< current NLP data */ 549 BMS_BLKMEM* blkmem, /**< block memory buffers */ 550 SCIP_SET* set, /**< global SCIP settings */ 551 SCIP_STAT* stat /**< problem statistics */ 552 ); 553 554 /** resets the bound and objective changes made during diving and disables diving mode */ 555 SCIP_RETCODE SCIPnlpEndDive( 556 SCIP_NLP* nlp, /**< current NLP data */ 557 BMS_BLKMEM* blkmem, /**< block memory buffers */ 558 SCIP_SET* set, /**< global SCIP settings */ 559 SCIP_STAT* stat /**< problem statistics data */ 560 ); 561 562 /** changes coefficient of variable in diving NLP */ 563 SCIP_RETCODE SCIPnlpChgVarObjDive( 564 SCIP_NLP* nlp, /**< current NLP data */ 565 BMS_BLKMEM* blkmem, /**< block memory */ 566 SCIP_SET* set, /**< global SCIP settings */ 567 SCIP_STAT* stat, /**< problem statistics data */ 568 SCIP_VAR* var, /**< variable which coefficient to change */ 569 SCIP_Real coef /**< new linear coefficient of variable in objective */ 570 ); 571 572 /** changes bounds of variable in diving NLP */ 573 SCIP_RETCODE SCIPnlpChgVarBoundsDive( 574 SCIP_SET* set, /**< global SCIP settings */ 575 SCIP_NLP* nlp, /**< current NLP data */ 576 SCIP_VAR* var, /**< variable which bounds to change */ 577 SCIP_Real lb, /**< new lower bound of variable */ 578 SCIP_Real ub /**< new upper bound of variable */ 579 ); 580 581 /** changes bounds of a set of variables in diving NLP */ 582 SCIP_RETCODE SCIPnlpChgVarsBoundsDive( 583 SCIP_NLP* nlp, /**< current NLP data */ 584 SCIP_SET* set, /**< global SCIP settings */ 585 int nvars, /**< number of variables which bounds to change */ 586 SCIP_VAR** vars, /**< variables which bounds to change */ 587 SCIP_Real* lbs, /**< new lower bounds of variables */ 588 SCIP_Real* ubs /**< new upper bounds of variables */ 589 ); 590 591 /** returns whether the objective function has been changed during diving */ 592 SCIP_Bool SCIPnlpIsDivingObjChanged( 593 SCIP_NLP* nlp /**< current NLP data */ 594 ); 595 596 /** gets array with variables of the NLP */ 597 SCIP_VAR** SCIPnlpGetVars( 598 SCIP_NLP* nlp /**< current NLP data */ 599 ); 600 601 /** gets current number of variables in NLP */ 602 int SCIPnlpGetNVars( 603 SCIP_NLP* nlp /**< current NLP data */ 604 ); 605 606 /** computes for each variables the number of NLP rows in which the variable appears in a nonlinear var */ 607 SCIP_RETCODE SCIPnlpGetVarsNonlinearity( 608 SCIP_NLP* nlp, /**< current NLP data */ 609 BMS_BLKMEM* blkmem, /**< block memory buffers */ 610 SCIP_SET* set, /**< global SCIP settings */ 611 SCIP_STAT* stat, /**< problem statistics */ 612 int* nlcount /**< an array of length at least SCIPnlpGetNVars() to store nonlinearity counts of variables */ 613 ); 614 615 /** indicates whether there exists a row that contains a continuous variable in a nonlinear term 616 * 617 * @note The method may have to touch every row and nonlinear term to compute its result. 618 */ 619 SCIP_RETCODE SCIPnlpHasContinuousNonlinearity( 620 SCIP_NLP* nlp, /**< current NLP data */ 621 BMS_BLKMEM* blkmem, /**< block memory buffers */ 622 SCIP_SET* set, /**< global SCIP settings */ 623 SCIP_STAT* stat, /**< problem statistics */ 624 SCIP_Bool* result /**< buffer to store whether continuous variable present in an expression of any row */ 625 ); 626 627 /** gives dual solution values associated with lower bounds of NLP variables */ 628 SCIP_Real* SCIPnlpGetVarsLbDualsol( 629 SCIP_NLP* nlp /**< current NLP data */ 630 ); 631 632 /** gives dual solution values associated with upper bounds of NLP variables */ 633 SCIP_Real* SCIPnlpGetVarsUbDualsol( 634 SCIP_NLP* nlp /**< current NLP data */ 635 ); 636 637 /** gets array with nonlinear rows of the NLP */ 638 SCIP_NLROW** SCIPnlpGetNlRows( 639 SCIP_NLP* nlp /**< current NLP data */ 640 ); 641 642 /** gets current number of nonlinear rows in NLP */ 643 int SCIPnlpGetNNlRows( 644 SCIP_NLP* nlp /**< current NLP data */ 645 ); 646 647 /** gets statistics on convexity of nonlinear rows in NLP */ 648 void SCIPnlpGetNlRowsStat( 649 SCIP_NLP* nlp, /**< current NLP data */ 650 int* nlinear, /**< buffer to store number of linear rows in NLP, or NULL */ 651 int* nconvexineq, /**< buffer to store number of convex inequalities in NLP, or NULL */ 652 int* nnonconvexineq, /**< buffer to store number of nonconvex inequalities in NLP, or NULL */ 653 int* nnonlineareq /**< buffer to store number of nonlinear equalities or ranged rows in NLP, or NULL */ 654 ); 655 656 /** gets the NLP solver interface */ 657 SCIP_NLPI* SCIPnlpGetNLPI( 658 SCIP_NLP* nlp /**< current NLP data */ 659 ); 660 661 /** gets the NLP problem in the solver interface */ 662 SCIP_NLPIPROBLEM* SCIPnlpGetNLPIProblem( 663 SCIP_NLP* nlp /**< current NLP data */ 664 ); 665 666 /** indicates whether NLP is currently in diving mode */ 667 SCIP_Bool SCIPnlpIsDiving( 668 SCIP_NLP* nlp /**< current NLP data */ 669 ); 670 671 /** gets solution status of current NLP */ 672 SCIP_NLPSOLSTAT SCIPnlpGetSolstat( 673 SCIP_NLP* nlp /**< current NLP data */ 674 ); 675 676 /** gets termination status of last NLP solve */ 677 SCIP_NLPTERMSTAT SCIPnlpGetTermstat( 678 SCIP_NLP* nlp /**< current NLP data */ 679 ); 680 681 /** gives statistics (number of iterations, solving time, ...) of last NLP solve */ 682 SCIP_RETCODE SCIPnlpGetStatistics( 683 SCIP_SET* set, /**< global SCIP settings */ 684 SCIP_NLP* nlp, /**< pointer to NLP datastructure */ 685 SCIP_NLPSTATISTICS* statistics /**< pointer to store statistics */ 686 ); 687 688 /** indicates whether a solution for the current NLP is available 689 * 690 * The solution may be optimal, feasible, or infeasible. 691 * Thus, returns whether the NLP solution status is at most \ref SCIP_NLPSOLSTAT_LOCINFEASIBLE. 692 */ 693 SCIP_Bool SCIPnlpHasSolution( 694 SCIP_NLP* nlp /**< current NLP data */ 695 ); 696 697 /**@} */ 698 699 #ifdef __cplusplus 700 } 701 #endif 702 703 #endif /* __SCIP_NLP_H__ */ 704