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 scip_param.c 26 * @ingroup OTHER_CFILES 27 * @brief public methods for SCIP parameter handling 28 * @author Tobias Achterberg 29 * @author Timo Berthold 30 * @author Gerald Gamrath 31 * @author Leona Gottwald 32 * @author Stefan Heinz 33 * @author Gregor Hendel 34 * @author Thorsten Koch 35 * @author Alexander Martin 36 * @author Marc Pfetsch 37 * @author Michael Winkler 38 * @author Kati Wolter 39 * 40 * @todo check all SCIP_STAGE_* switches, and include the new stages TRANSFORMED and INITSOLVE 41 */ 42 43 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 44 45 #include "scip/paramset.h" 46 #include "scip/pub_message.h" 47 #include "scip/scip_param.h" 48 #include "scip/set.h" 49 #include "scip/struct_mem.h" 50 #include "scip/struct_scip.h" 51 52 /** creates a SCIP_Bool parameter, sets it to its default value, and adds it to the parameter set 53 * 54 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 55 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 56 */ 57 SCIP_RETCODE SCIPaddBoolParam( 58 SCIP* scip, /**< SCIP data structure */ 59 const char* name, /**< name of the parameter */ 60 const char* desc, /**< description of the parameter */ 61 SCIP_Bool* valueptr, /**< pointer to store the current parameter value, or NULL */ 62 SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */ 63 SCIP_Bool defaultvalue, /**< default value of the parameter */ 64 SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */ 65 SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */ 66 ) 67 { 68 assert(scip != NULL); 69 assert(scip->set != NULL); 70 assert(scip->mem != NULL); 71 72 SCIP_CALL( SCIPsetAddBoolParam(scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, valueptr, isadvanced, 73 defaultvalue, paramchgd, paramdata) ); 74 75 return SCIP_OKAY; 76 } 77 78 /** creates a int parameter, sets it to its default value, and adds it to the parameter set 79 * 80 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 81 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 82 */ 83 SCIP_RETCODE SCIPaddIntParam( 84 SCIP* scip, /**< SCIP data structure */ 85 const char* name, /**< name of the parameter */ 86 const char* desc, /**< description of the parameter */ 87 int* valueptr, /**< pointer to store the current parameter value, or NULL */ 88 SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */ 89 int defaultvalue, /**< default value of the parameter */ 90 int minvalue, /**< minimum value for parameter */ 91 int maxvalue, /**< maximum value for parameter */ 92 SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */ 93 SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */ 94 ) 95 { 96 assert(scip != NULL); 97 assert(scip->set != NULL); 98 assert(scip->mem != NULL); 99 100 SCIP_CALL( SCIPsetAddIntParam(scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, valueptr, isadvanced, 101 defaultvalue, minvalue, maxvalue, paramchgd, paramdata) ); 102 103 return SCIP_OKAY; 104 } 105 106 /** creates a SCIP_Longint parameter, sets it to its default value, and adds it to the parameter set 107 * 108 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 109 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 110 */ 111 SCIP_RETCODE SCIPaddLongintParam( 112 SCIP* scip, /**< SCIP data structure */ 113 const char* name, /**< name of the parameter */ 114 const char* desc, /**< description of the parameter */ 115 SCIP_Longint* valueptr, /**< pointer to store the current parameter value, or NULL */ 116 SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */ 117 SCIP_Longint defaultvalue, /**< default value of the parameter */ 118 SCIP_Longint minvalue, /**< minimum value for parameter */ 119 SCIP_Longint maxvalue, /**< maximum value for parameter */ 120 SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */ 121 SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */ 122 ) 123 { 124 assert(scip != NULL); 125 assert(scip->set != NULL); 126 assert(scip->mem != NULL); 127 128 SCIP_CALL( SCIPsetAddLongintParam(scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, valueptr, isadvanced, 129 defaultvalue, minvalue, maxvalue, paramchgd, paramdata) ); 130 131 return SCIP_OKAY; 132 } 133 134 /** creates a SCIP_Real parameter, sets it to its default value, and adds it to the parameter set 135 * 136 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 137 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 138 */ 139 SCIP_RETCODE SCIPaddRealParam( 140 SCIP* scip, /**< SCIP data structure */ 141 const char* name, /**< name of the parameter */ 142 const char* desc, /**< description of the parameter */ 143 SCIP_Real* valueptr, /**< pointer to store the current parameter value, or NULL */ 144 SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */ 145 SCIP_Real defaultvalue, /**< default value of the parameter */ 146 SCIP_Real minvalue, /**< minimum value for parameter */ 147 SCIP_Real maxvalue, /**< maximum value for parameter */ 148 SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */ 149 SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */ 150 ) 151 { 152 assert(scip != NULL); 153 assert(scip->set != NULL); 154 assert(scip->mem != NULL); 155 156 SCIP_CALL( SCIPsetAddRealParam(scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, valueptr, isadvanced, 157 defaultvalue, minvalue, maxvalue, paramchgd, paramdata) ); 158 159 return SCIP_OKAY; 160 } 161 162 /** creates a char parameter, sets it to its default value, and adds it to the parameter set 163 * 164 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 165 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 166 */ 167 SCIP_RETCODE SCIPaddCharParam( 168 SCIP* scip, /**< SCIP data structure */ 169 const char* name, /**< name of the parameter */ 170 const char* desc, /**< description of the parameter */ 171 char* valueptr, /**< pointer to store the current parameter value, or NULL */ 172 SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */ 173 char defaultvalue, /**< default value of the parameter */ 174 const char* allowedvalues, /**< array with possible parameter values, or NULL if not restricted */ 175 SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */ 176 SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */ 177 ) 178 { 179 assert(scip != NULL); 180 assert(scip->set != NULL); 181 assert(scip->mem != NULL); 182 183 SCIP_CALL( SCIPsetAddCharParam(scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, valueptr, isadvanced, 184 defaultvalue, allowedvalues, paramchgd, paramdata) ); 185 186 return SCIP_OKAY; 187 } 188 189 /** creates a string(char*) parameter, sets it to its default value, and adds it to the parameter set 190 * 191 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 192 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 193 */ 194 SCIP_RETCODE SCIPaddStringParam( 195 SCIP* scip, /**< SCIP data structure */ 196 const char* name, /**< name of the parameter */ 197 const char* desc, /**< description of the parameter */ 198 char** valueptr, /**< pointer to store the current parameter value, or NULL; if not NULL then *valueptr should be NULL */ 199 SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */ 200 const char* defaultvalue, /**< default value of the parameter */ 201 SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */ 202 SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */ 203 ) 204 { 205 assert(scip != NULL); 206 assert(scip->set != NULL); 207 assert(scip->mem != NULL); 208 209 SCIP_CALL( SCIPsetAddStringParam(scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, valueptr, isadvanced, 210 defaultvalue, paramchgd, paramdata) ); 211 212 return SCIP_OKAY; 213 } 214 215 /** gets the fixing status of an existing parameter 216 * 217 * @return TRUE if the parameter is fixed to a value, otherwise FALSE. 218 */ 219 SCIP_Bool SCIPisParamFixed( 220 SCIP* scip, /**< SCIP data structure */ 221 const char* name /**< name of the parameter */ 222 ) 223 { 224 assert(scip != NULL); 225 assert(scip->set != NULL); 226 227 return SCIPsetIsParamFixed(scip->set, name); 228 } 229 230 /** returns the pointer to the SCIP parameter with the given name 231 * 232 * @return pointer to the parameter with the given name 233 */ 234 SCIP_PARAM* SCIPgetParam( 235 SCIP* scip, /**< SCIP data structure */ 236 const char* name /**< name of the parameter */ 237 ) 238 { 239 assert(scip != NULL); 240 assert(scip->set != NULL); 241 242 return SCIPsetGetParam(scip->set, name); 243 } 244 245 /** gets the value of an existing SCIP_Bool parameter 246 * 247 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 248 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 249 */ 250 SCIP_RETCODE SCIPgetBoolParam( 251 SCIP* scip, /**< SCIP data structure */ 252 const char* name, /**< name of the parameter */ 253 SCIP_Bool* value /**< pointer to store the parameter */ 254 ) 255 { 256 assert(scip != NULL); 257 assert(scip->set != NULL); 258 259 SCIP_CALL( SCIPsetGetBoolParam(scip->set, name, value) ); 260 261 return SCIP_OKAY; 262 } 263 264 /** gets the value of an existing int parameter 265 * 266 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 267 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 268 */ 269 SCIP_RETCODE SCIPgetIntParam( 270 SCIP* scip, /**< SCIP data structure */ 271 const char* name, /**< name of the parameter */ 272 int* value /**< pointer to store the parameter */ 273 ) 274 { 275 assert(scip != NULL); 276 assert(scip->set != NULL); 277 278 SCIP_CALL( SCIPsetGetIntParam(scip->set, name, value) ); 279 280 return SCIP_OKAY; 281 } 282 283 /** gets the value of an existing SCIP_Longint parameter 284 * 285 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 286 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 287 */ 288 SCIP_RETCODE SCIPgetLongintParam( 289 SCIP* scip, /**< SCIP data structure */ 290 const char* name, /**< name of the parameter */ 291 SCIP_Longint* value /**< pointer to store the parameter */ 292 ) 293 { 294 assert(scip != NULL); 295 assert(scip->set != NULL); 296 297 SCIP_CALL( SCIPsetGetLongintParam(scip->set, name, value) ); 298 299 return SCIP_OKAY; 300 } 301 302 /** gets the value of an existing SCIP_Real parameter 303 * 304 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 305 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 306 */ 307 SCIP_RETCODE SCIPgetRealParam( 308 SCIP* scip, /**< SCIP data structure */ 309 const char* name, /**< name of the parameter */ 310 SCIP_Real* value /**< pointer to store the parameter */ 311 ) 312 { 313 assert(scip != NULL); 314 assert(scip->set != NULL); 315 316 SCIP_CALL( SCIPsetGetRealParam(scip->set, name, value) ); 317 318 return SCIP_OKAY; 319 } 320 321 /** gets the value of an existing char parameter 322 * 323 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 324 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 325 */ 326 SCIP_RETCODE SCIPgetCharParam( 327 SCIP* scip, /**< SCIP data structure */ 328 const char* name, /**< name of the parameter */ 329 char* value /**< pointer to store the parameter */ 330 ) 331 { 332 assert(scip != NULL); 333 assert(scip->set != NULL); 334 335 SCIP_CALL( SCIPsetGetCharParam(scip->set, name, value) ); 336 337 return SCIP_OKAY; 338 } 339 340 /** gets the value of an existing string(char*) parameter 341 * 342 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 343 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 344 */ 345 SCIP_RETCODE SCIPgetStringParam( 346 SCIP* scip, /**< SCIP data structure */ 347 const char* name, /**< name of the parameter */ 348 char** value /**< pointer to store the parameter */ 349 ) 350 { 351 assert(scip != NULL); 352 assert(scip->set != NULL); 353 354 SCIP_CALL( SCIPsetGetStringParam(scip->set, name, value) ); 355 356 return SCIP_OKAY; 357 } 358 359 /** fixes the value of an existing parameter 360 * 361 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 362 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 363 * 364 * @note: Be careful with this method! Some general settings, e.g., the time or node limit, should not be fixed because 365 * they have to be changed for sub-SCIPs. 366 */ 367 SCIP_RETCODE SCIPfixParam( 368 SCIP* scip, /**< SCIP data structure */ 369 const char* name /**< name of the parameter */ 370 ) 371 { 372 assert(scip != NULL); 373 assert(scip->set != NULL); 374 375 SCIP_CALL( SCIPsetChgParamFixed(scip->set, name, TRUE) ); 376 377 return SCIP_OKAY; 378 } 379 380 /** unfixes the value of an existing parameter 381 * 382 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 383 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 384 */ 385 SCIP_RETCODE SCIPunfixParam( 386 SCIP* scip, /**< SCIP data structure */ 387 const char* name /**< name of the parameter */ 388 ) 389 { 390 assert(scip != NULL); 391 assert(scip->set != NULL); 392 393 SCIP_CALL( SCIPsetChgParamFixed(scip->set, name, FALSE) ); 394 395 return SCIP_OKAY; 396 } 397 398 /** changes the value of an existing SCIP_Bool parameter 399 * 400 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 401 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 402 */ 403 SCIP_RETCODE SCIPchgBoolParam( 404 SCIP* scip, /**< SCIP data structure */ 405 SCIP_PARAM* param, /**< parameter */ 406 SCIP_Bool value /**< new value of the parameter */ 407 ) 408 { 409 SCIP_RETCODE retcode; 410 411 assert(scip != NULL); 412 assert(scip->set != NULL); 413 414 retcode = SCIPsetChgBoolParam(scip->set, scip->messagehdlr, param, value); 415 416 if( retcode != SCIP_PARAMETERWRONGVAL ) 417 { 418 SCIP_CALL( retcode ); 419 } 420 421 return retcode; 422 } 423 424 /** changes the value of an existing SCIP_Bool parameter 425 * 426 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 427 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 428 */ 429 SCIP_RETCODE SCIPsetBoolParam( 430 SCIP* scip, /**< SCIP data structure */ 431 const char* name, /**< name of the parameter */ 432 SCIP_Bool value /**< new value of the parameter */ 433 ) 434 { 435 assert(scip != NULL); 436 assert(scip->set != NULL); 437 438 SCIP_CALL( SCIPsetSetBoolParam(scip->set, scip->messagehdlr, name, value) ); 439 440 return SCIP_OKAY; 441 } 442 443 /** checks whether the value of an existing SCIP_Bool parameter is valid */ 444 SCIP_Bool SCIPisBoolParamValid( 445 SCIP* scip, /**< SCIP data structure */ 446 SCIP_PARAM* param, /**< parameter */ 447 SCIP_Bool value /**< value to check */ 448 ) 449 { 450 assert(scip != NULL); 451 assert(param != NULL); 452 453 return SCIPparamIsValidBool(param, value); 454 } 455 456 /** changes the value of an existing int parameter 457 * 458 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 459 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 460 */ 461 SCIP_RETCODE SCIPchgIntParam( 462 SCIP* scip, /**< SCIP data structure */ 463 SCIP_PARAM* param, /**< parameter */ 464 int value /**< new value of the parameter */ 465 ) 466 { 467 SCIP_RETCODE retcode; 468 469 assert(scip != NULL); 470 assert(scip->set != NULL); 471 472 retcode = SCIPsetChgIntParam(scip->set, scip->messagehdlr, param, value); 473 474 if( retcode != SCIP_PARAMETERWRONGVAL ) 475 { 476 SCIP_CALL( retcode ); 477 } 478 479 return retcode; 480 } 481 482 /** changes the value of an existing int parameter 483 * 484 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 485 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 486 */ 487 SCIP_RETCODE SCIPsetIntParam( 488 SCIP* scip, /**< SCIP data structure */ 489 const char* name, /**< name of the parameter */ 490 int value /**< new value of the parameter */ 491 ) 492 { 493 assert(scip != NULL); 494 assert(scip->set != NULL); 495 496 SCIP_CALL( SCIPsetSetIntParam(scip->set, scip->messagehdlr, name, value) ); 497 498 return SCIP_OKAY; 499 } 500 501 /** checks whether parameter value of an existing int paramter is valid */ 502 SCIP_Bool SCIPisIntParamValid( 503 SCIP* scip, /**< SCIP data structure */ 504 SCIP_PARAM* param, /**< parameter */ 505 int value /**< value to check */ 506 ) 507 { 508 assert(scip != NULL); 509 assert(param != NULL); 510 511 return SCIPparamIsValidInt(param, value); 512 } 513 514 /** changes the value of an existing SCIP_Longint parameter 515 * 516 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 517 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 518 */ 519 SCIP_RETCODE SCIPchgLongintParam( 520 SCIP* scip, /**< SCIP data structure */ 521 SCIP_PARAM* param, /**< parameter */ 522 SCIP_Longint value /**< new value of the parameter */ 523 ) 524 { 525 SCIP_RETCODE retcode; 526 527 assert(scip != NULL); 528 assert(scip->set != NULL); 529 530 retcode = SCIPsetChgLongintParam(scip->set, scip->messagehdlr, param, value); 531 532 if( retcode != SCIP_PARAMETERWRONGVAL ) 533 { 534 SCIP_CALL( retcode ); 535 } 536 537 return retcode; 538 } 539 540 /** changes the value of an existing SCIP_Longint parameter 541 * 542 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 543 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 544 */ 545 SCIP_RETCODE SCIPsetLongintParam( 546 SCIP* scip, /**< SCIP data structure */ 547 const char* name, /**< name of the parameter */ 548 SCIP_Longint value /**< new value of the parameter */ 549 ) 550 { 551 assert(scip != NULL); 552 assert(scip->set != NULL); 553 554 SCIP_CALL( SCIPsetSetLongintParam(scip->set, scip->messagehdlr, name, value) ); 555 556 return SCIP_OKAY; 557 } 558 559 /** checks whether parameter value of an existing SCIP_Longint paramter is valid */ 560 SCIP_Bool SCIPisLongintParamValid( 561 SCIP* scip, /**< SCIP data structure */ 562 SCIP_PARAM* param, /**< parameter */ 563 SCIP_Longint value /**< value to check */ 564 ) 565 { 566 assert(scip != NULL); 567 assert(param != NULL); 568 569 return SCIPparamIsValidLongint(param, value); 570 } 571 572 /** changes the value of an existing SCIP_Real parameter 573 * 574 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 575 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 576 */ 577 SCIP_RETCODE SCIPchgRealParam( 578 SCIP* scip, /**< SCIP data structure */ 579 SCIP_PARAM* param, /**< parameter */ 580 SCIP_Real value /**< new value of the parameter */ 581 ) 582 { 583 SCIP_RETCODE retcode; 584 585 assert(scip != NULL); 586 assert(scip->set != NULL); 587 588 retcode = SCIPsetChgRealParam(scip->set, scip->messagehdlr, param, value); 589 590 if( retcode != SCIP_PARAMETERWRONGVAL ) 591 { 592 SCIP_CALL( retcode ); 593 } 594 595 return retcode; 596 } 597 598 /** changes the value of an existing SCIP_Real parameter 599 * 600 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 601 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 602 */ 603 SCIP_RETCODE SCIPsetRealParam( 604 SCIP* scip, /**< SCIP data structure */ 605 const char* name, /**< name of the parameter */ 606 SCIP_Real value /**< new value of the parameter */ 607 ) 608 { 609 assert(scip != NULL); 610 assert(scip->set != NULL); 611 612 SCIP_CALL( SCIPsetSetRealParam(scip->set, scip->messagehdlr, name, value) ); 613 614 return SCIP_OKAY; 615 } 616 617 /** checks whether parameter value of an existing SCIP_Real paramter is valid */ 618 SCIP_Bool SCIPisRealParamValid( 619 SCIP* scip, /**< SCIP data structure */ 620 SCIP_PARAM* param, /**< parameter */ 621 SCIP_Real value /**< value to check */ 622 ) 623 { 624 assert(scip != NULL); 625 assert(param != NULL); 626 627 return SCIPparamIsValidReal(param, value); 628 } 629 630 /** changes the value of an existing char parameter 631 * 632 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 633 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 634 */ 635 SCIP_RETCODE SCIPchgCharParam( 636 SCIP* scip, /**< SCIP data structure */ 637 SCIP_PARAM* param, /**< parameter */ 638 char value /**< new value of the parameter */ 639 ) 640 { 641 SCIP_RETCODE retcode; 642 643 assert(scip != NULL); 644 assert(scip->set != NULL); 645 646 retcode = SCIPsetChgCharParam(scip->set, scip->messagehdlr, param, value); 647 648 if( retcode != SCIP_PARAMETERWRONGVAL ) 649 { 650 SCIP_CALL( retcode ); 651 } 652 653 return retcode; 654 } 655 656 /** changes the value of an existing char parameter 657 * 658 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 659 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 660 */ 661 SCIP_RETCODE SCIPsetCharParam( 662 SCIP* scip, /**< SCIP data structure */ 663 const char* name, /**< name of the parameter */ 664 char value /**< new value of the parameter */ 665 ) 666 { 667 assert(scip != NULL); 668 assert(scip->set != NULL); 669 670 SCIP_CALL( SCIPsetSetCharParam(scip->set, scip->messagehdlr, name, value) ); 671 672 return SCIP_OKAY; 673 } 674 675 /** checks whether parameter value for a given SCIP_Real parameter is valid */ 676 SCIP_Bool SCIPisCharParamValid( 677 SCIP* scip, /**< SCIP data structure */ 678 SCIP_PARAM* param, /**< parameter */ 679 const char value /**< value to check */ 680 ) 681 { 682 assert(scip != NULL); 683 assert(param != NULL); 684 685 return SCIPparamIsValidChar(param, value); 686 } 687 688 /** changes the value of an existing string(char*) parameter 689 * 690 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 691 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 692 */ 693 SCIP_RETCODE SCIPchgStringParam( 694 SCIP* scip, /**< SCIP data structure */ 695 SCIP_PARAM* param, /**< parameter */ 696 const char* value /**< new value of the parameter */ 697 ) 698 { 699 SCIP_RETCODE retcode; 700 701 assert(scip != NULL); 702 assert(scip->set != NULL); 703 704 retcode = SCIPsetChgStringParam(scip->set, scip->messagehdlr, param, value); 705 706 if( retcode != SCIP_PARAMETERWRONGVAL ) 707 { 708 SCIP_CALL( retcode ); 709 } 710 711 return retcode; 712 } 713 714 /** changes the value of an existing string(char*) parameter 715 * 716 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 717 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 718 */ 719 SCIP_RETCODE SCIPsetStringParam( 720 SCIP* scip, /**< SCIP data structure */ 721 const char* name, /**< name of the parameter */ 722 const char* value /**< new value of the parameter */ 723 ) 724 { 725 assert(scip != NULL); 726 assert(scip->set != NULL); 727 728 SCIP_CALL( SCIPsetSetStringParam(scip->set, scip->messagehdlr, name, value) ); 729 730 return SCIP_OKAY; 731 } 732 733 /** checks whether parameter value for a given string parameter is valid */ 734 SCIP_Bool SCIPisStringParamValid( 735 SCIP* scip, /**< SCIP data structure */ 736 SCIP_PARAM* param, /**< parameter */ 737 const char* value /**< value to check */ 738 ) 739 { 740 assert(scip != NULL); 741 assert(param != NULL); 742 743 return SCIPparamIsValidString(param, value); 744 } 745 746 /** changes the value of an existing parameter 747 * 748 * The parameter type is checked and conversion of the given value to this type is attempted. 749 * 750 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 751 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 752 */ 753 SCIP_RETCODE SCIPsetParam( 754 SCIP* scip, /**< SCIP data structure */ 755 const char* name, /**< name of the parameter */ 756 const char* value /**< new value of the parameter as string */ 757 ) 758 { 759 assert(scip != NULL); 760 assert(scip->set != NULL); 761 762 SCIP_CALL( SCIPsetSetParam(scip->set, scip->messagehdlr, name, value) ); 763 764 return SCIP_OKAY; 765 } 766 767 /** reads parameters from a file 768 * 769 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 770 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 771 */ 772 SCIP_RETCODE SCIPreadParams( 773 SCIP* scip, /**< SCIP data structure */ 774 const char* filename /**< file name */ 775 ) 776 { 777 assert(scip != NULL); 778 assert(scip->set != NULL); 779 780 SCIP_CALL( SCIPsetReadParams(scip->set, scip->messagehdlr, filename) ); 781 782 return SCIP_OKAY; 783 } 784 785 /** writes a single parameter to a file 786 * 787 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 788 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 789 */ 790 SCIP_RETCODE SCIPwriteParam( 791 SCIP* scip, /**< SCIP data structure */ 792 SCIP_PARAM* param, /**< parameter */ 793 const char* filename, /**< file name, or NULL for stdout */ 794 SCIP_Bool comments, /**< should parameter descriptions be written as comments? */ 795 SCIP_Bool onlychanged /**< should only those parameters be written that are changed from their 796 * default value? 797 */ 798 ) 799 { 800 assert(scip != NULL); 801 assert(param != NULL); 802 803 SCIP_CALL( SCIPparamWrite(param, scip->messagehdlr, filename, comments, onlychanged) ); 804 805 return SCIP_OKAY; 806 } 807 808 /** writes all parameters in the parameter set to a file 809 * 810 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 811 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 812 */ 813 SCIP_RETCODE SCIPwriteParams( 814 SCIP* scip, /**< SCIP data structure */ 815 const char* filename, /**< file name, or NULL for stdout */ 816 SCIP_Bool comments, /**< should parameter descriptions be written as comments? */ 817 SCIP_Bool onlychanged /**< should only those parameters be written that are changed from their 818 * default value? 819 */ 820 ) 821 { 822 assert(scip != NULL); 823 assert(scip->set != NULL); 824 825 SCIP_CALL( SCIPsetWriteParams(scip->set, scip->messagehdlr, filename, comments, onlychanged) ); 826 827 return SCIP_OKAY; 828 } 829 830 /** resets a single parameter to its default value 831 * 832 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 833 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 834 */ 835 SCIP_RETCODE SCIPresetParam( 836 SCIP* scip, /**< SCIP data structure */ 837 const char* name /**< name of the parameter */ 838 ) 839 { 840 assert(scip != NULL); 841 assert(scip->set != NULL); 842 843 SCIP_CALL( SCIPsetResetParam(scip->set, scip->messagehdlr, name) ); 844 845 return SCIP_OKAY; 846 } 847 848 /** resets all parameters to their default values 849 * 850 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 851 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 852 */ 853 SCIP_RETCODE SCIPresetParams( 854 SCIP* scip /**< SCIP data structure */ 855 ) 856 { 857 assert(scip != NULL); 858 assert(scip->set != NULL); 859 860 SCIP_CALL( SCIPsetResetParams(scip->set, scip->messagehdlr) ); 861 862 return SCIP_OKAY; 863 } 864 865 /** sets parameters to 866 * 867 * - \ref SCIP_PARAMEMPHASIS_DEFAULT to use default values (see also SCIPresetParams()) 868 * - \ref SCIP_PARAMEMPHASIS_COUNTER to get feasible and "fast" counting process 869 * - \ref SCIP_PARAMEMPHASIS_CPSOLVER to get CP like search (e.g. no LP relaxation) 870 * - \ref SCIP_PARAMEMPHASIS_EASYCIP to solve easy problems fast 871 * - \ref SCIP_PARAMEMPHASIS_FEASIBILITY to detect feasibility fast 872 * - \ref SCIP_PARAMEMPHASIS_HARDLP to be capable to handle hard LPs 873 * - \ref SCIP_PARAMEMPHASIS_OPTIMALITY to prove optimality fast 874 * - \ref SCIP_PARAMEMPHASIS_PHASEFEAS to find feasible solutions during a 3 phase solution process 875 * - \ref SCIP_PARAMEMPHASIS_PHASEIMPROVE to find improved solutions during a 3 phase solution process 876 * - \ref SCIP_PARAMEMPHASIS_PHASEPROOF to proof optimality during a 3 phase solution process 877 * - \ref SCIP_PARAMEMPHASIS_NUMERICS to solve problems which cause numerical issues 878 * 879 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 880 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 881 */ 882 SCIP_RETCODE SCIPsetEmphasis( 883 SCIP* scip, /**< SCIP data structure */ 884 SCIP_PARAMEMPHASIS paramemphasis, /**< parameter settings */ 885 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */ 886 ) 887 { 888 assert(scip != NULL); 889 assert(scip->set != NULL); 890 891 SCIP_CALL( SCIPsetSetEmphasis(scip->set, scip->messagehdlr, paramemphasis, quiet) ); 892 893 return SCIP_OKAY; 894 } 895 896 /** sets parameters to deactivate separators and heuristics that use auxiliary SCIP instances; should be called for 897 * auxiliary SCIP instances to avoid recursion 898 * 899 * @note only deactivates plugins which could cause recursion, some plugins which use sub-SCIPs stay activated 900 * 901 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 902 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 903 */ 904 SCIP_RETCODE SCIPsetSubscipsOff( 905 SCIP* scip, /**< (auxiliary) SCIP data structure */ 906 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */ 907 ) 908 { 909 assert(scip != NULL); 910 assert(scip->set != NULL); 911 912 SCIP_CALL( SCIPsetSetSubscipsOff(scip->set, scip->messagehdlr, quiet) ); 913 914 return SCIP_OKAY; 915 } 916 917 /** sets heuristic parameters values to 918 * 919 * - SCIP_PARAMSETTING_DEFAULT which are the default values of all heuristic parameters 920 * - SCIP_PARAMSETTING_FAST such that the time spent on heuristics is decreased 921 * - SCIP_PARAMSETTING_AGGRESSIVE such that the heuristics are called more aggressively 922 * - SCIP_PARAMSETTING_OFF which turn off all heuristics 923 * 924 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 925 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 926 */ 927 SCIP_RETCODE SCIPsetHeuristics( 928 SCIP* scip, /**< SCIP data structure */ 929 SCIP_PARAMSETTING paramsetting, /**< parameter settings */ 930 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */ 931 ) 932 { 933 assert(scip != NULL); 934 assert(scip->set != NULL); 935 assert(paramsetting == SCIP_PARAMSETTING_DEFAULT || paramsetting == SCIP_PARAMSETTING_FAST 936 || paramsetting == SCIP_PARAMSETTING_AGGRESSIVE || paramsetting == SCIP_PARAMSETTING_OFF); 937 938 SCIP_CALL( SCIPsetSetHeuristics(scip->set, scip->messagehdlr, paramsetting, quiet) ); 939 940 return SCIP_OKAY; 941 } 942 943 /** sets presolving parameters to 944 * 945 * - SCIP_PARAMSETTING_DEFAULT which are the default values of all presolving parameters 946 * - SCIP_PARAMSETTING_FAST such that the time spent on presolving is decreased 947 * - SCIP_PARAMSETTING_AGGRESSIVE such that the presolving is more aggressive 948 * - SCIP_PARAMSETTING_OFF which turn off all presolving 949 * 950 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 951 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 952 */ 953 SCIP_RETCODE SCIPsetPresolving( 954 SCIP* scip, /**< SCIP data structure */ 955 SCIP_PARAMSETTING paramsetting, /**< parameter settings */ 956 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */ 957 ) 958 { 959 assert(scip != NULL); 960 assert(scip->set != NULL); 961 assert(paramsetting == SCIP_PARAMSETTING_DEFAULT || paramsetting == SCIP_PARAMSETTING_FAST 962 || paramsetting == SCIP_PARAMSETTING_AGGRESSIVE || paramsetting == SCIP_PARAMSETTING_OFF); 963 964 SCIP_CALL( SCIPsetSetPresolving(scip->set, scip->messagehdlr, paramsetting, quiet) ); 965 966 return SCIP_OKAY; 967 } 968 969 /** sets separating parameters to 970 * 971 * - SCIP_PARAMSETTING_DEFAULT which are the default values of all separating parameters 972 * - SCIP_PARAMSETTING_FAST such that the time spent on separating is decreased 973 * - SCIP_PARAMSETTING_AGGRESSIVE such that separating is more aggressive 974 * - SCIP_PARAMSETTING_OFF which turn off all separating 975 * 976 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 977 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 978 */ 979 SCIP_RETCODE SCIPsetSeparating( 980 SCIP* scip, /**< SCIP data structure */ 981 SCIP_PARAMSETTING paramsetting, /**< parameter settings */ 982 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */ 983 ) 984 { 985 assert(scip != NULL); 986 assert(scip->set != NULL); 987 assert(paramsetting == SCIP_PARAMSETTING_DEFAULT || paramsetting == SCIP_PARAMSETTING_FAST 988 || paramsetting == SCIP_PARAMSETTING_AGGRESSIVE || paramsetting == SCIP_PARAMSETTING_OFF); 989 990 SCIP_CALL( SCIPsetSetSeparating(scip->set, scip->messagehdlr, paramsetting, quiet) ); 991 992 return SCIP_OKAY; 993 } 994 995 /** returns the array of all available SCIP parameters 996 * 997 * @return SCIP_PARAM* array, containing all SCIP parameters. 998 */ 999 SCIP_PARAM** SCIPgetParams( 1000 SCIP* scip /**< SCIP data structure */ 1001 ) 1002 { 1003 assert(scip != NULL); 1004 assert(scip->set != NULL); 1005 1006 return SCIPsetGetParams(scip->set); 1007 } 1008 1009 /** returns the total number of all available SCIP parameters 1010 * 1011 * @return number of all SCIP parameters. 1012 */ 1013 int SCIPgetNParams( 1014 SCIP* scip /**< SCIP data structure */ 1015 ) 1016 { 1017 assert(scip != NULL); 1018 assert(scip->set != NULL); 1019 1020 return SCIPsetGetNParams(scip->set); 1021 } 1022 1023 /** returns whether plugins with sub-SCIPs that could cause recursion have been disabled 1024 * 1025 * @return the value of the variable set->subscipsoff 1026 */ 1027 SCIP_Bool SCIPgetSubscipsOff( 1028 SCIP* scip /**< SCIP data structure */ 1029 ) 1030 { 1031 assert(scip != NULL); 1032 assert(scip->set != NULL); 1033 1034 return SCIPsetGetSubscipsOff(scip->set); 1035 } 1036