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 sol.h 26 * @ingroup INTERNALAPI 27 * @brief internal methods for storing primal CIP solutions 28 * @author Tobias Achterberg 29 */ 30 31 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 32 33 #ifndef __SCIP_SOL_H__ 34 #define __SCIP_SOL_H__ 35 36 37 #include <stdio.h> 38 39 #include "scip/def.h" 40 #include "blockmemshell/memory.h" 41 #include "scip/type_retcode.h" 42 #include "scip/type_set.h" 43 #include "scip/type_stat.h" 44 #include "scip/type_lp.h" 45 #include "scip/type_nlp.h" 46 #include "scip/type_var.h" 47 #include "scip/type_prob.h" 48 #include "scip/type_sol.h" 49 #include "scip/type_primal.h" 50 #include "scip/type_tree.h" 51 #include "scip/type_heur.h" 52 #include "scip/pub_sol.h" 53 54 #ifdef __cplusplus 55 extern "C" { 56 #endif 57 58 /** creates primal CIP solution, initialized to zero */ 59 SCIP_RETCODE SCIPsolCreate( 60 SCIP_SOL** sol, /**< pointer to primal CIP solution */ 61 BMS_BLKMEM* blkmem, /**< block memory */ 62 SCIP_SET* set, /**< global SCIP settings */ 63 SCIP_STAT* stat, /**< problem statistics data */ 64 SCIP_PRIMAL* primal, /**< primal data */ 65 SCIP_TREE* tree, /**< branch and bound tree, or NULL */ 66 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */ 67 ); 68 69 /** creates primal CIP solution in original problem space, initialized to the offset in the original problem */ 70 SCIP_RETCODE SCIPsolCreateOriginal( 71 SCIP_SOL** sol, /**< pointer to primal CIP solution */ 72 BMS_BLKMEM* blkmem, /**< block memory */ 73 SCIP_SET* set, /**< global SCIP settings */ 74 SCIP_STAT* stat, /**< problem statistics data */ 75 SCIP_PROB* origprob, /**< original problem data */ 76 SCIP_PRIMAL* primal, /**< primal data */ 77 SCIP_TREE* tree, /**< branch and bound tree */ 78 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */ 79 ); 80 81 /** creates a copy of a primal CIP solution */ 82 SCIP_RETCODE SCIPsolCopy( 83 SCIP_SOL** sol, /**< pointer to store the copy of the primal CIP solution */ 84 BMS_BLKMEM* blkmem, /**< block memory */ 85 SCIP_SET* set, /**< global SCIP settings */ 86 SCIP_STAT* stat, /**< problem statistics data */ 87 SCIP_PRIMAL* primal, /**< primal data */ 88 SCIP_SOL* sourcesol /**< primal CIP solution to copy */ 89 ); 90 91 /** transformes given original solution to the transformed space; a corresponding transformed solution has to be given 92 * which is copied into the existing solution and freed afterwards 93 */ 94 SCIP_RETCODE SCIPsolTransform( 95 SCIP_SOL* sol, /**< primal CIP solution to change, living in original space */ 96 SCIP_SOL** transsol, /**< pointer to corresponding transformed primal CIP solution */ 97 BMS_BLKMEM* blkmem, /**< block memory */ 98 SCIP_SET* set, /**< global SCIP settings */ 99 SCIP_PRIMAL* primal /**< primal data */ 100 ); 101 102 /** adjusts solution values of implicit integer variables in handed solution. Solution objective value is not 103 * deteriorated by this method. 104 */ 105 SCIP_RETCODE SCIPsolAdjustImplicitSolVals( 106 SCIP_SOL* sol, /**< primal CIP solution */ 107 SCIP_SET* set, /**< global SCIP settings */ 108 SCIP_STAT* stat, /**< problem statistics data */ 109 SCIP_PROB* prob, /**< either original or transformed problem, depending on sol origin */ 110 SCIP_TREE* tree, /**< branch and bound tree */ 111 SCIP_Bool uselprows /**< should LP row information be considered for none-objective variables */ 112 ); 113 114 /** creates primal CIP solution, initialized to the current LP solution */ 115 SCIP_RETCODE SCIPsolCreateLPSol( 116 SCIP_SOL** sol, /**< pointer to primal CIP solution */ 117 BMS_BLKMEM* blkmem, /**< block memory */ 118 SCIP_SET* set, /**< global SCIP settings */ 119 SCIP_STAT* stat, /**< problem statistics data */ 120 SCIP_PROB* prob, /**< transformed problem data */ 121 SCIP_PRIMAL* primal, /**< primal data */ 122 SCIP_TREE* tree, /**< branch and bound tree */ 123 SCIP_LP* lp, /**< current LP data */ 124 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */ 125 ); 126 127 /** creates primal CIP solution, initialized to the current NLP solution */ 128 SCIP_RETCODE SCIPsolCreateNLPSol( 129 SCIP_SOL** sol, /**< pointer to primal CIP solution */ 130 BMS_BLKMEM* blkmem, /**< block memory */ 131 SCIP_SET* set, /**< global SCIP settings */ 132 SCIP_STAT* stat, /**< problem statistics data */ 133 SCIP_PRIMAL* primal, /**< primal data */ 134 SCIP_TREE* tree, /**< branch and bound tree */ 135 SCIP_NLP* nlp, /**< current NLP data */ 136 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */ 137 ); 138 139 /** creates primal CIP solution, initialized to the current relaxation solution */ 140 SCIP_RETCODE SCIPsolCreateRelaxSol( 141 SCIP_SOL** sol, /**< pointer to primal CIP solution */ 142 BMS_BLKMEM* blkmem, /**< block memory */ 143 SCIP_SET* set, /**< global SCIP settings */ 144 SCIP_STAT* stat, /**< problem statistics data */ 145 SCIP_PRIMAL* primal, /**< primal data */ 146 SCIP_TREE* tree, /**< branch and bound tree */ 147 SCIP_RELAXATION* relaxation, /**< global relaxation data */ 148 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */ 149 ); 150 151 /** creates primal CIP solution, initialized to the current pseudo solution */ 152 SCIP_RETCODE SCIPsolCreatePseudoSol( 153 SCIP_SOL** sol, /**< pointer to primal CIP solution */ 154 BMS_BLKMEM* blkmem, /**< block memory */ 155 SCIP_SET* set, /**< global SCIP settings */ 156 SCIP_STAT* stat, /**< problem statistics data */ 157 SCIP_PROB* prob, /**< transformed problem data */ 158 SCIP_PRIMAL* primal, /**< primal data */ 159 SCIP_TREE* tree, /**< branch and bound tree, or NULL */ 160 SCIP_LP* lp, /**< current LP data */ 161 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */ 162 ); 163 164 /** creates primal CIP solution, initialized to the current solution */ 165 SCIP_RETCODE SCIPsolCreateCurrentSol( 166 SCIP_SOL** sol, /**< pointer to primal CIP solution */ 167 BMS_BLKMEM* blkmem, /**< block memory */ 168 SCIP_SET* set, /**< global SCIP settings */ 169 SCIP_STAT* stat, /**< problem statistics data */ 170 SCIP_PROB* prob, /**< transformed problem data */ 171 SCIP_PRIMAL* primal, /**< primal data */ 172 SCIP_TREE* tree, /**< branch and bound tree */ 173 SCIP_LP* lp, /**< current LP data */ 174 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */ 175 ); 176 177 /** creates partial primal CIP solution, initialized to unknown values */ 178 SCIP_RETCODE SCIPsolCreatePartial( 179 SCIP_SOL** sol, /**< pointer to primal CIP solution */ 180 BMS_BLKMEM* blkmem, /**< block memory */ 181 SCIP_SET* set, /**< global SCIP settings */ 182 SCIP_STAT* stat, /**< problem statistics data */ 183 SCIP_PRIMAL* primal, /**< primal data */ 184 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */ 185 ); 186 187 /** creates primal CIP solution, initialized to unknown values */ 188 SCIP_RETCODE SCIPsolCreateUnknown( 189 SCIP_SOL** sol, /**< pointer to primal CIP solution */ 190 BMS_BLKMEM* blkmem, /**< block memory */ 191 SCIP_SET* set, /**< global SCIP settings */ 192 SCIP_STAT* stat, /**< problem statistics data */ 193 SCIP_PRIMAL* primal, /**< primal data */ 194 SCIP_TREE* tree, /**< branch and bound tree */ 195 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */ 196 ); 197 198 /** frees primal CIP solution */ 199 SCIP_RETCODE SCIPsolFree( 200 SCIP_SOL** sol, /**< pointer to primal CIP solution */ 201 BMS_BLKMEM* blkmem, /**< block memory */ 202 SCIP_PRIMAL* primal /**< primal data */ 203 ); 204 205 /** copies current LP solution into CIP solution by linking */ 206 SCIP_RETCODE SCIPsolLinkLPSol( 207 SCIP_SOL* sol, /**< primal CIP solution */ 208 SCIP_SET* set, /**< global SCIP settings */ 209 SCIP_STAT* stat, /**< problem statistics data */ 210 SCIP_PROB* prob, /**< transformed problem data */ 211 SCIP_TREE* tree, /**< branch and bound tree */ 212 SCIP_LP* lp /**< current LP data */ 213 ); 214 215 /** copies current NLP solution into CIP solution by linking */ 216 SCIP_RETCODE SCIPsolLinkNLPSol( 217 SCIP_SOL* sol, /**< primal CIP solution */ 218 SCIP_STAT* stat, /**< problem statistics data */ 219 SCIP_TREE* tree, /**< branch and bound tree */ 220 SCIP_NLP* nlp /**< current NLP data */ 221 ); 222 223 /** copies current relaxation solution into CIP solution by linking */ 224 SCIP_RETCODE SCIPsolLinkRelaxSol( 225 SCIP_SOL* sol, /**< primal CIP solution */ 226 SCIP_SET* set, /**< global SCIP settings */ 227 SCIP_STAT* stat, /**< problem statistics data */ 228 SCIP_TREE* tree, /**< branch and bound tree */ 229 SCIP_RELAXATION* relaxation /**< global relaxation data */ 230 ); 231 232 /** copies current pseudo solution into CIP solution by linking */ 233 SCIP_RETCODE SCIPsolLinkPseudoSol( 234 SCIP_SOL* sol, /**< primal CIP solution */ 235 SCIP_SET* set, /**< global SCIP settings */ 236 SCIP_STAT* stat, /**< problem statistics data */ 237 SCIP_PROB* prob, /**< transformed problem data */ 238 SCIP_TREE* tree, /**< branch and bound tree, or NULL */ 239 SCIP_LP* lp /**< current LP data */ 240 ); 241 242 /** copies current solution (LP or pseudo solution) into CIP solution by linking */ 243 SCIP_RETCODE SCIPsolLinkCurrentSol( 244 SCIP_SOL* sol, /**< primal CIP solution */ 245 SCIP_SET* set, /**< global SCIP settings */ 246 SCIP_STAT* stat, /**< problem statistics data */ 247 SCIP_PROB* prob, /**< transformed problem data */ 248 SCIP_TREE* tree, /**< branch and bound tree */ 249 SCIP_LP* lp /**< current LP data */ 250 ); 251 252 /** clears primal CIP solution */ 253 SCIP_RETCODE SCIPsolClear( 254 SCIP_SOL* sol, /**< primal CIP solution */ 255 SCIP_STAT* stat, /**< problem statistics data */ 256 SCIP_TREE* tree /**< branch and bound tree */ 257 ); 258 259 /** declares all entries in the primal CIP solution to be unknown */ 260 SCIP_RETCODE SCIPsolSetUnknown( 261 SCIP_SOL* sol, /**< primal CIP solution */ 262 SCIP_STAT* stat, /**< problem statistics data */ 263 SCIP_TREE* tree /**< branch and bound tree */ 264 ); 265 266 /** stores solution values of variables in solution's own array */ 267 SCIP_RETCODE SCIPsolUnlink( 268 SCIP_SOL* sol, /**< primal CIP solution */ 269 SCIP_SET* set, /**< global SCIP settings */ 270 SCIP_PROB* prob /**< transformed problem data */ 271 ); 272 273 /** sets value of variable in primal CIP solution */ 274 SCIP_RETCODE SCIPsolSetVal( 275 SCIP_SOL* sol, /**< primal CIP solution */ 276 SCIP_SET* set, /**< global SCIP settings */ 277 SCIP_STAT* stat, /**< problem statistics data */ 278 SCIP_TREE* tree, /**< branch and bound tree */ 279 SCIP_VAR* var, /**< variable to add to solution */ 280 SCIP_Real val /**< solution value of variable */ 281 ); 282 283 /** increases value of variable in primal CIP solution */ 284 SCIP_RETCODE SCIPsolIncVal( 285 SCIP_SOL* sol, /**< primal CIP solution */ 286 SCIP_SET* set, /**< global SCIP settings */ 287 SCIP_STAT* stat, /**< problem statistics data */ 288 SCIP_TREE* tree, /**< branch and bound tree */ 289 SCIP_VAR* var, /**< variable to increase solution value for */ 290 SCIP_Real incval /**< increment for solution value of variable */ 291 ); 292 293 /** returns value of variable in primal CIP solution */ 294 SCIP_Real SCIPsolGetVal( 295 SCIP_SOL* sol, /**< primal CIP solution */ 296 SCIP_SET* set, /**< global SCIP settings */ 297 SCIP_STAT* stat, /**< problem statistics data */ 298 SCIP_VAR* var /**< variable to get value for */ 299 ); 300 301 /** returns value of variable in primal ray represented by primal CIP solution */ 302 SCIP_Real SCIPsolGetRayVal( 303 SCIP_SOL* sol, /**< primal CIP solution, representing a primal ray */ 304 SCIP_SET* set, /**< global SCIP settings */ 305 SCIP_STAT* stat, /**< problem statistics data */ 306 SCIP_VAR* var /**< variable to get value for */ 307 ); 308 309 310 /** gets objective value of primal CIP solution in transformed problem */ 311 SCIP_Real SCIPsolGetObj( 312 SCIP_SOL* sol, /**< primal CIP solution */ 313 SCIP_SET* set, /**< global SCIP settings */ 314 SCIP_PROB* transprob, /**< tranformed problem data */ 315 SCIP_PROB* origprob /**< original problem data */ 316 ); 317 318 /** updates primal solutions after a change in a variable's objective value */ 319 void SCIPsolUpdateVarObj( 320 SCIP_SOL* sol, /**< primal CIP solution */ 321 SCIP_VAR* var, /**< problem variable */ 322 SCIP_Real oldobj, /**< old objective value */ 323 SCIP_Real newobj /**< new objective value */ 324 ); 325 326 /* mark the given solution as partial solution */ 327 SCIP_RETCODE SCIPsolMarkPartial( 328 SCIP_SOL* sol, /**< primal CIP solution */ 329 SCIP_SET* set, /**< global SCIP settings */ 330 SCIP_STAT* stat, /**< problem statistics */ 331 SCIP_VAR** vars, /**< problem variables */ 332 int nvars /**< number of problem variables */ 333 ); 334 335 /** checks solution for feasibility in original problem without adding it to the solution store 336 * 337 * We first check the variable bounds. Then we loop over all constraint handlers and constraints, checking each in the 338 * order of their check priority. 339 */ 340 SCIP_RETCODE SCIPsolCheckOrig( 341 SCIP_SOL* sol, /**< primal CIP solution */ 342 SCIP_SET* set, /**< global SCIP settings */ 343 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 344 BMS_BLKMEM* blkmem, /**< block memory */ 345 SCIP_STAT* stat, /**< problem statistics */ 346 SCIP_PROB* prob, /**< transformed problem data */ 347 SCIP_PRIMAL* primal, /**< primal data */ 348 SCIP_Bool printreason, /**< Should the reason for the violation be printed? */ 349 SCIP_Bool completely, /**< Should all violations be checked if printreason is true? */ 350 SCIP_Bool checkbounds, /**< Should the bounds of the variables be checked? */ 351 SCIP_Bool checkintegrality, /**< Has integrality to be checked? */ 352 SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */ 353 SCIP_Bool checkmodifiable, /**< have modifiable constraint to be checked? */ 354 SCIP_Bool* feasible /**< stores whether given solution is feasible */ 355 ); 356 357 /** checks primal CIP solution for feasibility 358 * 359 * @note The difference between SCIPsolCheck() and SCIPcheckSolOrig() is that modifiable constraints are handled 360 * differently. There might be some variables which do not have an original counter part (e.g. in 361 * branch-and-price). Therefore, modifiable constraints can not be double-checked in the original space. 362 */ 363 SCIP_RETCODE SCIPsolCheck( 364 SCIP_SOL* sol, /**< primal CIP solution */ 365 SCIP_SET* set, /**< global SCIP settings */ 366 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 367 BMS_BLKMEM* blkmem, /**< block memory */ 368 SCIP_STAT* stat, /**< problem statistics */ 369 SCIP_PROB* prob, /**< transformed problem data */ 370 SCIP_Bool printreason, /**< Should all reasons of violations be printed? */ 371 SCIP_Bool completely, /**< Should all violations be checked? */ 372 SCIP_Bool checkbounds, /**< Should the bounds of the variables be checked? */ 373 SCIP_Bool checkintegrality, /**< Has integrality to be checked? */ 374 SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */ 375 SCIP_Bool* feasible /**< stores whether solution is feasible */ 376 ); 377 378 /** try to round given solution */ 379 SCIP_RETCODE SCIPsolRound( 380 SCIP_SOL* sol, /**< primal solution */ 381 SCIP_SET* set, /**< global SCIP settings */ 382 SCIP_STAT* stat, /**< problem statistics data */ 383 SCIP_PROB* prob, /**< transformed problem data */ 384 SCIP_TREE* tree, /**< branch and bound tree */ 385 SCIP_Bool* success /**< pointer to store whether rounding was successful */ 386 ); 387 388 /** updates the solution value sums in variables by adding the value in the given solution */ 389 void SCIPsolUpdateVarsum( 390 SCIP_SOL* sol, /**< primal CIP solution */ 391 SCIP_SET* set, /**< global SCIP settings */ 392 SCIP_STAT* stat, /**< problem statistics data */ 393 SCIP_PROB* prob, /**< transformed problem data */ 394 SCIP_Real weight /**< weight of solution in weighted average */ 395 ); 396 397 /** retransforms solution to original problem space */ 398 SCIP_RETCODE SCIPsolRetransform( 399 SCIP_SOL* sol, /**< primal CIP solution */ 400 SCIP_SET* set, /**< global SCIP settings */ 401 SCIP_STAT* stat, /**< problem statistics data */ 402 SCIP_PROB* origprob, /**< original problem */ 403 SCIP_PROB* transprob, /**< transformed problem */ 404 SCIP_Bool* hasinfval /**< pointer to store whether the solution has infinite values */ 405 ); 406 407 /** recomputes the objective value of an original solution, e.g., when transferring solutions 408 * from the solution pool (objective coefficients might have changed in the meantime) 409 */ 410 void SCIPsolRecomputeObj( 411 SCIP_SOL* sol, /**< primal CIP solution */ 412 SCIP_SET* set, /**< global SCIP settings */ 413 SCIP_STAT* stat, /**< problem statistics data */ 414 SCIP_PROB* origprob /**< original problem */ 415 ); 416 417 418 /** returns whether the given solutions in transformed space are equal */ 419 SCIP_Bool SCIPsolsAreEqual( 420 SCIP_SOL* sol1, /**< first primal CIP solution */ 421 SCIP_SOL* sol2, /**< second primal CIP solution */ 422 SCIP_SET* set, /**< global SCIP settings */ 423 SCIP_STAT* stat, /**< problem statistics data */ 424 SCIP_PROB* origprob, /**< original problem */ 425 SCIP_PROB* transprob /**< transformed problem after presolve */ 426 ); 427 428 /** outputs non-zero elements of solution to file stream */ 429 SCIP_RETCODE SCIPsolPrint( 430 SCIP_SOL* sol, /**< primal CIP solution */ 431 SCIP_SET* set, /**< global SCIP settings */ 432 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 433 SCIP_STAT* stat, /**< problem statistics data */ 434 SCIP_PROB* prob, /**< problem data (original or transformed) */ 435 SCIP_PROB* transprob, /**< transformed problem data or NULL (to display priced variables) */ 436 FILE* file, /**< output file (or NULL for standard output) */ 437 SCIP_Bool mipstart, /**< should only discrete variables be printed? */ 438 SCIP_Bool printzeros /**< should variables set to zero be printed? */ 439 ); 440 441 /** outputs non-zero elements of solution representing a ray to file stream */ 442 SCIP_RETCODE SCIPsolPrintRay( 443 SCIP_SOL* sol, /**< primal CIP solution */ 444 SCIP_SET* set, /**< global SCIP settings */ 445 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 446 SCIP_STAT* stat, /**< problem statistics data */ 447 SCIP_PROB* prob, /**< problem data (original or transformed) */ 448 SCIP_PROB* transprob, /**< transformed problem data or NULL (to display priced variables) */ 449 FILE* file, /**< output file (or NULL for standard output) */ 450 SCIP_Bool printzeros /**< should variables set to zero be printed? */ 451 ); 452 453 454 /** reset violations of a solution */ 455 void SCIPsolResetViolations( 456 SCIP_SOL* sol /**< primal CIP solution */ 457 ); 458 459 /** update integrality violation of a solution */ 460 void SCIPsolUpdateIntegralityViolation( 461 SCIP_SOL* sol, /**< primal CIP solution */ 462 SCIP_Real absviolintegrality /**< absolute violation of integrality */ 463 ); 464 465 /** update bound violation of a solution */ 466 void SCIPsolUpdateBoundViolation( 467 SCIP_SOL* sol, /**< primal CIP solution */ 468 SCIP_Real absviolbounds, /**< absolute violation of bounds */ 469 SCIP_Real relviolbounds /**< relative violation of bounds */ 470 ); 471 472 /** update LP row violation of a solution */ 473 void SCIPsolUpdateLPRowViolation( 474 SCIP_SOL* sol, /**< primal CIP solution */ 475 SCIP_Real absviollprows, /**< absolute violation of LP rows */ 476 SCIP_Real relviollprows /**< relative violation of LP rows */ 477 ); 478 479 /** update constraint violation of a solution */ 480 void SCIPsolUpdateConsViolation( 481 SCIP_SOL* sol, /**< primal CIP solution */ 482 SCIP_Real absviolcons, /**< absolute violation of constraint */ 483 SCIP_Real relviolcons /**< relative violation of constraint */ 484 ); 485 486 /** update violation of a constraint that is represented in the LP */ 487 void SCIPsolUpdateLPConsViolation( 488 SCIP_SOL* sol, /**< primal CIP solution */ 489 SCIP_Real absviol, /**< absolute violation of constraint */ 490 SCIP_Real relviol /**< relative violation of constraint */ 491 ); 492 493 494 495 /* In debug mode, the following methods are implemented as function calls to ensure 496 * type validity. 497 */ 498 499 /** adds value to the objective value of a given original primal CIP solution */ 500 void SCIPsolOrigAddObjval( 501 SCIP_SOL* sol, /**< primal CIP solution */ 502 SCIP_Real addval /**< offset value to add */ 503 ); 504 505 /** gets current position of solution in array of existing solutions of primal data */ 506 int SCIPsolGetPrimalIndex( 507 SCIP_SOL* sol /**< primal CIP solution */ 508 ); 509 510 /** sets current position of solution in array of existing solutions of primal data */ 511 void SCIPsolSetPrimalIndex( 512 SCIP_SOL* sol, /**< primal CIP solution */ 513 int primalindex /**< new primal index of solution */ 514 ); 515 516 #ifdef NDEBUG 517 518 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and 519 * speed up the algorithms. 520 */ 521 522 #define SCIPsolOrigAddObjval(sol, addval) ((sol)->obj += (addval)) 523 #define SCIPsolGetPrimalIndex(sol) ((sol)->primalindex) 524 #define SCIPsolSetPrimalIndex(sol,idx) { (sol)->primalindex = idx; } 525 526 #endif 527 528 #ifdef __cplusplus 529 } 530 #endif 531 532 #endif 533