Scippy

SCIP

Solving Constraint Integer Programs

paramset.c
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
4/* SCIP --- Solving Constraint Integer Programs */
5/* */
6/* Copyright (c) 2002-2024 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 paramset.c
26 * @ingroup OTHER_CFILES
27 * @brief methods for handling parameter settings
28 * @author Tobias Achterberg
29 * @author Timo Berthold
30 * @author Stefan Heinz
31 * @author Gerald Gamrath
32 * @author Marc Pfetsch
33 */
34
35/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
36
37#include <assert.h>
38#include <string.h>
39#if defined(_WIN32) || defined(_WIN64)
40#else
41#include <strings.h> /*lint --e{766}*/
42#endif
43
44#include "scip/scip.h"
45#include "scip/set.h"
46#include "scip/paramset.h"
47
49
50
51
52/*
53 * Parameter methods
54 */
55
56/** hash key retrieval function for parameters */
57static
58SCIP_DECL_HASHGETKEY(hashGetKeyParam)
59{ /*lint --e{715}*/
60 SCIP_PARAM* param;
61
62 param = (SCIP_PARAM*)elem;
63 assert(param != NULL);
64
65 return param->name;
66}
67
68/** tests whether parameter can be changed and issues an error message if it is fixed */
69static
71 SCIP_PARAM* param, /**< parameter */
72 SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
73 )
74{ /*lint --e{715}*/
75 assert(param != NULL);
76 assert(messagehdlr != NULL);
77
78 if( param->isfixed )
79 {
80 SCIPerrorMessage("parameter <%s> is fixed and cannot be changed. Unfix it to allow changing the value.\n", param->name);
82 }
83
84 return SCIP_OKAY;
85}
86
87/** tests parameter value according to the given feasible domain; issues an error message if value was invalid */
88static
90 SCIP_PARAM* param, /**< parameter */
91 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
92 SCIP_Bool value /**< value to test */
93 )
94{ /*lint --e{715}*/
95 assert(param != NULL);
96 assert(param->paramtype == SCIP_PARAMTYPE_BOOL);
97 assert(messagehdlr != NULL);
98
99 if( value != TRUE && value != FALSE )
100 {
101 SCIPerrorMessage("Invalid value <%u> for bool parameter <%s>. Must be <0> (FALSE) or <1> (TRUE).\n", value, param->name);
103 }
104
105 return SCIP_OKAY;
106}
107
108/** tests parameter value according to the given feasible domain; issues an error message if value was invalid */
109static
111 SCIP_PARAM* param, /**< parameter */
112 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
113 int value /**< value to test */
114 )
115{ /*lint --e{715}*/
116 assert(param != NULL);
117 assert(param->paramtype == SCIP_PARAMTYPE_INT);
118 assert(messagehdlr != NULL);
119
120 if( value < param->data.intparam.minvalue || value > param->data.intparam.maxvalue )
121 {
122 SCIPerrorMessage("Invalid value <%d> for int parameter <%s>. Must be in range [%d,%d].\n",
123 value, param->name, param->data.intparam.minvalue, param->data.intparam.maxvalue);
125 }
126
127 return SCIP_OKAY;
128}
129
130/** tests parameter value according to the given feasible domain; issues an error message if value was invalid */
131static
133 SCIP_PARAM* param, /**< parameter */
134 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
135 SCIP_Longint value /**< value to test */
136 )
137{ /*lint --e{715}*/
138 assert(param != NULL);
139 assert(param->paramtype == SCIP_PARAMTYPE_LONGINT);
140 assert(messagehdlr != NULL);
141
142 if( value < param->data.longintparam.minvalue || value > param->data.longintparam.maxvalue )
143 {
144 SCIPerrorMessage("Invalid value <%" SCIP_LONGINT_FORMAT "> for longint parameter <%s>. Must be in range [%" SCIP_LONGINT_FORMAT ",%" SCIP_LONGINT_FORMAT "].\n",
145 value, param->name, param->data.longintparam.minvalue, param->data.longintparam.maxvalue);
147 }
148
149 return SCIP_OKAY;
150}
151
152/** tests parameter value according to the given feasible domain; issues an error message if value was invalid */
153static
155 SCIP_PARAM* param, /**< parameter */
156 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
157 SCIP_Real value /**< value to test */
158 )
159{ /*lint --e{715}*/
160 assert(param != NULL);
161 assert(param->paramtype == SCIP_PARAMTYPE_REAL);
162 assert(messagehdlr != NULL);
163
164 if( value < param->data.realparam.minvalue || value > param->data.realparam.maxvalue )
165 {
166 SCIPerrorMessage("Invalid value <%.15g> for real parameter <%s>. Must be in range [%.15g,%.15g].\n",
167 value, param->name, param->data.realparam.minvalue, param->data.realparam.maxvalue);
169 }
170
171 return SCIP_OKAY;
172}
173
174/** tests parameter value according to the given feasible domain; issues an error message if value was invalid */
175static
177 SCIP_PARAM* param, /**< parameter */
178 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
179 char value /**< value to test */
180 )
181{ /*lint --e{715}*/
182 assert(param != NULL);
183 assert(param->paramtype == SCIP_PARAMTYPE_CHAR);
184 assert(messagehdlr != NULL);
185
186 if( value == '\b' || value == '\f' || value == '\n' || value == '\r' || value == '\v' )
187 {
188 SCIPerrorMessage("Invalid value <%d> for char parameter <%s>.\n", (int)value, param->name);
190 }
191
192 if( param->data.charparam.allowedvalues != NULL )
193 {
194 char* c;
195
196 c = param->data.charparam.allowedvalues;
197 while( *c != '\0' && *c != value )
198 c++;
199
200 if( *c != value )
201 {
202 SCIPerrorMessage("Invalid value <%c> for char parameter <%s>. Must be in set {%s}.\n",
203 value, param->name, param->data.charparam.allowedvalues);
205 }
206 }
207
208 return SCIP_OKAY;
209}
210
211/** tests parameter value according to the given feasible domain; issues an error message if value was invalid */
212static
214 SCIP_PARAM* param, /**< parameter */
215 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
216 const char* value /**< value to test */
217 )
218{ /*lint --e{715}*/
219 unsigned int i;
220
221 assert(param != NULL);
222 assert(param->paramtype == SCIP_PARAMTYPE_STRING);
223 assert(messagehdlr != NULL);
224
225 if( value == NULL )
226 {
227 SCIPerrorMessage("Cannot assign a NULL string to a string parameter.\n");
229 }
230
231 for( i = 0; i < (unsigned int) strlen(value); ++i )
232 {
233 if( value[i] == '\b' || value[i] == '\f' || value[i] == '\n' || value[i] == '\r' || value[i] == '\v' )
234 {
235 SCIPerrorMessage("Invalid character <%d> in string parameter <%s> at position %u.\n", (int)value[i], param->name, i);
237 }
238 }
239
240 return SCIP_OKAY;
241}
242
243/** writes the parameter to a file */
244static
246 SCIP_PARAM* param, /**< parameter */
247 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
248 FILE* file, /**< file stream to write parameter to, or NULL for stdout */
249 SCIP_Bool comments, /**< should parameter descriptions be written as comments? */
250 SCIP_Bool onlychanged /**< should only the parameters been written, that are changed from default? */
251 )
252{
253 assert(param != NULL);
254 assert(messagehdlr != NULL);
255
256 /* write parameters at default values only, if the onlychanged flag is not set or if the parameter is fixed */
257 if( onlychanged && SCIPparamIsDefault(param) && !SCIPparamIsFixed(param) )
258 return SCIP_OKAY;
259
260 /* write parameter description, bounds, and defaults as comments */
261 if( comments )
262 {
263 SCIPmessageFPrintInfo(messagehdlr, file, "# %s\n", param->desc);
264 switch( param->paramtype )
265 {
267 SCIPmessageFPrintInfo(messagehdlr, file, "# [type: bool, advanced: %s, range: {TRUE,FALSE}, default: %s]\n",
268 SCIPparamIsAdvanced(param) ? "TRUE" : "FALSE",
269 param->data.boolparam.defaultvalue ? "TRUE" : "FALSE");
270 break;
272 SCIPmessageFPrintInfo(messagehdlr, file, "# [type: int, advanced: %s, range: [%d,%d], default: %d]\n",
273 SCIPparamIsAdvanced(param) ? "TRUE" : "FALSE",
275 break;
277 SCIPmessageFPrintInfo(messagehdlr, file, "# [type: longint, advanced: %s, range: [%" SCIP_LONGINT_FORMAT ",%" SCIP_LONGINT_FORMAT "], default: %" SCIP_LONGINT_FORMAT "]\n",
278 SCIPparamIsAdvanced(param) ? "TRUE" : "FALSE",
280 break;
282 SCIPmessageFPrintInfo(messagehdlr, file, "# [type: real, advanced: %s, range: [%.15g,%.15g], default: %.15g]\n",
283 SCIPparamIsAdvanced(param) ? "TRUE" : "FALSE",
285 break;
287 SCIPmessageFPrintInfo(messagehdlr, file, "# [type: char, advanced: %s, range: {%s}, default: %c]\n",
288 SCIPparamIsAdvanced(param) ? "TRUE" : "FALSE",
289 param->data.charparam.allowedvalues != NULL ? param->data.charparam.allowedvalues : "all chars",
291 break;
293 SCIPmessageFPrintInfo(messagehdlr, file, "# [type: string, advanced: %s, default: \"%s\"]\n",
294 SCIPparamIsAdvanced(param) ? "TRUE" : "FALSE",
296 break;
297 default:
298 SCIPerrorMessage("unknown parameter type\n");
299 return SCIP_INVALIDDATA;
300 }
301 }
302
303 /* write parameter value */
304 SCIPmessageFPrintInfo(messagehdlr, file, "%s = ", param->name);
305 switch( param->paramtype )
306 {
308 SCIPmessageFPrintInfo(messagehdlr, file, "%s", SCIPparamGetBool(param) ? "TRUE" : "FALSE");
309 break;
311 SCIPmessageFPrintInfo(messagehdlr, file, "%d", SCIPparamGetInt(param));
312 break;
314 SCIPmessageFPrintInfo(messagehdlr, file, "%" SCIP_LONGINT_FORMAT "", SCIPparamGetLongint(param));
315 break;
317 SCIPmessageFPrintInfo(messagehdlr, file, "%.15g", SCIPparamGetReal(param));
318 break;
320 SCIPmessageFPrintInfo(messagehdlr, file, "%c", SCIPparamGetChar(param));
321 break;
323 SCIPmessageFPrintInfo(messagehdlr, file, "\"%s\"", SCIPparamGetString(param));
324 break;
325 default:
326 SCIPerrorMessage("unknown parameter type\n");
327 return SCIP_INVALIDDATA;
328 }
329
330 /* write "fix" after value if parameter is fixed */
331 if( SCIPparamIsFixed(param) )
332 SCIPmessageFPrintInfo(messagehdlr, file, " fix");
333
334 SCIPmessageFPrintInfo(messagehdlr, file, "\n");
335
336 if( comments )
337 SCIPmessageFPrintInfo(messagehdlr, file, "\n");
338
339 return SCIP_OKAY;
340}
341
342/** if a bool parameter exits with the given parameter name it is set to the new value */
343static
345 SCIP_PARAMSET* paramset, /**< parameter set */
346 SCIP_SET* set, /**< global SCIP settings */
347 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
348 const char* paramname, /**< parameter name */
349 SCIP_Bool value, /**< new value of the parameter */
350 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
351 )
352{
353 SCIP_PARAM* param;
354
355 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)paramname);
356 if( param != NULL )
357 {
358 assert(SCIPparamGetType(param) == SCIP_PARAMTYPE_BOOL);
359
360 if( SCIPparamIsFixed(param) )
361 {
362 SCIPsetDebugMsg(set, "hard coded parameter <%s> is fixed and is thus not changed.\n", param->name);
363
364 return SCIP_OKAY;
365 }
366 SCIP_CALL( SCIPparamSetBool(param, set, messagehdlr, value, FALSE, quiet) );
367 }
368#ifndef NDEBUG
369 else
370 {
371 SCIPmessagePrintWarning(messagehdlr, "unknown hard coded bool parameter <%s>\n", paramname);
372 }
373#endif
374
375 return SCIP_OKAY;
376}
377
378/** if an char parameter exits with the given parameter name it is set to the new value */
379static
381 SCIP_PARAMSET* paramset, /**< parameter set */
382 SCIP_SET* set, /**< global SCIP settings */
383 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
384 const char* paramname, /**< parameter name */
385 char value, /**< new value of the parameter */
386 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
387 )
388{
389 SCIP_PARAM* param;
390
391 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)paramname);
392 if( param != NULL )
393 {
394 assert(SCIPparamGetType(param) == SCIP_PARAMTYPE_CHAR);
395
396 if( SCIPparamIsFixed(param) )
397 {
398 SCIPsetDebugMsg(set, "hard coded parameter <%s> is fixed and is thus not changed.\n", param->name);
399
400 return SCIP_OKAY;
401 }
402 SCIP_CALL( SCIPparamSetChar(param, set, messagehdlr, value, FALSE, quiet) );
403 }
404#ifndef NDEBUG
405 else
406 {
407 SCIPmessagePrintWarning(messagehdlr, "unknown hard coded char parameter <%s>\n", paramname);
408 }
409#endif
410
411 return SCIP_OKAY;
412}
413
414/** if an integer parameter exits with the given parameter name it is set to the new value */
415static
417 SCIP_PARAMSET* paramset, /**< parameter set */
418 SCIP_SET* set, /**< global SCIP settings */
419 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
420 const char* paramname, /**< parameter name */
421 int value, /**< new value of the parameter */
422 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
423 )
424{
425 SCIP_PARAM* param;
426
427 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)paramname);
428 if( param != NULL )
429 {
430 assert(SCIPparamGetType(param) == SCIP_PARAMTYPE_INT);
431
432 if( SCIPparamIsFixed(param) )
433 {
434 SCIPsetDebugMsg(set, "hard coded parameter <%s> is fixed and is thus not changed.\n", param->name);
435
436 return SCIP_OKAY;
437 }
438 SCIP_CALL( SCIPparamSetInt(param, set, messagehdlr, value, FALSE, quiet) );
439 }
440#ifndef NDEBUG
441 else
442 {
443 SCIPmessagePrintWarning(messagehdlr, "unknown hard coded int parameter <%s>\n", paramname);
444 }
445#endif
446
447 return SCIP_OKAY;
448}
449
450/** if a long integer parameter exits with the given parameter name it is set to the new value */
451static
453 SCIP_PARAMSET* paramset, /**< parameter set */
454 SCIP_SET* set, /**< global SCIP settings */
455 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
456 const char* paramname, /**< parameter name */
457 SCIP_Longint value, /**< new value of the parameter */
458 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
459 )
460{
461 SCIP_PARAM* param;
462
463 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)paramname);
464 if( param != NULL )
465 {
467
468 if( SCIPparamIsFixed(param) )
469 {
470 SCIPsetDebugMsg(set, "hard coded parameter <%s> is fixed and is thus not changed.\n", param->name);
471
472 return SCIP_OKAY;
473 }
474 SCIP_CALL( SCIPparamSetLongint(param, set, messagehdlr, value, FALSE, quiet) );
475 }
476#ifndef NDEBUG
477 else
478 {
479 SCIPmessagePrintWarning(messagehdlr, "unknown hard coded longint parameter <%s>\n", paramname);
480 }
481#endif
482
483 return SCIP_OKAY;
484}
485
486/** if a real parameter exits with the given parameter name it is set to the new value */
487static
489 SCIP_PARAMSET* paramset, /**< parameter set */
490 SCIP_SET* set, /**< global SCIP settings */
491 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
492 const char* paramname, /**< parameter name */
493 SCIP_Real value, /**< new value of the parameter */
494 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
495 )
496{
497 SCIP_PARAM* param;
498
499 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)paramname);
500 if( param != NULL )
501 {
502 assert(SCIPparamGetType(param) == SCIP_PARAMTYPE_REAL);
503
504 if( SCIPparamIsFixed(param) )
505 {
506 SCIPsetDebugMsg(set, "hard coded parameter <%s> is fixed and is thus not changed.\n", param->name);
507
508 return SCIP_OKAY;
509 }
510 SCIP_CALL( SCIPparamSetReal(param, set, messagehdlr, value, FALSE, quiet) );
511 }
512#ifndef NDEBUG
513 else
514 {
515 SCIPmessagePrintWarning(messagehdlr, "unknown hard coded real parameter <%s>\n", paramname);
516 }
517#endif
518
519 return SCIP_OKAY;
520}
521
522/** copies value of source Bool parameter to target Bool parameter*/
523static
525 SCIP_PARAM* sourceparam, /**< source Bool parameter */
526 SCIP_PARAM* targetparam, /**< target Bool parameter */
527 SCIP_SET* set, /**< global SCIP settings of target SCIP */
528 SCIP_MESSAGEHDLR* messagehdlr /**< message handler of target SCIP */
529 )
530{
531 SCIP_Bool value;
532
533 assert(sourceparam != NULL);
534 assert(targetparam != NULL);
535
536 /* get value of source parameter and copy it to target parameter */
537 value = SCIPparamGetBool(sourceparam);
538 SCIP_CALL( SCIPparamSetBool(targetparam, set, messagehdlr, value, FALSE, TRUE) );
539
540 return SCIP_OKAY;
541}
542
543/** copies value of source int parameter to target int parameter*/
544static
546 SCIP_PARAM* sourceparam, /**< source int parameter */
547 SCIP_PARAM* targetparam, /**< target int parameter */
548 SCIP_SET* set, /**< global SCIP settings of target SCIP */
549 SCIP_MESSAGEHDLR* messagehdlr /**< message handler of target SCIP */
550 )
551{
552 int value;
553
554 assert(sourceparam != NULL);
555 assert(targetparam != NULL);
556
557 /* get value of source parameter and copy it to target parameter */
558 value = SCIPparamGetInt(sourceparam);
559 SCIP_CALL( SCIPparamSetInt(targetparam, set, messagehdlr, value, FALSE, TRUE) );
560
561 return SCIP_OKAY;
562}
563
564/** copies value of source longint parameter to target longint parameter*/
565static
567 SCIP_PARAM* sourceparam, /**< source longint parameter */
568 SCIP_PARAM* targetparam, /**< target longint parameter */
569 SCIP_SET* set, /**< global SCIP settings of target SCIP */
570 SCIP_MESSAGEHDLR* messagehdlr /**< message handler of target SCIP */
571 )
572{
573 SCIP_Longint value;
574
575 assert(sourceparam != NULL);
576 assert(targetparam != NULL);
577
578 /* get value of source parameter and copy it to target parameter */
579 value = SCIPparamGetLongint(sourceparam);
580 SCIP_CALL( SCIPparamSetLongint(targetparam, set, messagehdlr, value, FALSE, TRUE) );
581
582 return SCIP_OKAY;
583}
584
585/** copies value of source real parameter to target real parameter*/
586static
588 SCIP_PARAM* sourceparam, /**< source real parameter */
589 SCIP_PARAM* targetparam, /**< target real parameter */
590 SCIP_SET* set, /**< global SCIP settings of target SCIP */
591 SCIP_MESSAGEHDLR* messagehdlr /**< message handler of target SCIP */
592 )
593{
594 SCIP_Real value;
595
596 assert(sourceparam != NULL);
597 assert(targetparam != NULL);
598
599 /* get value of source parameter and copy it to target parameter */
600 value = SCIPparamGetReal(sourceparam);
601 SCIP_CALL( SCIPparamSetReal(targetparam, set, messagehdlr, value, FALSE, TRUE) );
602
603 return SCIP_OKAY;
604}
605
606/** copies value of source char parameter to target char parameter*/
607static
609 SCIP_PARAM* sourceparam, /**< source char parameter */
610 SCIP_PARAM* targetparam, /**< target char parameter */
611 SCIP_SET* set, /**< global SCIP settings of target SCIP */
612 SCIP_MESSAGEHDLR* messagehdlr /**< message handler of target SCIP */
613 )
614{
615 char value;
616
617 assert(sourceparam != NULL);
618 assert(targetparam != NULL);
619
620 /* get value of source parameter and copy it to target parameter */
621 value = SCIPparamGetChar(sourceparam);
622 SCIP_CALL( SCIPparamSetChar(targetparam, set, messagehdlr, value, FALSE, TRUE) );
623
624 return SCIP_OKAY;
625}
626
627/** copies value of source string parameter to target string parameter*/
628static
630 SCIP_PARAM* sourceparam, /**< source string parameter */
631 SCIP_PARAM* targetparam, /**< target string parameter */
632 SCIP_SET* set, /**< global SCIP settings of target SCIP */
633 SCIP_MESSAGEHDLR* messagehdlr /**< message handler of target SCIP */
634 )
635{
636 char* value;
637
638 assert(sourceparam != NULL);
639 assert(targetparam != NULL);
640
641 /* get value of source parameter and copy it to target parameter */
642 value = SCIPparamGetString(sourceparam);
643 SCIP_CALL( SCIPparamSetString(targetparam, set, messagehdlr, value, FALSE, TRUE) );
644
645 return SCIP_OKAY;
646}
647
648/** returns type of parameter */
650 SCIP_PARAM* param /**< parameter */
651 )
652{
653 assert(param != NULL);
654
655 return param->paramtype;
656}
657
658/** returns name of parameter */
660 SCIP_PARAM* param /**< parameter */
661 )
662{
663 assert(param != NULL);
664
665 return param->name;
666}
667
668/** returns description of parameter */
670 SCIP_PARAM* param /**< parameter */
671 )
672{
673 assert(param != NULL);
674
675 return param->desc;
676}
677
678/** returns locally defined parameter specific data */
680 SCIP_PARAM* param /**< parameter */
681 )
682{
683 assert(param != NULL);
684
685 return param->paramdata;
686}
687
688/** returns whether parameter is advanced */
690 SCIP_PARAM* param /**< parameter */
691 )
692{
693 assert(param != NULL);
694
695 return param->isadvanced;
696}
697
698/** returns whether parameter is fixed */
700 SCIP_PARAM* param /**< parameter */
701 )
702{
703 assert(param != NULL);
704
705 return param->isfixed;
706}
707
708/** returns value of SCIP_Bool parameter */
710 SCIP_PARAM* param /**< parameter */
711 )
712{
713 assert(param != NULL);
714 assert(param->paramtype == SCIP_PARAMTYPE_BOOL);
715
716 if( param->data.boolparam.valueptr != NULL )
717 return *param->data.boolparam.valueptr;
718 else
719 return param->data.boolparam.curvalue;
720}
721
722/** returns default value of SCIP_Bool parameter */
724 SCIP_PARAM* param /**< parameter */
725 )
726{
727 assert(param != NULL);
728 assert(param->paramtype == SCIP_PARAMTYPE_BOOL);
729
730 return param->data.boolparam.defaultvalue;
731}
732
733/** returns value of int parameter */
735 SCIP_PARAM* param /**< parameter */
736 )
737{
738 assert(param != NULL);
739 assert(param->paramtype == SCIP_PARAMTYPE_INT);
740
741 if( param->data.intparam.valueptr != NULL )
742 return *param->data.intparam.valueptr;
743 else
744 return param->data.intparam.curvalue;
745}
746
747/** returns minimal value of int parameter */
749 SCIP_PARAM* param /**< parameter */
750 )
751{
752 assert(param != NULL);
753 assert(param->paramtype == SCIP_PARAMTYPE_INT);
754
755 return param->data.intparam.minvalue;
756}
757
758/** returns maximal value of int parameter */
760 SCIP_PARAM* param /**< parameter */
761 )
762{
763 assert(param != NULL);
764 assert(param->paramtype == SCIP_PARAMTYPE_INT);
765
766 return param->data.intparam.maxvalue;
767}
768
769/** returns default value of int parameter */
771 SCIP_PARAM* param /**< parameter */
772 )
773{
774 assert(param != NULL);
775 assert(param->paramtype == SCIP_PARAMTYPE_INT);
776
777 return param->data.intparam.defaultvalue;
778}
779
780/** returns value of SCIP_Longint parameter */
782 SCIP_PARAM* param /**< parameter */
783 )
784{
785 assert(param != NULL);
786 assert(param->paramtype == SCIP_PARAMTYPE_LONGINT);
787
788 if( param->data.longintparam.valueptr != NULL )
789 return *param->data.longintparam.valueptr;
790 else
791 return param->data.longintparam.curvalue;
792}
793
794/** returns minimal value of longint parameter */
796 SCIP_PARAM* param /**< parameter */
797 )
798{
799 assert(param != NULL);
800 assert(param->paramtype == SCIP_PARAMTYPE_LONGINT);
801
802 return param->data.longintparam.minvalue;
803}
804
805/** returns maximal value of longint parameter */
807 SCIP_PARAM* param /**< parameter */
808 )
809{
810 assert(param != NULL);
811 assert(param->paramtype == SCIP_PARAMTYPE_LONGINT);
812
813 return param->data.longintparam.maxvalue;
814}
815
816/** returns default value of SCIP_Longint parameter */
818 SCIP_PARAM* param /**< parameter */
819 )
820{
821 assert(param != NULL);
822 assert(param->paramtype == SCIP_PARAMTYPE_LONGINT);
823
824 return param->data.longintparam.defaultvalue;
825}
826
827/** returns value of SCIP_Real parameter */
829 SCIP_PARAM* param /**< parameter */
830 )
831{
832 assert(param != NULL);
833 assert(param->paramtype == SCIP_PARAMTYPE_REAL);
834
835 if( param->data.realparam.valueptr != NULL )
836 return *param->data.realparam.valueptr;
837 else
838 return param->data.realparam.curvalue;
839}
840
841/** returns minimal value of real parameter */
843 SCIP_PARAM* param /**< parameter */
844 )
845{
846 assert(param != NULL);
847 assert(param->paramtype == SCIP_PARAMTYPE_REAL);
848
849 return param->data.realparam.minvalue;
850}
851
852/** returns maximal value of real parameter */
854 SCIP_PARAM* param /**< parameter */
855 )
856{
857 assert(param != NULL);
858 assert(param->paramtype == SCIP_PARAMTYPE_REAL);
859
860 return param->data.realparam.maxvalue;
861}
862
863/** returns default value of SCIP_Real parameter */
865 SCIP_PARAM* param /**< parameter */
866 )
867{
868 assert(param != NULL);
869 assert(param->paramtype == SCIP_PARAMTYPE_REAL);
870
871 return param->data.realparam.defaultvalue;
872}
873
874/** returns value of char parameter */
876 SCIP_PARAM* param /**< parameter */
877 )
878{
879 assert(param != NULL);
880 assert(param->paramtype == SCIP_PARAMTYPE_CHAR);
881
882 if( param->data.charparam.valueptr != NULL )
883 return *param->data.charparam.valueptr;
884 else
885 return param->data.charparam.curvalue;
886}
887
888/** returns allowed values of char parameter, or NULL if everything is allowed */
890 SCIP_PARAM* param /**< parameter */
891 )
892{
893 assert(param != NULL);
894 assert(param->paramtype == SCIP_PARAMTYPE_CHAR);
895
896 return param->data.charparam.allowedvalues;
897}
898
899/** returns default value of char parameter */
901 SCIP_PARAM* param /**< parameter */
902 )
903{
904 assert(param != NULL);
905 assert(param->paramtype == SCIP_PARAMTYPE_CHAR);
906
907 return param->data.charparam.defaultvalue;
908}
909
910/** returns value of string parameter */
912 SCIP_PARAM* param /**< parameter */
913 )
914{
915 assert(param != NULL);
916 assert(param->paramtype == SCIP_PARAMTYPE_STRING);
917
918 if( param->data.stringparam.valueptr != NULL )
919 return *param->data.stringparam.valueptr;
920 else
921 return param->data.stringparam.curvalue;
922}
923
924/** returns default value of String parameter */
926 SCIP_PARAM* param /**< parameter */
927 )
928{
929 assert(param != NULL);
930 assert(param->paramtype == SCIP_PARAMTYPE_STRING);
931
932 return param->data.stringparam.defaultvalue;
933}
934
935/** returns whether the parameter is on its default setting */
937 SCIP_PARAM* param /**< parameter */
938 )
939{
940 assert(param != NULL);
941
942 switch( param->paramtype )
943 {
945 return (SCIPparamGetBool(param) == SCIPparamGetBoolDefault(param));
946
948 return (SCIPparamGetInt(param) == SCIPparamGetIntDefault(param));
949
951 return (SCIPparamGetLongint(param) == SCIPparamGetLongintDefault(param));
952
954 return EPSZ(SCIPparamGetReal(param) - SCIPparamGetRealDefault(param), 1e-16);
955
957 return (SCIPparamGetChar(param) == SCIPparamGetCharDefault(param));
958
960 return (strcmp(SCIPparamGetString(param), SCIPparamGetStringDefault(param)) == 0);
961
962 default:
963 SCIPerrorMessage("unknown parameter type\n");
964 SCIPABORT();
965 return FALSE; /*lint !e527*/
966 }
967}
968
969/** creates a parameter with name and description, does not set the type specific parameter values themselves */
970static
972 SCIP_PARAM** param, /**< pointer to the parameter */
973 BMS_BLKMEM* blkmem, /**< block memory */
974 const char* name, /**< name of the parameter */
975 const char* desc, /**< description of the parameter */
976 SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */
977 SCIP_PARAMDATA* paramdata, /**< locally defined parameter specific data */
978 SCIP_Bool isadvanced /**< is the parameter advanced? */
979 )
980{
981 assert(param != NULL);
982 assert(name != NULL);
983 assert(desc != NULL);
984
985 SCIP_ALLOC( BMSallocBlockMemory(blkmem, param) );
986
987 SCIP_ALLOC( BMSduplicateMemoryArray(&(*param)->name, name, strlen(name)+1) );
988 SCIP_ALLOC( BMSduplicateMemoryArray(&(*param)->desc, desc, strlen(desc)+1) );
989
990 (*param)->paramchgd = paramchgd;
991 (*param)->paramdata = paramdata;
992 (*param)->isadvanced = isadvanced;
993 (*param)->isfixed = FALSE;
994
995 return SCIP_OKAY;
996}
997
998/** creates a SCIP_Bool parameter, and sets its value to default */
999static
1001 SCIP_PARAM** param, /**< pointer to the parameter */
1002 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1003 BMS_BLKMEM* blkmem, /**< block memory */
1004 const char* name, /**< name of the parameter */
1005 const char* desc, /**< description of the parameter */
1006 SCIP_Bool* valueptr, /**< pointer to store the current parameter value, or NULL */
1007 SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */
1008 SCIP_Bool defaultvalue, /**< default value of the parameter */
1009 SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */
1010 SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */
1011 )
1012{
1013 assert(param != NULL);
1014 assert(name != NULL);
1015
1016 SCIP_CALL( paramCreate(param, blkmem, name, desc, paramchgd, paramdata, isadvanced) );
1017
1018 (*param)->paramtype = SCIP_PARAMTYPE_BOOL;
1019 (*param)->data.boolparam.valueptr = valueptr;
1020 (*param)->data.boolparam.defaultvalue = defaultvalue;
1021
1022 SCIP_CALL( SCIPparamSetBool(*param, NULL, messagehdlr, defaultvalue, TRUE, TRUE) );
1023
1024 return SCIP_OKAY;
1025}
1026
1027/** creates a int parameter, and sets its value to default */
1028static
1030 SCIP_PARAM** param, /**< pointer to the parameter */
1031 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1032 BMS_BLKMEM* blkmem, /**< block memory */
1033 const char* name, /**< name of the parameter */
1034 const char* desc, /**< description of the parameter */
1035 int* valueptr, /**< pointer to store the current parameter value, or NULL */
1036 SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */
1037 int defaultvalue, /**< default value of the parameter */
1038 int minvalue, /**< minimum value for parameter */
1039 int maxvalue, /**< maximum value for parameter */
1040 SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */
1041 SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */
1042 )
1043{
1044 assert(param != NULL);
1045 assert(name != NULL);
1046
1047 SCIP_CALL( paramCreate(param, blkmem, name, desc, paramchgd, paramdata, isadvanced) );
1048
1049 (*param)->paramtype = SCIP_PARAMTYPE_INT;
1050 (*param)->data.intparam.valueptr = valueptr;
1051 (*param)->data.intparam.defaultvalue = defaultvalue;
1052 (*param)->data.intparam.minvalue = minvalue;
1053 (*param)->data.intparam.maxvalue = maxvalue;
1054
1055 SCIP_CALL( SCIPparamSetInt(*param, NULL, messagehdlr, defaultvalue, TRUE, TRUE) );
1056
1057 return SCIP_OKAY;
1058}
1059
1060/** creates a SCIP_Longint parameter, and sets its value to default */
1061static
1063 SCIP_PARAM** param, /**< pointer to the parameter */
1064 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1065 BMS_BLKMEM* blkmem, /**< block memory */
1066 const char* name, /**< name of the parameter */
1067 const char* desc, /**< description of the parameter */
1068 SCIP_Longint* valueptr, /**< pointer to store the current parameter value, or NULL */
1069 SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */
1070 SCIP_Longint defaultvalue, /**< default value of the parameter */
1071 SCIP_Longint minvalue, /**< minimum value for parameter */
1072 SCIP_Longint maxvalue, /**< maximum value for parameter */
1073 SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */
1074 SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */
1075 )
1076{
1077 assert(param != NULL);
1078 assert(name != NULL);
1079
1080 SCIP_CALL( paramCreate(param, blkmem, name, desc, paramchgd, paramdata, isadvanced) );
1081
1082 (*param)->paramtype = SCIP_PARAMTYPE_LONGINT;
1083 (*param)->data.longintparam.valueptr = valueptr;
1084 (*param)->data.longintparam.defaultvalue = defaultvalue;
1085 (*param)->data.longintparam.minvalue = minvalue;
1086 (*param)->data.longintparam.maxvalue = maxvalue;
1087
1088 SCIP_CALL( SCIPparamSetLongint(*param, NULL, messagehdlr, defaultvalue, TRUE, TRUE) );
1089
1090 return SCIP_OKAY;
1091}
1092
1093/** creates a SCIP_Real parameter, and sets its value to default */
1094static
1096 SCIP_PARAM** param, /**< pointer to the parameter */
1097 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1098 BMS_BLKMEM* blkmem, /**< block memory */
1099 const char* name, /**< name of the parameter */
1100 const char* desc, /**< description of the parameter */
1101 SCIP_Real* valueptr, /**< pointer to store the current parameter value, or NULL */
1102 SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */
1103 SCIP_Real defaultvalue, /**< default value of the parameter */
1104 SCIP_Real minvalue, /**< minimum value for parameter */
1105 SCIP_Real maxvalue, /**< maximum value for parameter */
1106 SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */
1107 SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */
1108 )
1109{
1110 assert(param != NULL);
1111 assert(name != NULL);
1112
1113 SCIP_CALL( paramCreate(param, blkmem, name, desc, paramchgd, paramdata, isadvanced) );
1114
1115 (*param)->paramtype = SCIP_PARAMTYPE_REAL;
1116 (*param)->data.realparam.valueptr = valueptr;
1117 (*param)->data.realparam.defaultvalue = defaultvalue;
1118 (*param)->data.realparam.minvalue = minvalue;
1119 (*param)->data.realparam.maxvalue = maxvalue;
1120
1121 SCIP_CALL( SCIPparamSetReal(*param, NULL, messagehdlr, defaultvalue, TRUE, TRUE) );
1122
1123 return SCIP_OKAY;
1124}
1125
1126/** creates a char parameter, and sets its value to default */
1127static
1129 SCIP_PARAM** param, /**< pointer to the parameter */
1130 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1131 BMS_BLKMEM* blkmem, /**< block memory */
1132 const char* name, /**< name of the parameter */
1133 const char* desc, /**< description of the parameter */
1134 char* valueptr, /**< pointer to store the current parameter value, or NULL */
1135 SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */
1136 char defaultvalue, /**< default value of the parameter */
1137 const char* allowedvalues, /**< array with possible parameter values, or NULL if not restricted */
1138 SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */
1139 SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */
1140 )
1141{
1142 assert(param != NULL);
1143 assert(name != NULL);
1144
1145 SCIP_CALL( paramCreate(param, blkmem, name, desc, paramchgd, paramdata, isadvanced) );
1146
1147 (*param)->paramtype = SCIP_PARAMTYPE_CHAR;
1148 (*param)->data.charparam.valueptr = valueptr;
1149 (*param)->data.charparam.defaultvalue = defaultvalue;
1150 if( allowedvalues != NULL )
1151 {
1152 SCIP_ALLOC( BMSduplicateMemoryArray(&(*param)->data.charparam.allowedvalues, allowedvalues, strlen(allowedvalues)+1) );
1153 }
1154 else
1155 (*param)->data.charparam.allowedvalues = NULL;
1156
1157 SCIP_CALL( SCIPparamSetChar(*param, NULL, messagehdlr, defaultvalue, TRUE, TRUE) );
1158
1159 return SCIP_OKAY;
1160}
1161
1162/** creates a string parameter, and sets its value to default */
1163static
1165 SCIP_PARAM** param, /**< pointer to the parameter */
1166 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1167 BMS_BLKMEM* blkmem, /**< block memory */
1168 const char* name, /**< name of the parameter */
1169 const char* desc, /**< description of the parameter */
1170 char** valueptr, /**< pointer to store the current parameter value, or NULL */
1171 SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */
1172 const char* defaultvalue, /**< default value of the parameter */
1173 SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */
1174 SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */
1175 )
1176{
1177 assert(param != NULL);
1178 assert(name != NULL);
1179 assert(valueptr == NULL || *valueptr == NULL);
1180 assert(defaultvalue != NULL);
1181
1182 SCIP_CALL( paramCreate(param, blkmem, name, desc, paramchgd, paramdata, isadvanced) );
1183
1184 (*param)->paramtype = SCIP_PARAMTYPE_STRING;
1185 (*param)->data.stringparam.valueptr = valueptr;
1186 SCIP_ALLOC( BMSduplicateMemoryArray(&(*param)->data.stringparam.defaultvalue, defaultvalue, strlen(defaultvalue)+1) );
1187 (*param)->data.stringparam.curvalue = NULL;
1188
1189 SCIP_CALL( SCIPparamSetString(*param, NULL, messagehdlr, defaultvalue, TRUE, TRUE) );
1190
1191 return SCIP_OKAY;
1192}
1193
1194/** frees a single parameter */
1195static
1197 SCIP_PARAM** param, /**< pointer to the parameter */
1198 BMS_BLKMEM* blkmem /**< block memory */
1199 )
1200{
1201 assert(param != NULL);
1202 assert(*param != NULL);
1203
1204 switch( (*param)->paramtype )
1205 {
1207 case SCIP_PARAMTYPE_INT:
1210 break;
1212 BMSfreeMemoryArrayNull(&(*param)->data.charparam.allowedvalues);
1213 break;
1215 BMSfreeMemoryArray(&(*param)->data.stringparam.defaultvalue);
1216 if( (*param)->data.stringparam.valueptr == NULL )
1217 {
1218 BMSfreeMemoryArray(&(*param)->data.stringparam.curvalue);
1219 }
1220 else
1221 {
1222 BMSfreeMemoryArray((*param)->data.stringparam.valueptr);
1223 }
1224 break;
1225 default:
1226 SCIPerrorMessage("invalid parameter type\n");
1227 /* just continuing the function in this case seems save */
1228 SCIPABORT();
1229 }
1230
1231 BMSfreeMemoryArray(&(*param)->name);
1232 BMSfreeMemoryArray(&(*param)->desc);
1233 BMSfreeBlockMemory(blkmem, param);
1234}
1235
1236/** sets SCIP_Bool parameter according to the value of the given string */
1237static
1239 SCIP_PARAM* param, /**< parameter */
1240 SCIP_SET* set, /**< global SCIP settings */
1241 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1242 char* valuestr /**< value in string format (may be modified during parse) */
1243 )
1244{
1245 assert(param != NULL);
1246 assert(param->paramtype == SCIP_PARAMTYPE_BOOL);
1247 assert(set != NULL);
1248 assert(valuestr != NULL);
1249
1250 if( SCIPstrcasecmp(valuestr, "TRUE") == 0 )
1251 {
1252 SCIP_CALL( SCIPparamSetBool(param, set, messagehdlr, TRUE, FALSE, TRUE) );
1253 }
1254 else if( SCIPstrcasecmp(valuestr, "FALSE") == 0 )
1255 {
1256 SCIP_CALL( SCIPparamSetBool(param, set, messagehdlr, FALSE, FALSE, TRUE) );
1257 }
1258 else
1259 {
1260 SCIPerrorMessage("invalid parameter value <%s> for SCIP_Bool parameter <%s>\n", valuestr, param->name);
1261 return SCIP_READERROR;
1262 }
1263
1264 return SCIP_OKAY;
1265}
1266
1267/** sets int parameter according to the value of the given string */
1268static
1270 SCIP_PARAM* param, /**< parameter */
1271 SCIP_SET* set, /**< global SCIP settings */
1272 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1273 char* valuestr /**< value in string format (may be modified during parse) */
1274 )
1275{
1276 int value;
1277
1278 assert(param != NULL);
1279 assert(param->paramtype == SCIP_PARAMTYPE_INT);
1280 assert(set != NULL);
1281 assert(valuestr != NULL);
1282
1283 /* coverity[secure_coding] */
1284 if( sscanf(valuestr, "%d", &value) == 1 )
1285 {
1286 SCIP_CALL( SCIPparamSetInt(param, set, messagehdlr, value, FALSE, TRUE) );
1287 }
1288 else
1289 {
1290 SCIPerrorMessage("invalid parameter value <%s> for int parameter <%s>\n", valuestr, param->name);
1291 return SCIP_READERROR;
1292 }
1293
1294 return SCIP_OKAY;
1295}
1296
1297/** sets SCIP_Longint parameter according to the value of the given string */
1298static
1300 SCIP_PARAM* param, /**< parameter */
1301 SCIP_SET* set, /**< global SCIP settings */
1302 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1303 char* valuestr /**< value in string format (may be modified during parse) */
1304 )
1305{
1306 SCIP_Longint value;
1307
1308 assert(param != NULL);
1309 assert(param->paramtype == SCIP_PARAMTYPE_LONGINT);
1310 assert(set != NULL);
1311 assert(valuestr != NULL);
1312
1313 /* coverity[secure_coding] */
1314 if( sscanf(valuestr, "%" SCIP_LONGINT_FORMAT, &value) == 1 )
1315 {
1316 SCIP_CALL( SCIPparamSetLongint(param, set, messagehdlr, value, FALSE, TRUE) );
1317 }
1318 else
1319 {
1320 SCIPerrorMessage("invalid parameter value <%s> for SCIP_Longint parameter <%s>\n", valuestr, param->name);
1321 return SCIP_READERROR;
1322 }
1323
1324 return SCIP_OKAY;
1325}
1326
1327/** sets SCIP_Real parameter according to the value of the given string */
1328static
1330 SCIP_PARAM* param, /**< parameter */
1331 SCIP_SET* set, /**< global SCIP settings */
1332 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1333 char* valuestr /**< value in string format (may be modified during parse) */
1334 )
1335{
1336 SCIP_Real value;
1337
1338 assert(param != NULL);
1339 assert(param->paramtype == SCIP_PARAMTYPE_REAL);
1340 assert(set != NULL);
1341 assert(valuestr != NULL);
1342
1343 /* coverity[secure_coding] */
1344 if( sscanf(valuestr, "%" SCIP_REAL_FORMAT, &value) == 1 )
1345 {
1346 SCIP_CALL( SCIPparamSetReal(param, set, messagehdlr, value, FALSE, TRUE) );
1347 }
1348 else
1349 {
1350 SCIPerrorMessage("invalid parameter value <%s> for SCIP_Real parameter <%s>\n", valuestr, param->name);
1351 return SCIP_READERROR;
1352 }
1353
1354 return SCIP_OKAY;
1355}
1356
1357/** sets Char parameter according to the value of the given string */
1358static
1360 SCIP_PARAM* param, /**< parameter */
1361 SCIP_SET* set, /**< global SCIP settings */
1362 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1363 char* valuestr /**< value in string format (may be modified during parse) */
1364 )
1365{
1366 char value;
1367
1368 assert(param != NULL);
1369 assert(param->paramtype == SCIP_PARAMTYPE_CHAR);
1370 assert(set != NULL);
1371 assert(valuestr != NULL);
1372
1373 /* coverity[secure_coding] */
1374 if( sscanf(valuestr, "%c", &value) == 1 )
1375 {
1376 SCIP_CALL( SCIPparamSetChar(param, set, messagehdlr, value, FALSE, TRUE) );
1377 }
1378 else
1379 {
1380 SCIPerrorMessage("invalid parameter value <%s> for char parameter <%s>\n", valuestr, param->name);
1381 return SCIP_READERROR;
1382 }
1383
1384 return SCIP_OKAY;
1385}
1386
1387/** sets string parameter according to the value of the given string */
1388static
1390 SCIP_PARAM* param, /**< parameter */
1391 SCIP_SET* set, /**< global SCIP settings */
1392 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1393 char* valuestr /**< value in string format (may be modified during parse) */
1394 )
1395{
1396 unsigned int len;
1397
1398 assert(param != NULL);
1399 assert(param->paramtype == SCIP_PARAMTYPE_STRING);
1400 assert(set != NULL);
1401 assert(valuestr != NULL);
1402
1403 /* check for quotes */
1404 len = (unsigned int) strlen(valuestr);
1405 if( len <= 1 || valuestr[0] != '"' || valuestr[len-1] != '"' )
1406 {
1407 SCIPerrorMessage("invalid parameter value <%s> for string parameter <%s> (string has to be in double quotes)\n",
1408 valuestr, param->name);
1409 return SCIP_READERROR;
1410 }
1411
1412 /* remove the quotes */
1413 valuestr[len-1] = '\0';
1414 valuestr++;
1415 SCIP_CALL( SCIPparamSetString(param, set, messagehdlr, valuestr, FALSE, TRUE) );
1416
1417 return SCIP_OKAY;
1418}
1419
1420
1421/*
1422 * Parameter set methods
1423 */
1424
1425/** creates parameter set */
1427 SCIP_PARAMSET** paramset, /**< pointer to store the parameter set */
1428 BMS_BLKMEM* blkmem /**< block memory */
1429 )
1430{
1431 assert(paramset != NULL);
1432
1433 SCIP_ALLOC( BMSallocMemory(paramset) );
1434
1435 SCIP_CALL( SCIPhashtableCreate(&(*paramset)->hashtable, blkmem, SCIP_HASHSIZE_PARAMS,
1436 hashGetKeyParam, SCIPhashKeyEqString, SCIPhashKeyValString, NULL) );
1437
1438 (*paramset)->params = NULL;
1439 (*paramset)->nparams = 0;
1440 (*paramset)->paramssize = 0;
1441
1442 return SCIP_OKAY;
1443}
1444
1445/** frees parameter set */
1447 SCIP_PARAMSET** paramset, /**< pointer to the parameter set */
1448 BMS_BLKMEM* blkmem /**< block memory */
1449 )
1450{
1451 SCIP_PARAM* objectivestop;
1452 int i;
1453
1454 assert(paramset != NULL);
1455 assert(*paramset != NULL);
1456 assert((*paramset)->paramssize == 0 || (*paramset)->params != NULL);
1457 assert((*paramset)->paramssize >= (*paramset)->nparams);
1458
1459 /* free deprecated objectivestop */
1460 objectivestop = SCIPparamsetGetParam(*paramset, "limits/objectivestop");
1461 paramFree(&objectivestop, blkmem);
1462
1463 for( i = (*paramset)->nparams - 1; i >= 0; --i )
1464 {
1465 paramFree(&(*paramset)->params[i], blkmem);
1466 }
1467
1468 SCIPhashtableFree(&(*paramset)->hashtable);
1469
1470 BMSfreeMemoryArrayNull(&(*paramset)->params);
1471 BMSfreeMemory(paramset);
1472}
1473
1474/** adds parameter to the parameter set */
1475static
1477 SCIP_PARAMSET* paramset, /**< parameter set */
1478 SCIP_PARAM* param /**< parameter to add */
1479 )
1480{
1481 assert(paramset != NULL);
1482 assert(param != NULL);
1483
1484 /* insert the parameter name to the hash table */
1485 SCIP_CALL( SCIPhashtableSafeInsert(paramset->hashtable, (void*)param) );
1486
1487 /* ensure, that there is enough space in the params array */
1488 if( paramset->nparams >= paramset->paramssize )
1489 {
1490 paramset->paramssize *= 2;
1491 paramset->paramssize = MAX(paramset->paramssize, paramset->nparams+1);
1492 SCIP_ALLOC( BMSreallocMemoryArray(&paramset->params, paramset->paramssize) );
1493 }
1494 assert(paramset->nparams < paramset->paramssize);
1495
1496 /* insert parameter in the params array */
1497 paramset->params[paramset->nparams] = param;
1498 paramset->nparams++;
1499
1500 return SCIP_OKAY;
1501}
1502
1503/** creates a SCIP_Bool parameter, sets it to its default value, and adds it to the parameter set */
1505 SCIP_PARAMSET* paramset, /**< parameter set */
1506 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1507 BMS_BLKMEM* blkmem, /**< block memory */
1508 const char* name, /**< name of the parameter */
1509 const char* desc, /**< description of the parameter */
1510 SCIP_Bool* valueptr, /**< pointer to store the current parameter value, or NULL */
1511 SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */
1512 SCIP_Bool defaultvalue, /**< default value of the parameter */
1513 SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */
1514 SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */
1515 )
1516{
1517 SCIP_PARAM* param;
1518
1519 assert(paramset != NULL);
1520
1521 /* create the parameter */
1522 SCIP_CALL( paramCreateBool(&param, messagehdlr, blkmem, name, desc, valueptr, isadvanced, defaultvalue, paramchgd, paramdata) );
1523
1524 /* add parameter to the parameter set */
1525 SCIP_CALL( paramsetAdd(paramset, param) );
1526
1527 return SCIP_OKAY;
1528}
1529
1530/** creates a int parameter, sets it to its default value, and adds it to the parameter set */
1532 SCIP_PARAMSET* paramset, /**< parameter set */
1533 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1534 BMS_BLKMEM* blkmem, /**< block memory */
1535 const char* name, /**< name of the parameter */
1536 const char* desc, /**< description of the parameter */
1537 int* valueptr, /**< pointer to store the current parameter value, or NULL */
1538 SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */
1539 int defaultvalue, /**< default value of the parameter */
1540 int minvalue, /**< minimum value for parameter */
1541 int maxvalue, /**< maximum value for parameter */
1542 SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */
1543 SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */
1544 )
1545{
1546 SCIP_PARAM* param;
1547
1548 assert(paramset != NULL);
1549
1550 /* create the parameter */
1551 SCIP_CALL( paramCreateInt(&param, messagehdlr, blkmem, name, desc, valueptr, isadvanced, defaultvalue, minvalue, maxvalue,
1552 paramchgd, paramdata) );
1553
1554 /* add parameter to the parameter set */
1555 SCIP_CALL( paramsetAdd(paramset, param) );
1556
1557 return SCIP_OKAY;
1558}
1559
1560/** creates a SCIP_Longint parameter, sets it to its default value, and adds it to the parameter set */
1562 SCIP_PARAMSET* paramset, /**< parameter set */
1563 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1564 BMS_BLKMEM* blkmem, /**< block memory */
1565 const char* name, /**< name of the parameter */
1566 const char* desc, /**< description of the parameter */
1567 SCIP_Longint* valueptr, /**< pointer to store the current parameter value, or NULL */
1568 SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */
1569 SCIP_Longint defaultvalue, /**< default value of the parameter */
1570 SCIP_Longint minvalue, /**< minimum value for parameter */
1571 SCIP_Longint maxvalue, /**< maximum value for parameter */
1572 SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */
1573 SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */
1574 )
1575{
1576 SCIP_PARAM* param;
1577
1578 assert(paramset != NULL);
1579
1580 /* create the parameter */
1581 SCIP_CALL( paramCreateLongint(&param, messagehdlr, blkmem, name, desc, valueptr, isadvanced, defaultvalue, minvalue, maxvalue,
1582 paramchgd, paramdata) );
1583
1584 /* add parameter to the parameter set */
1585 SCIP_CALL( paramsetAdd(paramset, param) );
1586
1587 return SCIP_OKAY;
1588}
1589
1590/** creates a SCIP_Real parameter, sets it to its default value, and adds it to the parameter set */
1592 SCIP_PARAMSET* paramset, /**< parameter set */
1593 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1594 BMS_BLKMEM* blkmem, /**< block memory */
1595 const char* name, /**< name of the parameter */
1596 const char* desc, /**< description of the parameter */
1597 SCIP_Real* valueptr, /**< pointer to store the current parameter value, or NULL */
1598 SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */
1599 SCIP_Real defaultvalue, /**< default value of the parameter */
1600 SCIP_Real minvalue, /**< minimum value for parameter */
1601 SCIP_Real maxvalue, /**< maximum value for parameter */
1602 SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */
1603 SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */
1604 )
1605{
1606 SCIP_PARAM* param;
1607
1608 assert(paramset != NULL);
1609
1610 /* create the parameter */
1611 SCIP_CALL( paramCreateReal(&param, messagehdlr, blkmem, name, desc, valueptr, isadvanced, defaultvalue, minvalue, maxvalue,
1612 paramchgd, paramdata) );
1613
1614 /* add parameter to the parameter set */
1615 SCIP_CALL( paramsetAdd(paramset, param) );
1616
1617 return SCIP_OKAY;
1618}
1619
1620/** creates a char parameter, sets it to its default value, and adds it to the parameter set */
1622 SCIP_PARAMSET* paramset, /**< parameter set */
1623 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1624 BMS_BLKMEM* blkmem, /**< block memory */
1625 const char* name, /**< name of the parameter */
1626 const char* desc, /**< description of the parameter */
1627 char* valueptr, /**< pointer to store the current parameter value, or NULL */
1628 SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */
1629 char defaultvalue, /**< default value of the parameter */
1630 const char* allowedvalues, /**< array with possible parameter values, or NULL if not restricted */
1631 SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */
1632 SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */
1633 )
1634{
1635 SCIP_PARAM* param;
1636
1637 assert(paramset != NULL);
1638
1639 /* create the parameter */
1640 SCIP_CALL( paramCreateChar(&param, messagehdlr, blkmem, name, desc, valueptr, isadvanced, defaultvalue, allowedvalues,
1641 paramchgd, paramdata) );
1642
1643 /* add parameter to the parameter set */
1644 SCIP_CALL( paramsetAdd(paramset, param) );
1645
1646 return SCIP_OKAY;
1647}
1648
1649/** creates a string parameter, sets it to its default value, and adds it to the parameter set */
1651 SCIP_PARAMSET* paramset, /**< parameter set */
1652 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1653 BMS_BLKMEM* blkmem, /**< block memory */
1654 const char* name, /**< name of the parameter */
1655 const char* desc, /**< description of the parameter */
1656 char** valueptr, /**< pointer to store the current parameter value, or NULL */
1657 SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */
1658 const char* defaultvalue, /**< default value of the parameter */
1659 SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */
1660 SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */
1661 )
1662{
1663 SCIP_PARAM* param;
1664
1665 assert(paramset != NULL);
1666
1667 /* create the parameter */
1668 SCIP_CALL( paramCreateString(&param, messagehdlr, blkmem, name, desc, valueptr, isadvanced, defaultvalue, paramchgd, paramdata) );
1669
1670 /* add parameter to the parameter set */
1671 SCIP_CALL( paramsetAdd(paramset, param) );
1672
1673 return SCIP_OKAY;
1674}
1675
1676/** returns the name of the given parameter type */
1677static
1679 SCIP_PARAMTYPE paramtype /**< type of parameter */
1680 )
1681{
1682 static const char* paramtypename[] = {
1683 "Bool", /* SCIP_PARAMTYPE_BOOL = 0 */
1684 "int", /* SCIP_PARAMTYPE_INT = 1 */
1685 "Longint", /* SCIP_PARAMTYPE_LONGINT = 2 */
1686 "Real", /* SCIP_PARAMTYPE_REAL = 3 */
1687 "char", /* SCIP_PARAMTYPE_CHAR = 4 */
1688 "string" /* SCIP_PARAMTYPE_STRING = 5 */
1689 };
1690
1691 return paramtypename[(int)paramtype];
1692}
1693
1694/** returns whether an existing parameter is fixed */
1696 SCIP_PARAMSET* paramset, /**< parameter set */
1697 const char* name /**< name of the parameter */
1698 )
1699{
1700 SCIP_PARAM* param;
1701
1702 assert(paramset != NULL);
1703
1704 /* retrieve parameter from hash table */
1705 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
1706 if( param == NULL )
1707 {
1708 SCIPerrorMessage("parameter <%s> unknown\n", name);
1709 SCIPABORT();
1710 return FALSE; /*lint !e527*/
1711 }
1712
1713 return SCIPparamIsFixed(param);
1714}
1715
1716/** returns the pointer to an existing SCIP parameter */
1718 SCIP_PARAMSET* paramset, /**< parameter set */
1719 const char* name /**< name of the parameter */
1720 )
1721{
1722 assert(paramset != NULL);
1723
1724 /* retrieve parameter from hash table and return it */
1725 return (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
1726}
1727
1728/** gets the value of an existing SCIP_Bool parameter */
1730 SCIP_PARAMSET* paramset, /**< parameter set */
1731 const char* name, /**< name of the parameter */
1732 SCIP_Bool* value /**< pointer to store the parameter */
1733 )
1734{
1735 SCIP_PARAM* param;
1736
1737 assert(paramset != NULL);
1738 assert(value != NULL);
1739
1740 /* retrieve parameter from hash table */
1741 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
1742 if( param == NULL )
1743 {
1744 SCIPerrorMessage("parameter <%s> unknown\n", name);
1745 return SCIP_PARAMETERUNKNOWN;
1746 }
1747 if( param->paramtype != SCIP_PARAMTYPE_BOOL )
1748 {
1749 SCIPerrorMessage("wrong parameter type - parameter <%s> has type <%s> instead of <%s>\n",
1752 }
1753
1754 /* get the parameter's current value */
1755 *value = SCIPparamGetBool(param);
1756
1757 return SCIP_OKAY;
1758}
1759
1760/** gets the value of an existing int parameter */
1762 SCIP_PARAMSET* paramset, /**< parameter set */
1763 const char* name, /**< name of the parameter */
1764 int* value /**< pointer to store the parameter */
1765 )
1766{
1767 SCIP_PARAM* param;
1768
1769 assert(paramset != NULL);
1770 assert(value != NULL);
1771
1772 /* retrieve parameter from hash table */
1773 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
1774 if( param == NULL )
1775 {
1776 SCIPerrorMessage("parameter <%s> unknown\n", name);
1777 return SCIP_PARAMETERUNKNOWN;
1778 }
1779 if( param->paramtype != SCIP_PARAMTYPE_INT )
1780 {
1781 SCIPerrorMessage("wrong parameter type - parameter <%s> has type <%s> instead of <%s>\n",
1784 }
1785
1786 /* get the parameter's current value */
1787 *value = SCIPparamGetInt(param);
1788
1789 return SCIP_OKAY;
1790}
1791
1792/** gets the value of an existing SCIP_Longint parameter */
1794 SCIP_PARAMSET* paramset, /**< parameter set */
1795 const char* name, /**< name of the parameter */
1796 SCIP_Longint* value /**< pointer to store the parameter */
1797 )
1798{
1799 SCIP_PARAM* param;
1800
1801 assert(paramset != NULL);
1802 assert(value != NULL);
1803
1804 /* retrieve parameter from hash table */
1805 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
1806 if( param == NULL )
1807 {
1808 SCIPerrorMessage("parameter <%s> unknown\n", name);
1809 return SCIP_PARAMETERUNKNOWN;
1810 }
1811 if( param->paramtype != SCIP_PARAMTYPE_LONGINT )
1812 {
1813 SCIPerrorMessage("wrong parameter type - parameter <%s> has type <%s> instead of <%s>\n",
1816 }
1817
1818 /* get the parameter's current value */
1819 *value = SCIPparamGetLongint(param);
1820
1821 return SCIP_OKAY;
1822}
1823
1824/** gets the value of an existing SCIP_Real parameter */
1826 SCIP_PARAMSET* paramset, /**< parameter set */
1827 const char* name, /**< name of the parameter */
1828 SCIP_Real* value /**< pointer to store the parameter */
1829 )
1830{
1831 SCIP_PARAM* param;
1832
1833 assert(paramset != NULL);
1834 assert(value != NULL);
1835
1836 /* retrieve parameter from hash table */
1837 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
1838 if( param == NULL )
1839 {
1840 SCIPerrorMessage("parameter <%s> unknown\n", name);
1841 return SCIP_PARAMETERUNKNOWN;
1842 }
1843 if( param->paramtype != SCIP_PARAMTYPE_REAL )
1844 {
1845 SCIPerrorMessage("wrong parameter type - parameter <%s> has type <%s> instead of <%s>\n",
1848 }
1849
1850 /* get the parameter's current value */
1851 *value = SCIPparamGetReal(param);
1852
1853 return SCIP_OKAY;
1854}
1855
1856/** gets the value of an existing char parameter */
1858 SCIP_PARAMSET* paramset, /**< parameter set */
1859 const char* name, /**< name of the parameter */
1860 char* value /**< pointer to store the parameter */
1861 )
1862{
1863 SCIP_PARAM* param;
1864
1865 assert(paramset != NULL);
1866 assert(value != NULL);
1867
1868 /* retrieve parameter from hash table */
1869 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
1870 if( param == NULL )
1871 {
1872 SCIPerrorMessage("parameter <%s> unknown\n", name);
1873 return SCIP_PARAMETERUNKNOWN;
1874 }
1875 if( param->paramtype != SCIP_PARAMTYPE_CHAR )
1876 {
1877 SCIPerrorMessage("wrong parameter type - parameter <%s> has type <%s> instead of <%s>\n",
1880 }
1881
1882 /* get the parameter's current value */
1883 *value = SCIPparamGetChar(param);
1884
1885 return SCIP_OKAY;
1886}
1887
1888/** gets the value of an existing string parameter */
1890 SCIP_PARAMSET* paramset, /**< parameter set */
1891 const char* name, /**< name of the parameter */
1892 char** value /**< pointer to store the parameter */
1893 )
1894{
1895 SCIP_PARAM* param;
1896
1897 assert(paramset != NULL);
1898 assert(value != NULL);
1899
1900 /* retrieve parameter from hash table */
1901 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
1902 if( param == NULL )
1903 {
1904 SCIPerrorMessage("parameter <%s> unknown\n", name);
1905 return SCIP_PARAMETERUNKNOWN;
1906 }
1907 if( param->paramtype != SCIP_PARAMTYPE_STRING )
1908 {
1909 SCIPerrorMessage("wrong parameter type - parameter <%s> has type <%s> instead of <%s>\n",
1912 }
1913
1914 /* get the parameter's current value */
1915 *value = SCIPparamGetString(param);
1916
1917 return SCIP_OKAY;
1918}
1919
1920/** changes the fixing status of an existing parameter */
1922 SCIP_PARAMSET* paramset, /**< parameter set */
1923 const char* name, /**< name of the parameter */
1924 SCIP_Bool fixed /**< new fixing status of the parameter */
1925 )
1926{
1927 SCIP_PARAM* param;
1928
1929 assert(paramset != NULL);
1930
1931 /* retrieve parameter from hash table */
1932 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
1933 if( param == NULL )
1934 {
1935 SCIPerrorMessage("parameter <%s> unknown\n", name);
1936 return SCIP_PARAMETERUNKNOWN;
1937 }
1938
1939 SCIPparamSetFixed(param, fixed);
1940
1941 return SCIP_OKAY;
1942}
1943
1944/** changes the value of an existing SCIP_Bool parameter */
1946 SCIP_PARAMSET* paramset, /**< parameter set */
1947 SCIP_SET* set, /**< global SCIP settings */
1948 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1949 const char* name, /**< name of the parameter */
1950 SCIP_Bool value /**< new value of the parameter */
1951 )
1952{
1953 SCIP_PARAM* param;
1954
1955 assert(paramset != NULL);
1956 assert(set != NULL);
1957
1958 /* retrieve parameter from hash table */
1959 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
1960 if( param == NULL )
1961 {
1962 SCIPerrorMessage("parameter <%s> unknown\n", name);
1963 return SCIP_PARAMETERUNKNOWN;
1964 }
1965 if( param->paramtype != SCIP_PARAMTYPE_BOOL )
1966 {
1967 SCIPerrorMessage("wrong parameter type - parameter <%s> has type <%s> instead of <%s>\n",
1970 }
1971
1972 /* set the parameter's current value */
1973 SCIP_CALL( SCIPparamSetBool(param, set, messagehdlr, value, FALSE, TRUE) );
1974
1975 return SCIP_OKAY;
1976}
1977
1978/** changes the value of an existing int parameter */
1980 SCIP_PARAMSET* paramset, /**< parameter set */
1981 SCIP_SET* set, /**< global SCIP settings */
1982 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1983 const char* name, /**< name of the parameter */
1984 int value /**< new value of the parameter */
1985 )
1986{
1987 SCIP_PARAM* param;
1988
1989 assert(paramset != NULL);
1990 assert(set != NULL);
1991
1992 /* retrieve parameter from hash table */
1993 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
1994 if( param == NULL )
1995 {
1996 SCIPerrorMessage("parameter <%s> unknown\n", name);
1997 return SCIP_PARAMETERUNKNOWN;
1998 }
1999 if( param->paramtype != SCIP_PARAMTYPE_INT )
2000 {
2001 SCIPerrorMessage("wrong parameter type - parameter <%s> has type <%s> instead of <%s>\n",
2004 }
2005
2006 /* set the parameter's current value */
2007 SCIP_CALL( SCIPparamSetInt(param, set, messagehdlr, value, FALSE, TRUE) );
2008
2009 return SCIP_OKAY;
2010}
2011
2012/** changes the value of an existing SCIP_Longint parameter */
2014 SCIP_PARAMSET* paramset, /**< parameter set */
2015 SCIP_SET* set, /**< global SCIP settings */
2016 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
2017 const char* name, /**< name of the parameter */
2018 SCIP_Longint value /**< new value of the parameter */
2019 )
2020{
2021 SCIP_PARAM* param;
2022
2023 assert(paramset != NULL);
2024 assert(set != NULL);
2025
2026 /* retrieve parameter from hash table */
2027 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
2028 if( param == NULL )
2029 {
2030 SCIPerrorMessage("parameter <%s> unknown\n", name);
2031 return SCIP_PARAMETERUNKNOWN;
2032 }
2033 if( param->paramtype != SCIP_PARAMTYPE_LONGINT )
2034 {
2035 SCIPerrorMessage("wrong parameter type - parameter <%s> has type <%s> instead of <%s>\n",
2038 }
2039
2040 /* set the parameter's current value */
2041 SCIP_CALL( SCIPparamSetLongint(param, set, messagehdlr, value, FALSE, TRUE) );
2042
2043 return SCIP_OKAY;
2044}
2045
2046/** changes the value of an existing SCIP_Real parameter */
2048 SCIP_PARAMSET* paramset, /**< parameter set */
2049 SCIP_SET* set, /**< global SCIP settings */
2050 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
2051 const char* name, /**< name of the parameter */
2052 SCIP_Real value /**< new value of the parameter */
2053 )
2054{
2055 SCIP_PARAM* param;
2056
2057 assert(paramset != NULL);
2058 assert(set != NULL);
2059
2060 /* retrieve parameter from hash table */
2061 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
2062 if( param == NULL )
2063 {
2064 SCIPerrorMessage("parameter <%s> unknown\n", name);
2065 return SCIP_PARAMETERUNKNOWN;
2066 }
2067 if( param->paramtype != SCIP_PARAMTYPE_REAL )
2068 {
2069 SCIPerrorMessage("wrong parameter type - parameter <%s> has type <%s> instead of <%s>\n",
2072 }
2073
2074 /* set the parameter's current value */
2075 SCIP_CALL( SCIPparamSetReal(param, set, messagehdlr, value, FALSE, TRUE) );
2076
2077 return SCIP_OKAY;
2078}
2079
2080/** changes the value of an existing char parameter */
2082 SCIP_PARAMSET* paramset, /**< parameter set */
2083 SCIP_SET* set, /**< global SCIP settings */
2084 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
2085 const char* name, /**< name of the parameter */
2086 char value /**< new value of the parameter */
2087 )
2088{
2089 SCIP_PARAM* param;
2090
2091 assert(paramset != NULL);
2092 assert(set != NULL);
2093
2094 /* retrieve parameter from hash table */
2095 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
2096 if( param == NULL )
2097 {
2098 SCIPerrorMessage("parameter <%s> unknown\n", name);
2099 return SCIP_PARAMETERUNKNOWN;
2100 }
2101 if( param->paramtype != SCIP_PARAMTYPE_CHAR )
2102 {
2103 SCIPerrorMessage("wrong parameter type - parameter <%s> has type <%s> instead of <%s>\n",
2106 }
2107
2108 /* set the parameter's current value */
2109 SCIP_CALL( SCIPparamSetChar(param, set, messagehdlr, value, FALSE, TRUE) );
2110
2111 return SCIP_OKAY;
2112}
2113
2114/** changes the value of an existing string parameter */
2116 SCIP_PARAMSET* paramset, /**< parameter set */
2117 SCIP_SET* set, /**< global SCIP settings */
2118 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
2119 const char* name, /**< name of the parameter */
2120 const char* value /**< new value of the parameter */
2121 )
2122{
2123 SCIP_PARAM* param;
2124
2125 assert(paramset != NULL);
2126 assert(set != NULL);
2127
2128 /* retrieve parameter from hash table */
2129 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
2130 if( param == NULL )
2131 {
2132 SCIPerrorMessage("parameter <%s> unknown\n", name);
2133 return SCIP_PARAMETERUNKNOWN;
2134 }
2135 if( param->paramtype != SCIP_PARAMTYPE_STRING )
2136 {
2137 SCIPerrorMessage("wrong parameter type - parameter <%s> has type <%s> instead of <%s>\n",
2140 }
2141
2142 /* set the parameter's current value */
2143 SCIP_CALL( SCIPparamSetString(param, set, messagehdlr, value, FALSE, TRUE) );
2144
2145 return SCIP_OKAY;
2146}
2147
2148/** changes the value of an existing parameter */
2150 SCIP_PARAMSET* paramset, /**< parameter set */
2151 SCIP_SET* set, /**< global SCIP settings */
2152 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
2153 const char* name, /**< name of the parameter */
2154 const char* value, /**< new value of the parameter as string */
2155 SCIP_Bool fix /**< whether to fix parameter */
2156 )
2157{
2158 SCIP_PARAM* param;
2159
2160 assert(paramset != NULL);
2161 assert(paramset->hashtable != NULL);
2162 assert(name != NULL);
2163 assert(value != NULL);
2164
2165 /* retrieve parameter from hash table */
2166 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
2167 if( param == NULL )
2168 {
2169 SCIPmessagePrintWarning(messagehdlr, "unknown parameter <%s>\n", name);
2170 return SCIP_OKAY;
2171 }
2172
2173 SCIPparamSetFixed(param, FALSE);
2174
2175 /* set parameter's value */
2176 switch( param->paramtype )
2177 {
2179 SCIP_CALL( paramParseBool(param, set, messagehdlr, (char*)value) );
2180 break;
2181 case SCIP_PARAMTYPE_INT:
2182 SCIP_CALL( paramParseInt(param, set, messagehdlr, (char*)value) );
2183 break;
2185 SCIP_CALL( paramParseLongint(param, set, messagehdlr, (char*)value) );
2186 break;
2188 SCIP_CALL( paramParseReal(param, set, messagehdlr, (char*)value) );
2189 break;
2191 SCIP_CALL( paramParseChar(param, set, messagehdlr, (char*)value) );
2192 break;
2194 SCIP_CALL( paramParseString(param, set, messagehdlr, (char*)value) );
2195 break;
2196 default:
2197 SCIPerrorMessage("unknown parameter type\n");
2198 return SCIP_INVALIDDATA;
2199 }
2200
2201 if( fix )
2202 SCIPparamSetFixed(param, TRUE);
2203
2204 return SCIP_OKAY;
2205}
2206
2207/** changes the default value of an existing SCIP_Bool parameter */
2209 SCIP_PARAMSET* paramset, /**< parameter set */
2210 const char* name, /**< name of the parameter */
2211 SCIP_Bool defaultvalue /**< new default value of the parameter */
2212 )
2213{
2214 SCIP_PARAM* param;
2215
2216 assert(paramset != NULL);
2217
2218 /* retrieve parameter from hash table */
2219 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
2220 if( param == NULL )
2221 {
2222 SCIPerrorMessage("parameter <%s> unknown\n", name);
2223 return SCIP_PARAMETERUNKNOWN;
2224 }
2225 if( param->paramtype != SCIP_PARAMTYPE_BOOL )
2226 {
2227 SCIPerrorMessage("wrong parameter type - parameter <%s> has type <%s> instead of <%s>\n",
2230 }
2231
2232 /* set the parameter's default value */
2233 SCIPparamSetDefaultBool(param, defaultvalue);
2234
2235 return SCIP_OKAY;
2236}
2237
2238/** changes the default value of an existing int parameter */
2240 SCIP_PARAMSET* paramset, /**< parameter set */
2241 const char* name, /**< name of the parameter */
2242 int defaultvalue /**< new default value of the parameter */
2243 )
2244{
2245 SCIP_PARAM* param;
2246
2247 assert(paramset != NULL);
2248
2249 /* retrieve parameter from hash table */
2250 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
2251 if( param == NULL )
2252 {
2253 SCIPerrorMessage("parameter <%s> unknown\n", name);
2254 return SCIP_PARAMETERUNKNOWN;
2255 }
2256 if( param->paramtype != SCIP_PARAMTYPE_INT )
2257 {
2258 SCIPerrorMessage("wrong parameter type - parameter <%s> has type <%s> instead of <%s>\n",
2261 }
2262
2263 /* set the parameter's default value */
2264 SCIPparamSetDefaultInt(param, defaultvalue);
2265
2266 return SCIP_OKAY;
2267}
2268
2269/** changes the default value of an existing SCIP_Longint parameter */
2271 SCIP_PARAMSET* paramset, /**< parameter set */
2272 const char* name, /**< name of the parameter */
2273 SCIP_Longint defaultvalue /**< new default value of the parameter */
2274 )
2275{
2276 SCIP_PARAM* param;
2277
2278 assert(paramset != NULL);
2279
2280 /* retrieve parameter from hash table */
2281 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
2282 if( param == NULL )
2283 {
2284 SCIPerrorMessage("parameter <%s> unknown\n", name);
2285 return SCIP_PARAMETERUNKNOWN;
2286 }
2287 if( param->paramtype != SCIP_PARAMTYPE_LONGINT )
2288 {
2289 SCIPerrorMessage("wrong parameter type - parameter <%s> has type <%s> instead of <%s>\n",
2292 }
2293
2294 /* set the parameter's default value */
2295 SCIPparamSetDefaultLongint(param, defaultvalue);
2296
2297 return SCIP_OKAY;
2298}
2299
2300/** changes the default value of an existing SCIP_Real parameter */
2302 SCIP_PARAMSET* paramset, /**< parameter set */
2303 const char* name, /**< name of the parameter */
2304 SCIP_Real defaultvalue /**< new default value of the parameter */
2305 )
2306{
2307 SCIP_PARAM* param;
2308
2309 assert(paramset != NULL);
2310
2311 /* retrieve parameter from hash table */
2312 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
2313 if( param == NULL )
2314 {
2315 SCIPerrorMessage("parameter <%s> unknown\n", name);
2316 return SCIP_PARAMETERUNKNOWN;
2317 }
2318 if( param->paramtype != SCIP_PARAMTYPE_REAL )
2319 {
2320 SCIPerrorMessage("wrong parameter type - parameter <%s> has type <%s> instead of <%s>\n",
2323 }
2324
2325 /* set the parameter's default value */
2326 SCIPparamSetDefaultReal(param, defaultvalue);
2327
2328 return SCIP_OKAY;
2329}
2330
2331/** changes the default value of an existing char parameter */
2333 SCIP_PARAMSET* paramset, /**< parameter set */
2334 const char* name, /**< name of the parameter */
2335 char defaultvalue /**< new default value of the parameter */
2336 )
2337{
2338 SCIP_PARAM* param;
2339
2340 assert(paramset != NULL);
2341
2342 /* retrieve parameter from hash table */
2343 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
2344 if( param == NULL )
2345 {
2346 SCIPerrorMessage("parameter <%s> unknown\n", name);
2347 return SCIP_PARAMETERUNKNOWN;
2348 }
2349 if( param->paramtype != SCIP_PARAMTYPE_CHAR )
2350 {
2351 SCIPerrorMessage("wrong parameter type - parameter <%s> has type <%s> instead of <%s>\n",
2354 }
2355
2356 /* set the parameter's default value */
2357 SCIPparamSetDefaultChar(param, defaultvalue);
2358
2359 return SCIP_OKAY;
2360}
2361
2362/** changes the default value of an existing string parameter */
2364 SCIP_PARAMSET* paramset, /**< parameter set */
2365 const char* name, /**< name of the parameter */
2366 const char* defaultvalue /**< new default value of the parameter */
2367 )
2368{
2369 SCIP_PARAM* param;
2370
2371 assert(paramset != NULL);
2372
2373 /* retrieve parameter from hash table */
2374 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)name);
2375 if( param == NULL )
2376 {
2377 SCIPerrorMessage("parameter <%s> unknown\n", name);
2378 return SCIP_PARAMETERUNKNOWN;
2379 }
2380 if( param->paramtype != SCIP_PARAMTYPE_STRING )
2381 {
2382 SCIPerrorMessage("wrong parameter type - parameter <%s> has type <%s> instead of <%s>\n",
2385 }
2386
2387 /* set the parameter's default value */
2388 SCIPparamSetDefaultString(param, defaultvalue);
2389
2390 return SCIP_OKAY;
2391}
2392
2393/** parses emphasis settings */
2394static
2396 SCIP_PARAMSET* paramset, /**< parameter set */
2397 SCIP_SET* set, /**< global SCIP settings */
2398 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
2399 char* line /**< line to parse (is modified during parse, but not freed) */
2400 )
2401{
2402 SCIP_PARAMSETTING paramsetting;
2403 SCIP_Bool globalemphasis = FALSE;
2404 char* paramname;
2405 char* paramvaluestr;
2406
2407 assert( paramset != NULL );
2408 assert( line != NULL );
2409
2410 /* find the start of the parameter name */
2411 while ( *line == ' ' || *line == '\t' || *line == '\r' )
2412 line++;
2413 if ( *line == '\0' || *line == '\n' || *line == '#' )
2414 return SCIP_OKAY;
2415 paramname = line;
2416
2417 /* find the end of the parameter name */
2418 while ( *line != ' ' && *line != '\t' && *line != '\r' && *line != '\n' && *line != '#' && *line != '\0' && *line != '=' && *line != ':' )
2419 line++;
2420 *line = '\0';
2421 ++line;
2422
2423 /* check for global emphasis settings */
2424 if ( strcmp(paramname, "default") == 0 )
2425 {
2427 globalemphasis = TRUE;
2428 }
2429 else if ( strcmp(paramname, "counter") == 0 )
2430 {
2432 globalemphasis = TRUE;
2433 }
2434 else if ( strcmp(paramname, "cpsolver") == 0 )
2435 {
2437 globalemphasis = TRUE;
2438 }
2439 else if ( strcmp(paramname, "easycip") == 0 )
2440 {
2442 globalemphasis = TRUE;
2443 }
2444 else if ( strcmp(paramname, "feasibility") == 0 )
2445 {
2447 globalemphasis = TRUE;
2448 }
2449 else if ( strcmp(paramname, "hardlp") == 0 )
2450 {
2452 globalemphasis = TRUE;
2453 }
2454 else if ( strcmp(paramname, "optimality") == 0 )
2455 {
2457 globalemphasis = TRUE;
2458 }
2459 else if ( strcmp(paramname, "numerics") == 0 )
2460 {
2462 globalemphasis = TRUE;
2463 }
2464 else if ( strcmp(paramname, "benchmark") == 0 )
2465 {
2467 globalemphasis = TRUE;
2468 }
2469
2470 /* check whether rest of line is clean */
2471 if ( globalemphasis )
2472 {
2473 /* check, if the rest of the line is clean */
2474 while ( *line == ' ' || *line == '\t' || *line == '\r' )
2475 ++line;
2476 if ( *line != '\0' && *line != '\n' && *line != '#' )
2477 {
2478 SCIPerrorMessage("additional characters after global emphasis setting: %s.\n", line);
2479 return SCIP_READERROR;
2480 }
2481 return SCIP_OKAY;
2482 }
2483
2484 /* find the start of the parameter value string */
2485 while ( *line == ' ' || *line == '\t' || *line == '\r' )
2486 ++line;
2487 if ( *line == '\0' || *line == '\n' || *line == '#' )
2488 {
2489 SCIPerrorMessage("emphasis parameter value is missing\n");
2490 return SCIP_READERROR;
2491 }
2492 paramvaluestr = line;
2493
2494 /* find the end of the parameter value string */
2495 while ( *line != ' ' && *line != '\t' && *line != '\r' && *line != '\n' && *line != '#' && *line != '\0' )
2496 ++line;
2497
2498 if ( *line == '#' )
2499 *line = '\0';
2500 else if ( *line != '\0' )
2501 {
2502 *line = '\0';
2503 ++line;
2504 /* check, if the rest of the line is clean */
2505 while ( *line == ' ' || *line == '\t' || *line == '\r' )
2506 ++line;
2507 if ( *line != '\0' && *line != '\n' && *line != '#' )
2508 {
2509 SCIPerrorMessage("additional characters after emphasis parameter value: %s.\n", line);
2510 return SCIP_READERROR;
2511 }
2512 }
2513
2514 /* determine type of setting */
2515 if ( strcmp(paramvaluestr, "default") == 0 )
2516 paramsetting = SCIP_PARAMSETTING_DEFAULT;
2517 else if ( strcmp(paramvaluestr, "aggressive") == 0 )
2518 paramsetting = SCIP_PARAMSETTING_AGGRESSIVE;
2519 else if ( strcmp(paramvaluestr, "fast") == 0 )
2520 paramsetting = SCIP_PARAMSETTING_FAST;
2521 else if ( strcmp(paramvaluestr, "off") == 0 )
2522 paramsetting = SCIP_PARAMSETTING_OFF;
2523 else
2524 {
2525 SCIPerrorMessage("unkown parameter setting: %s.\n", paramvaluestr);
2526 return SCIP_READERROR;
2527 }
2528
2529 /* check which kind of emphasis we want to set */
2530 if ( strcmp(paramname, "heuristics") == 0 )
2531 {
2532 SCIP_CALL( SCIPsetSetHeuristics(set, messagehdlr, paramsetting, FALSE) );
2533 }
2534 else if ( strcmp(paramname, "presolving") == 0 )
2535 {
2536 SCIP_CALL( SCIPsetSetPresolving(set, messagehdlr, paramsetting, FALSE) );
2537 }
2538 else if ( strcmp(paramname, "separating") == 0 )
2539 {
2540 SCIP_CALL( SCIPsetSetSeparating(set, messagehdlr, paramsetting, FALSE) );
2541 }
2542
2543 return SCIP_OKAY;
2544}
2545
2546/** parses a parameter file line "paramname = paramvalue" and sets parameter accordingly */
2547static
2549 SCIP_PARAMSET* paramset, /**< parameter set */
2550 SCIP_SET* set, /**< global SCIP settings */
2551 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
2552 char* line, /**< line to parse (is modified during parse, but not freed) */
2553 SCIP_Bool* foundnormalparam /**< pointer to store whether a normal parameter (not emphasis setting) has been found */
2554 )
2555{
2556 char* paramname;
2557 char* paramvaluestr;
2558 char* paramend;
2559 char* lastquote;
2560 SCIP_Bool quoted;
2561 SCIP_Bool fix = FALSE;
2562
2563 assert(paramset != NULL);
2564 assert(line != NULL);
2565 assert(foundnormalparam != NULL);
2566
2567 /* find the start of the parameter name */
2568 while( *line == ' ' || *line == '\t' || *line == '\r' )
2569 line++;
2570 if( *line == '\0' || *line == '\n' || *line == '#' )
2571 return SCIP_OKAY;
2572 paramname = line;
2573
2574 /* find the end of the parameter name */
2575 while( *line != ' ' && *line != '\t' && *line != '\r' && *line != '\n' && *line != '#' && *line != '\0' && *line != '=' && *line != ':' )
2576 line++;
2577 paramend = line;
2578
2579 /* skip possible whitespace */
2580 while( *line == ' ' || *line == '\t' || *line == '\r' )
2581 line++;
2582
2583 /* check whether first part consists of "emphasis:" */
2584 if ( *line == ':' )
2585 {
2586 *paramend = '\0'; /* could have paramend == line */
2587 if ( strcmp(paramname, "emphasis") != 0 )
2588 {
2589 SCIPerrorMessage("expected \"emphasis:\" at beginning of line.\n");
2590 return SCIP_READERROR;
2591 }
2592
2593 /* check that emphasis settings only appear at beginning of file */
2594 if ( *foundnormalparam )
2595 {
2596 SCIPerrorMessage("emphasis settings have to appear at top of file.\n");
2597 return SCIP_READERROR;
2598 }
2599
2600 /* parse emphasis line */
2601 SCIP_CALL( emphasisParse(paramset, set, messagehdlr, line+1) ); /* message handler */
2602 return SCIP_OKAY;
2603 }
2604 else if ( *line != '=' )
2605 {
2606 SCIPerrorMessage("expected character '=' after the parameter name.\n");
2607 return SCIP_READERROR;
2608 }
2609 *paramend = '\0'; /* could have paramend == line */
2610 ++line;
2611
2612 /* find the start of the parameter value string */
2613 while( *line == ' ' || *line == '\t' || *line == '\r' )
2614 line++;
2615 if( *line == '\0' || *line == '\n' || *line == '#' )
2616 {
2617 SCIPerrorMessage("parameter value is missing\n");
2618 return SCIP_READERROR;
2619 }
2620 paramvaluestr = line;
2621
2622 /* find the end of the parameter value string */
2623 quoted = (*paramvaluestr == '"');
2624 lastquote = NULL;
2625 while( (quoted || (*line != ' ' && *line != '\t' && *line != '\r' && *line != '\n' && *line != '#')) && *line != '\0' )
2626 {
2627 if( *line == '"' )
2628 lastquote = line;
2629 line++;
2630 }
2631 if( lastquote != NULL )
2632 line = lastquote+1;
2633 if( *line == '#' )
2634 *line = '\0';
2635 else if( *line != '\0' )
2636 {
2637 /* check, if the rest of the line is clean */
2638 *line = '\0';
2639 line++;
2640 while( *line == ' ' || *line == '\t' || *line == '\r' )
2641 line++;
2642 if( *line == 'f' && *(line+1) == 'i' && *(line+2) == 'x' )
2643 {
2644 fix = TRUE;
2645 line += 3;
2646
2647 while( *line == ' ' || *line == '\t' || *line == '\r' )
2648 line++;
2649 }
2650 if( *line != '\0' && *line != '\n' && *line != '#' )
2651 {
2652 SCIPerrorMessage("additional characters <%c> after parameter value (and possible 'fix' keyword)\n", *line);
2653 return SCIP_READERROR;
2654 }
2655 }
2656
2657 SCIP_CALL( SCIPparamsetSet(paramset, set, messagehdlr, paramname, paramvaluestr, fix) );
2658
2659 *foundnormalparam = TRUE;
2660
2661 return SCIP_OKAY;
2662}
2663
2664/** reads parameters from a file */
2666 SCIP_PARAMSET* paramset, /**< parameter set */
2667 SCIP_SET* set, /**< global SCIP settings */
2668 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
2669 const char* filename /**< file name */
2670 )
2671{
2672 SCIP_RETCODE retcode;
2673 SCIP_Bool foundnormalparam = FALSE;
2674 FILE* file;
2675 char line[1024];
2676 int lineno;
2677
2678 assert(paramset != NULL);
2679 assert(filename != NULL);
2680
2681 /* open the file for reading */
2682 file = fopen(filename, "r");
2683 if( file == NULL )
2684 {
2685 SCIPerrorMessage("cannot open file <%s> for reading\n", filename);
2686 SCIPprintSysError(filename);
2687 return SCIP_NOFILE;
2688 }
2689
2690 /* read the parameters from the file */
2691 lineno = 0;
2692 retcode = SCIP_OKAY;
2693 while( fgets(line, (int) sizeof(line), file) != NULL && retcode == SCIP_OKAY )
2694 {
2695 lineno++;
2696 retcode = paramsetParse(paramset, set, messagehdlr, line, &foundnormalparam);
2697 }
2698
2699 /* close input file */
2700 fclose(file);
2701
2702 if( retcode == SCIP_READERROR )
2703 {
2704 SCIPerrorMessage("input error in file <%s> line %d\n", filename, lineno);
2705 }
2706 else
2707 {
2708 SCIP_CALL( retcode );
2709 }
2710
2711 return SCIP_OKAY;
2712}
2713
2714/** writes all parameters in the parameter set to a file */
2716 SCIP_PARAMSET* paramset, /**< parameter set */
2717 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
2718 const char* filename, /**< file name, or NULL for stdout */
2719 SCIP_Bool comments, /**< should parameter descriptions be written as comments? */
2720 SCIP_Bool onlychanged /**< should only the parameters been written, that are changed from default? */
2721 )
2722{
2723 SCIP_RETCODE retcode;
2724 FILE* file;
2725 SCIP_Bool oldquiet = FALSE;
2726 int i;
2727
2728 assert(paramset != NULL);
2729
2730 /* open the file for writing */
2731 if( filename != NULL )
2732 {
2733 file = fopen(filename, "w");
2734 if( file == NULL )
2735 {
2736 SCIPerrorMessage("cannot open file <%s> for writing\n", filename);
2737 SCIPprintSysError(filename);
2738 return SCIP_FILECREATEERROR;
2739 }
2740
2741 /* temporarily set the quiet flag of the message handler to FALSE */
2742 if( messagehdlr != NULL )
2743 {
2744 oldquiet = SCIPmessagehdlrIsQuiet(messagehdlr);
2745 SCIPmessagehdlrSetQuiet(messagehdlr, FALSE);
2746 }
2747 }
2748 else
2749 file = NULL;
2750
2751 if( comments )
2752 {
2753 /* display the SCIP version as comment in the first line */
2754#if( SCIP_SUBVERSION == 0 )
2755 SCIPmessageFPrintInfo(messagehdlr, file, "# SCIP version %d.%d.%d\n",
2756 SCIP_VERSION_MAJOR, SCIP_VERSION_MINOR, SCIP_VERSION_PATCH);
2757#else
2758 SCIPmessageFPrintInfo(messagehdlr, file, "# SCIP version %d.%d.%d.%d\n",
2759 SCIP_VERSION_MAJOR, SCIP_VERSION_MINOR, SCIP_VERSION_PATCH, SCIP_SUBVERSION);
2760#endif
2761
2762 SCIPmessageFPrintInfo(messagehdlr, file, "\n");
2763 }
2764
2765 /* write the parameters to the file */
2766 for( i = 0; i < paramset->nparams; ++i )
2767 {
2768 retcode = paramWrite(paramset->params[i], messagehdlr, file, comments, onlychanged);
2769 if( retcode != SCIP_OKAY )
2770 {
2771 if( filename != NULL )
2772 {
2773 assert(file != NULL);
2774 fclose(file);
2775 }
2776 SCIP_CALL( retcode );
2777 }
2778 }
2779
2780 /* close output file */
2781 if( filename != NULL )
2782 {
2783 assert(file != NULL); /*lint !e449*/
2784
2785 /* reset the quiet flag of the message handler */
2786 if( messagehdlr != NULL )
2787 {
2788 SCIPmessagehdlrSetQuiet(messagehdlr, oldquiet);
2789 }
2790
2791 fclose(file);
2792 }
2793
2794 return SCIP_OKAY;
2795} /*lint !e593*/
2796
2797/** installs default values for all parameters */
2799 SCIP_PARAMSET* paramset, /**< parameter set */
2800 SCIP_SET* set, /**< global SCIP settings */
2801 SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
2802 )
2803{
2804 int i;
2805
2806 /* set all parameters to their default values */
2807 for( i = 0; i < paramset->nparams; ++i )
2808 {
2809 SCIP_CALL( SCIPparamSetToDefault(paramset->params[i], set, messagehdlr) );
2810 }
2811
2812 return SCIP_OKAY;
2813}
2814
2815/** installs default value for a single parameter */
2817 SCIP_PARAMSET* paramset, /**< parameter set */
2818 SCIP_SET* set, /**< global SCIP settings */
2819 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
2820 const char* paramname /**< name of the parameter */
2821 )
2822{
2823 SCIP_PARAM* param;
2824
2825 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)paramname);
2826
2827 if( param != NULL )
2828 {
2829 SCIP_CALL( SCIPparamSetToDefault(param, set, messagehdlr) );
2830 }
2831
2832 return SCIP_OKAY;
2833}
2834
2835/** resets parameters changed by SCIPparamsetSetHeuristicsXyz functions to their default values
2836 *
2837 * @note fixed parameters stay as they are; you need to unfix them first if they should be changed, too
2838 */ /*lint --e{715}*/
2839static
2841 SCIP_PARAMSET* paramset, /**< parameter set */
2842 SCIP_SET* set, /**< global SCIP settings */
2843 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
2844 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
2845 )
2846{ /*lint --e{715}*/
2847 SCIP_HEUR** heurs;
2849 int nheurs;
2850 int i;
2851
2852 heurs = set->heurs;
2853 nheurs = set->nheurs;
2854
2855 for( i = 0; i < nheurs; ++i )
2856 {
2857 const char* heurname;
2858 heurname = SCIPheurGetName(heurs[i]);
2859
2860 /* set frequency parameter to default */
2861 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/freq", heurname);
2862 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, paramname) );
2863
2864 /* set LP iteration offset to default */
2865 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxlpiterofs", heurname);
2866 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, paramname) );
2867
2868 /* set LP iteration quota to default */
2869 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxlpiterquot", heurname);
2870 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, paramname) );
2871 }
2872
2873 /* set specific parameters for RENS heuristic */
2874 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "heuristics/rens/nodesofs") );
2875 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "heuristics/rens/minfixingrate") );
2876
2877 /* set specific parameters for Crossover heuristic */
2878 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "heuristics/crossover/nwaitingnodes") );
2879 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "heuristics/crossover/dontwaitatroot") );
2880 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "heuristics/crossover/nodesquot") );
2881 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "heuristics/crossover/minfixingrate") );
2882
2883 return SCIP_OKAY;
2884}
2885
2886/** sets heuristics to aggressive */
2887static
2889 SCIP_PARAMSET* paramset, /**< parameter set */
2890 SCIP_SET* set, /**< global SCIP settings */
2891 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
2892 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
2893 )
2894{
2895 SCIP_HEUR** heurs;
2896 SCIP_PARAM* param;
2898 int nheurs;
2899 int i;
2900
2901 heurs = set->heurs;
2902 nheurs = set->nheurs;
2903
2904 SCIP_CALL( paramsetSetHeuristicsDefault(paramset, set, messagehdlr, quiet) );
2905
2906 for( i = 0; i < nheurs; ++i )
2907 {
2908 const char* heurname;
2909 heurname = SCIPheurGetName(heurs[i]);
2910
2911 /* dualval heuristic should stay disabled */
2912 if( strcmp(heurname, "dualval") == 0 )
2913 continue;
2914
2915 /* the aggressive Benders' decomposition heuristics should remain disabled */
2916 if( strstr(heurname, "benders") != NULL )
2917 continue;
2918
2919 /* get frequency parameter of heuristic */
2920 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/freq", heurname);
2921 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)paramname);
2922
2923 if( param != NULL )
2924 {
2925 int deffreq;
2926 int newfreq;
2927
2928 assert(SCIPparamGetType(param) == SCIP_PARAMTYPE_INT);
2929 deffreq = SCIPparamGetIntDefault(param);
2930
2931 /* change frequency to half of the default value, if it is > 0, otherwise set to 20 */
2932 if( deffreq == -1 || deffreq == 0 )
2933 {
2934 newfreq = 20;
2935 }
2936 else
2937 {
2938 newfreq = (int) SCIPsetCeil(set, deffreq/2.0);
2939 newfreq = MAX(newfreq, 1);
2940 }
2941
2942 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, paramname, newfreq, quiet) );
2943
2944 /* LP iteration limits only get increased for heuristics which are activated by default */
2945 if( SCIPparamGetIntDefault(param) > -1 )
2946 {
2947 /* construct (possible) parameter name for LP iteration offset */
2948 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxlpiterofs", heurname);
2949 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)paramname);
2950
2951 if( param != NULL && SCIPparamGetType(param) == SCIP_PARAMTYPE_INT )
2952 {
2953 /* set LP iteration offset to 1.5 time the current value */
2954 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, paramname, (int) (1.5 * SCIPparamGetIntDefault(param)), quiet) );
2955 }
2956
2957 /* construct (possible) parameter name for LP iteration quotient parameter */
2958 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxlpiterquot", heurname);
2959 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)paramname);
2960
2961 if( param != NULL && SCIPparamGetType(param) == SCIP_PARAMTYPE_REAL )
2962 {
2963 /* set LP iteration quotient to 1.5 time the current value */
2964 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, paramname, 1.5 * SCIPparamGetRealDefault(param), quiet) );
2965 }
2966 }
2967 }
2968 }
2969
2970 /* set specific parameters for RENS heuristic, if the heuristic is included */
2971#ifndef NDEBUG
2972 if( SCIPsetFindHeur(set, "rens") != NULL )
2973#endif
2974 {
2975 SCIP_CALL( paramSetLongint(paramset, set, messagehdlr, "heuristics/rens/nodesofs", (SCIP_Longint)2000, quiet) );
2976 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "heuristics/rens/minfixingrate", 0.3, quiet) );
2977 }
2978
2979 /* set specific parameters for Crossover heuristic, if the heuristic is included */
2980#ifndef NDEBUG
2981 if( SCIPsetFindHeur(set, "crossover") != NULL )
2982#endif
2983 {
2984 SCIP_CALL( paramSetLongint(paramset, set, messagehdlr, "heuristics/crossover/nwaitingnodes", (SCIP_Longint)20, quiet) );
2985 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "heuristics/crossover/dontwaitatroot", TRUE, quiet) );
2986 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "heuristics/crossover/nodesquot", 0.15, quiet) );
2987 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "heuristics/crossover/minfixingrate", 0.5, quiet) );
2988 }
2989
2990 /* set specific parameters for Adaptive Large Neighborhood Search heuristic, if the heuristic is included */
2991#ifndef NDEBUG
2992 if( SCIPsetFindHeur(set, "alns") != NULL )
2993#endif
2994 {
2995 /* activate all neighborhoods explicitly (keep list in alphabetic order) */
2996 int nneighborhoods = 9;
2997 const char* neighborhoodnames[] = {
2998 "crossover",
2999 "dins",
3000 "localbranching",
3001 "mutation",
3002 "proximity",
3003 "rens",
3004 "rins",
3005 "trustregion",
3006 "zeroobjective"
3007 };
3008 for( i = 0; i < nneighborhoods; ++i )
3009 {
3010 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/alns/%s/active", neighborhoodnames[i]);
3011 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, paramname, TRUE, quiet) );
3012 }
3013 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "heuristics/alns/nodesquot", 0.2, quiet) );
3014 SCIP_CALL( paramSetLongint(paramset, set, messagehdlr, "heuristics/alns/nodesofs", (SCIP_Longint)2000, quiet) );
3015 }
3016
3017 return SCIP_OKAY;
3018}
3019
3020/** sets heuristics to fast */
3021static
3023 SCIP_PARAMSET* paramset, /**< parameter set */
3024 SCIP_SET* set, /**< global SCIP settings */
3025 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
3026 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
3027 )
3028{
3029 int i;
3030
3031 SCIP_HEUR** heurs;
3032 int nheurs;
3033
3034#define NEXPENSIVEHEURFREQS 12
3035 static const char* const expensiveheurfreqs[NEXPENSIVEHEURFREQS] = {
3036 "heuristics/coefdiving/freq",
3037 "heuristics/distributiondiving/freq",
3038 "heuristics/feaspump/freq",
3039 "heuristics/fracdiving/freq",
3040 "heuristics/guideddiving/freq",
3041 "heuristics/linesearchdiving/freq",
3042 "heuristics/nlpdiving/freq",
3043 "heuristics/subnlp/freq",
3044 "heuristics/objpscostdiving/freq",
3045 "heuristics/pscostdiving/freq",
3046 "heuristics/rootsoldiving/freq",
3047 "heuristics/veclendiving/freq"
3048 };
3049
3050 SCIP_CALL( paramsetSetHeuristicsDefault(paramset, set, messagehdlr, quiet) );
3051
3052 /* disable all heuristics that use subSCIPs */
3053 heurs = SCIPgetHeurs(set->scip);
3054 nheurs = SCIPgetNHeurs(set->scip);
3055 for( i = 0; i < nheurs; ++i )
3056 {
3057 if( SCIPheurUsesSubscip(heurs[i]) )
3058 {
3060 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/freq", SCIPheurGetName(heurs[i]));
3061 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, paramname, -1, quiet) );
3062 }
3063 }
3064
3065 /* explicitly turn off further expensive heuristics, if included */
3066 for( i = 0; i < NEXPENSIVEHEURFREQS; ++i )
3067 if( SCIPhashtableRetrieve(paramset->hashtable, (void*)expensiveheurfreqs[i]) != NULL )
3068 {
3069 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, expensiveheurfreqs[i], -1, quiet) );
3070 }
3071
3072 return SCIP_OKAY;
3073}
3074
3075/** turns all heuristics off */
3076static
3078 SCIP_PARAMSET* paramset, /**< parameter set */
3079 SCIP_SET* set, /**< global SCIP settings */
3080 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
3081 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
3082 )
3083{
3084 SCIP_HEUR** heurs;
3086 int nheurs;
3087 int i;
3088
3089 heurs = set->heurs;
3090 nheurs = set->nheurs;
3091
3092 SCIP_CALL( paramsetSetHeuristicsDefault(paramset, set, messagehdlr, quiet) );
3093
3094 for( i = 0; i < nheurs; ++i )
3095 {
3096 const char* heurname;
3097 heurname = SCIPheurGetName(heurs[i]);
3098
3099 /* get frequency parameter of heuristic */
3100 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/freq", heurname);
3101
3102 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, paramname, -1, quiet) );
3103 }
3104
3105 return SCIP_OKAY;
3106}
3107
3108/** resets all parameters that start with "presolving" in their name to their default value; additionally set the
3109 * parameters which might have previously been changed by the methods SCIPparamsetSetToPresolving{Off,Fast,Aggressive}
3110 * to their default value
3111 *
3112 * @note fixed parameters stay as they are; you need to unfix them first if they should be changed, too
3113 */
3114static
3116 SCIP_PARAMSET* paramset, /**< parameter set */
3117 SCIP_SET* set, /**< global SCIP settings */
3118 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
3119 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
3120 )
3121{ /*lint --e{715}*/
3122 SCIP_PROP** props;
3123 SCIP_CONSHDLR** conshdlrs;
3124 SCIP_PRESOL** presols;
3126 int nprops;
3127 int nconshdlrs;
3128 int npresols;
3129 int i;
3130
3131 presols = set->presols;
3132 npresols = set->npresols;
3133
3134 /* reset each individual presolver */
3135 for( i = 0; i < npresols; ++i )
3136 {
3137 const char* presolname;
3138 presolname = SCIPpresolGetName(presols[i]);
3139
3140 /* reset maxrounds parameter of presolvers */
3141 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "presolving/%s/maxrounds", presolname);
3142
3143 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, paramname) );
3144 }
3145
3146 props = set->props;
3147 nprops = set->nprops;
3148
3149 /* reset presolving for each individual propagator */
3150 for( i = 0; i < nprops; ++i )
3151 {
3152 const char* propname;
3153 propname = SCIPpropGetName(props[i]);
3154
3155 /* reset maxprerounds parameter of propagator */
3156 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "propagating/%s/maxprerounds", propname);
3157 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, paramname) );
3158 }
3159
3160 conshdlrs = set->conshdlrs;
3161 nconshdlrs = set->nconshdlrs;
3162
3163 /* reset presolving settings for each individual constraint handler */
3164 for( i = 0; i < nconshdlrs; ++i )
3165 {
3166 const char* conshdlrname;
3167 conshdlrname = SCIPconshdlrGetName(conshdlrs[i]);
3168
3169 /* reset maxprerounds parameter of constraint handler */
3170 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/maxprerounds", conshdlrname);
3171 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, paramname) );
3172
3173 /* reset presolpairwise parameter of constraint handler */
3174 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/presolpairwise", conshdlrname);
3175 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, paramname) );
3176 }
3177
3178 /* explicitly reset parameters of setppc constraint handler, if the constraint handler is included */
3179 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "constraints/setppc/cliquelifting") );
3180
3181 /* explicitly reset parameters of knapsack constraint handler, if the constraint handler is included */
3182 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "constraints/knapsack/disaggregation") );
3183
3184 /* explicitly reset restart and maxrounds parameters */
3185 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "presolving/maxrestarts") );
3186 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "presolving/restartfac") );
3187 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "presolving/restartminred") );
3188 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "presolving/maxrounds") );
3189
3190 /* explicitly reset probing parameters */
3191 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "propagating/probing/maxuseless") );
3192 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "propagating/probing/maxtotaluseless") );
3193 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "propagating/probing/maxprerounds") );
3194
3195 return SCIP_OKAY;
3196}
3197
3198/** sets presolving to aggressive */
3199static
3201 SCIP_PARAMSET* paramset, /**< parameter set */
3202 SCIP_SET* set, /**< global SCIP settings */
3203 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
3204 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
3205 )
3206{
3207 SCIP_PARAM* param;
3208 SCIP_PRESOL** presols;
3210 int npresols;
3211 int p;
3212
3213 /* reset previous changes on presolving parameters */
3214 SCIP_CALL( paramsetSetPresolvingDefault(paramset, set, messagehdlr, quiet) );
3215
3216 /* explicitly change restart parameters */
3217 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "presolving/restartfac", 0.0125, quiet) );
3218 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "presolving/restartminred", 0.06, quiet) );
3219
3220 /* explicitly enable clique lifting of setppc constraint handler, if included */
3221#ifndef NDEBUG
3222 if( SCIPsetFindConshdlr(set, "setppc") != NULL )
3223#endif
3224 {
3225 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "constraints/setppc/cliquelifting", TRUE, quiet) );
3226 }
3227
3228 presols = set->presols;
3229 npresols = set->npresols;
3230
3231 /* enable all presolvers except for convertinttobin */
3232 for( p = 0; p < npresols; ++p )
3233 {
3234 const char* presolname;
3235 presolname = SCIPpresolGetName(presols[p]);
3236
3237 /* convertinttobin alters the problem formulation, which needs to be actively enabled by the user */
3238 if( strcmp(presolname, "convertinttobin") == 0 )
3239 continue;
3240
3241 /* get maxrounds parameter of presolvers */
3242 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "presolving/%s/maxrounds", presolname);
3243
3244 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, paramname, -1, quiet) );
3245 }
3246
3247 /* explicitly change parameters of probing */
3248 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "propagating/probing/maxuseless");
3249 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)paramname);
3250 if( param != NULL )
3251 {
3252 int defvalue;
3253
3254 assert(SCIPparamGetType(param) == SCIP_PARAMTYPE_INT);
3255 defvalue = SCIPparamGetIntDefault(param);
3256
3257 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, paramname, (int) (1.5 * defvalue), quiet) );
3258 }
3259 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "propagating/probing/maxtotaluseless");
3260 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)paramname);
3261 if( param != NULL )
3262 {
3263 int defvalue;
3264
3265 assert(SCIPparamGetType(param) == SCIP_PARAMTYPE_INT);
3266 defvalue = SCIPparamGetIntDefault(param);
3267
3268 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, paramname, (int) (1.5 * defvalue), quiet) );
3269 }
3270
3271 return SCIP_OKAY;
3272}
3273
3274/** sets presolving to fast */
3275static
3277 SCIP_PARAMSET* paramset, /**< parameter set */
3278 SCIP_SET* set, /**< global SCIP settings */
3279 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
3280 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
3281 )
3282{
3283 SCIP_CONSHDLR** conshdlrs;
3284 SCIP_PARAM* param;
3286 int nconshdlrs;
3287 int i;
3288
3289 /* reset previous changes on presolving parameters */
3290 SCIP_CALL( paramsetSetPresolvingDefault(paramset, set, messagehdlr, quiet) );
3291
3292 conshdlrs = set->conshdlrs;
3293 nconshdlrs = set->nconshdlrs;
3294
3295 /* turn off pairwise comparison for each constraint handler that has this feature */
3296 for( i = 0; i < nconshdlrs; ++i )
3297 {
3298 const char* conshdlrname;
3299 conshdlrname = SCIPconshdlrGetName(conshdlrs[i]);
3300
3301 /* get presolpairwise parameter of constraint handler */
3302 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/presolpairwise", conshdlrname);
3303 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)paramname);
3304
3305 if( param != NULL && SCIPparamGetType(param) == SCIP_PARAMTYPE_BOOL )
3306 {
3307 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, paramname, FALSE, quiet) );
3308 }
3309 }
3310
3311 /* explicitly turn off restarts */
3312 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "presolving/maxrestarts", 0, quiet) );
3313
3314 /* explicitly change parameters of presolver convertinttobin, if included */
3315#ifndef NDEBUG
3316 if( SCIPsetFindPresol(set, "convertinttobin") != NULL )
3317#endif
3318 {
3319 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "presolving/convertinttobin/maxrounds", 0, quiet) );
3320 }
3321
3322 /* turn off probing, if included */
3323#ifndef NDEBUG
3324 if( SCIPsetFindProp(set, "probing") != NULL )
3325#endif
3326 {
3327 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "propagating/probing/maxprerounds", 0, quiet) );
3328 }
3329
3330 /* explicitly disable components constraint handler, if included */
3331#ifndef NDEBUG
3332 if( SCIPsetFindConshdlr(set, "components") != NULL )
3333#endif
3334 {
3335 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "constraints/components/maxprerounds", 0, quiet) );
3336 }
3337
3338 /* explicitly disable dominated columns presolver, if included */
3339#ifndef NDEBUG
3340 if( SCIPsetFindPresol(set, "domcol") != NULL )
3341#endif
3342 {
3343 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "presolving/domcol/maxrounds", 0, quiet) );
3344 }
3345
3346 /* explicitly disable gate extraction presolver, if included */
3347#ifndef NDEBUG
3348 if( SCIPsetFindPresol(set, "gateextraction") != NULL )
3349#endif
3350 {
3351 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "presolving/gateextraction/maxrounds", 0, quiet) );
3352 }
3353
3354 /* explicitly disable sparsify presolver, if included */
3355#ifndef NDEBUG
3356 if( SCIPsetFindPresol(set, "sparsify") != NULL )
3357#endif
3358 {
3359 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "presolving/sparsify/maxrounds", 0, quiet) );
3360 }
3361
3362 /* explicitly disable dual sparsify presolver, if included */
3363#ifndef NDEBUG
3364 if( SCIPsetFindPresol(set, "dualsparsify") != NULL )
3365#endif
3366 {
3367 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "presolving/dualsparsify/maxrounds", 0, quiet) );
3368 }
3369
3370 /* explicitly disable tworowbnd presolver, if included */
3371#ifndef NDEBUG
3372 if( SCIPsetFindPresol(set, "tworowbnd") != NULL )
3373#endif
3374 {
3375 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "presolving/tworowbnd/maxrounds", 0, quiet) );
3376 }
3377
3378 /* explicitly forbid the use of implications in logicor presolving */
3379#ifndef NDEBUG
3380 if( SCIPsetFindConshdlr(set, "logicor") != NULL )
3381#endif
3382 {
3383 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "constraints/logicor/implications", 0, quiet) );
3384 }
3385
3386 return SCIP_OKAY;
3387}
3388
3389/** turns all presolving off */
3390static
3392 SCIP_PARAMSET* paramset, /**< parameter set */
3393 SCIP_SET* set, /**< global SCIP settings */
3394 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
3395 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
3396 )
3397{
3398 SCIP_PRESOL** presols;
3399 SCIP_PROP** props;
3400 SCIP_CONSHDLR** conshdlrs;
3402 int npresols;
3403 int nprops;
3404 int nconshdlrs;
3405 int i;
3406
3407 /* reset previous changes on presolving parameters */
3408 SCIP_CALL( paramsetSetPresolvingDefault(paramset, set, messagehdlr, quiet) );
3409
3410 presols = set->presols;
3411 npresols = set->npresols;
3412
3413 /* turn each individual presolver off */
3414 for( i = 0; i < npresols; ++i )
3415 {
3416 const char* presolname;
3417 presolname = SCIPpresolGetName(presols[i]);
3418
3419 /* get maxrounds parameter of presolvers */
3420 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "presolving/%s/maxrounds", presolname);
3421
3422 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, paramname, 0, quiet) );
3423 }
3424
3425 props = set->props;
3426 nprops = set->nprops;
3427
3428 /* turn off presolving for each individual propagator */
3429 for( i = 0; i < nprops; ++i )
3430 {
3431 const char* propname;
3432 propname = SCIPpropGetName(props[i]);
3433
3434 /* get maxrounds parameter of propagator */
3435 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "propagating/%s/maxprerounds", propname);
3436
3437 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, paramname, 0, quiet) );
3438 }
3439
3440 conshdlrs = set->conshdlrs;
3441 nconshdlrs = set->nconshdlrs;
3442
3443 /* turn off presolving for each individual constraint handler */
3444 for( i = 0; i < nconshdlrs; ++i )
3445 {
3446 const char* conshdlrname;
3447 conshdlrname = SCIPconshdlrGetName(conshdlrs[i]);
3448
3449 /* get maxprerounds parameter of constraint handler */
3450 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/maxprerounds", conshdlrname);
3451
3452 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, paramname, 0, quiet) );
3453 }
3454
3455 /* explicitly turn off restarts */
3456 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "presolving/maxrestarts", 0, quiet) );
3457
3458 /* set the maximum number of presolving rounds to zero */
3459 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "presolving/maxrounds", 0, quiet) );
3460
3461 return SCIP_OKAY;
3462}
3463
3464/** reset parameters that may have been changed by other SCIPparamsetSetSeparatingXyz to their default values
3465 *
3466 * @note fixed parameters stay as they are; you need to unfix them first if they should be changed, too
3467 */ /*lint !e715*/
3468static
3470 SCIP_PARAMSET* paramset, /**< parameter set */
3471 SCIP_SET* set, /**< global SCIP settings */
3472 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
3473 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
3474 )
3475{ /*lint --e{715}*/
3476 SCIP_SEPA** sepas;
3477 SCIP_CONSHDLR** conshdlrs;
3479 int nconshdlrs;
3480 int nsepas;
3481 int i;
3482
3483 sepas = set->sepas;
3484 nsepas = set->nsepas;
3485
3486 /* reset separating parameters of all separators */
3487 for( i = 0; i < nsepas; ++i )
3488 {
3489 const char* sepaname;
3490 sepaname = SCIPsepaGetName(sepas[i]);
3491
3492 /* reset frequency parameter of separator */
3493 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "separating/%s/freq", sepaname);
3494 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, paramname) );
3495
3496 /* reset maximum number of rounds in root node */
3497 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "separating/%s/maxroundsroot", sepaname);
3498 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, paramname) );
3499
3500 /* reset maximum number of cuts per separation in root node */
3501 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "separating/%s/maxsepacutsroot", sepaname);
3502 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, paramname) );
3503 }
3504
3505 conshdlrs = set->conshdlrs;
3506 nconshdlrs = set->nconshdlrs;
3507
3508 /* reset each individual constraint handler separation settings */
3509 for( i = 0; i < nconshdlrs; ++i )
3510 {
3511 const char* conshdlrname;
3512 conshdlrname = SCIPconshdlrGetName(conshdlrs[i]);
3513
3514 /* reset separation frequency parameter of constraint handler, if available */
3515 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/sepafreq", conshdlrname);
3516 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, paramname) );
3517
3518 /* reset maximal separated cuts in root node of constraint handler, if available */
3519 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/maxsepacutsroot", conshdlrname);
3520 if( SCIPhashtableRetrieve(paramset->hashtable, (void*)paramname) != NULL )
3521 {
3522 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, paramname) );
3523 }
3524 }
3525
3526 /* explicitly reset individual parameters */
3527 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "constraints/linear/separateall") );
3528 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "cutselection/hybrid/minorthoroot") );
3529 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "separating/maxroundsrootsubrun") );
3530 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "separating/maxaddrounds") );
3531 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "separating/maxcutsroot") );
3532 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "separating/poolfreq") );
3533 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "separating/aggregation/maxfailsroot") );
3534 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "separating/mcf/maxtestdelta") );
3535 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "separating/mcf/trynegscaling") );
3536 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "separating/aggregation/maxtriesroot") );
3537 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "separating/aggregation/maxaggrsroot") );
3538 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "separating/maxbounddist") );
3539 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "separating/zerohalf/maxslackroot") );
3540 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "separating/zerohalf/maxslack") );
3541 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "separating/zerohalf/maxsepacutsroot") );
3542 SCIP_CALL( SCIPparamsetSetToDefault(paramset, set, messagehdlr, "separating/zerohalf/maxroundsroot") );
3543
3544 return SCIP_OKAY;
3545}
3546
3547/** sets separating to aggressive */
3548static
3550 SCIP_PARAMSET* paramset, /**< parameter set */
3551 SCIP_SET* set, /**< global SCIP settings */
3552 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
3553 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
3554 )
3555{
3556 SCIP_CONSHDLR** conshdlrs;
3557 SCIP_SEPA** sepas;
3558 SCIP_PARAM* param;
3560 int nconshdlrs;
3561 int nsepas;
3562 int i;
3563
3564 sepas = set->sepas;
3565 nsepas = set->nsepas;
3566
3567 /* set all separating parameters to default values */
3568 SCIP_CALL( paramsetSetSeparatingDefault(paramset, set, messagehdlr, quiet) );
3569
3570 /* set separating parameters of all separators */
3571 for( i = 0; i < nsepas; ++i )
3572 {
3573 const char* sepaname;
3574 sepaname = SCIPsepaGetName(sepas[i]);
3575
3576 /* intobj and cgmip separators should stay disabled */
3577 if( strcmp(sepaname, "intobj") == 0 || strcmp(sepaname, "cgmip") == 0 )
3578 continue;
3579
3580 /* get frequency parameter of separator */
3581 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "separating/%s/freq", sepaname);
3582 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)paramname);
3583
3584 if( param != NULL )
3585 {
3586 int deffreq;
3587 int newfreq;
3588
3589 assert(SCIPparamGetType(param) == SCIP_PARAMTYPE_INT);
3590 deffreq = SCIPparamGetIntDefault(param);
3591
3592 /* for enabled separators, change frequency to at least every 20th depths and
3593 * enable disabled separators
3594 */
3595 if( deffreq == -1 )
3596 newfreq = 0;
3597 else if( deffreq == 0 )
3598 newfreq = 20;
3599 else
3600 newfreq = MIN(deffreq, 20);
3601
3602 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, paramname, newfreq, quiet) );
3603 }
3604
3605 /* get maximum number of rounds in root node */
3606 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "separating/%s/maxroundsroot", sepaname);
3607 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)paramname);
3608
3609 if( param != NULL )
3610 {
3611 int defrounds;
3612
3613 assert(SCIPparamGetType(param) == SCIP_PARAMTYPE_INT);
3614 defrounds = SCIPparamGetIntDefault(param);
3615
3616 /* increase the maximum number of rounds in the root node by factor of 1.5 */
3617 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, paramname, (int) (1.5 * defrounds), quiet) );
3618 }
3619
3620 /* get maximum number of cuts per separation in root node */
3621 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "separating/%s/maxsepacutsroot", sepaname);
3622 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)paramname);
3623
3624 if( param != NULL )
3625 {
3626 int defnumber;
3627
3628 assert(SCIPparamGetType(param) == SCIP_PARAMTYPE_INT);
3629 defnumber = SCIPparamGetIntDefault(param);
3630
3631 /* increase the maximum number of cut per separation rounds in the root node by factor of 2 */
3632 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, paramname, 2*defnumber, quiet) );
3633 }
3634 }
3635
3636 conshdlrs = set->conshdlrs;
3637 nconshdlrs = set->nconshdlrs;
3638
3639 /* set separating parameters of all constraint handlers */
3640 for( i = 0; i < nconshdlrs; ++i )
3641 {
3642 const char* conshdlrname;
3643 conshdlrname = SCIPconshdlrGetName(conshdlrs[i]);
3644
3645 /* get separating frequency parameter of constraint handler */
3646 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/sepafreq", conshdlrname);
3647 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)paramname);
3648
3649 if( param != NULL )
3650 {
3651 int deffreq;
3652 int newfreq;
3653
3654 assert(SCIPparamGetType(param) == SCIP_PARAMTYPE_INT);
3655 deffreq = SCIPparamGetIntDefault(param);
3656
3657 /* for constraint handlers with enabled separation, change frequency to at least every 10th depths and
3658 * enable disabled separation routines
3659 */
3660 if( deffreq == -1 )
3661 newfreq = 0;
3662 else if( deffreq == 0 )
3663 newfreq = 10;
3664 else
3665 newfreq = MIN(deffreq, 10);
3666
3667 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, paramname, newfreq, quiet) );
3668 }
3669
3670 /* get maximal separated cuts in root node of constraint handler */
3671 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/maxsepacutsroot", conshdlrname);
3672 param = (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)paramname);
3673
3674 if( param != NULL )
3675 {
3676 int defnumber;
3677
3678 assert(SCIPparamGetType(param) == SCIP_PARAMTYPE_INT);
3679 defnumber = SCIPparamGetIntDefault(param);
3680
3681 /* change maximal cuts in root node to at least 500 */
3682 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, paramname, MAX(defnumber, 500), quiet) );
3683 }
3684 }
3685
3686 /* explicitly change general separating parameters */
3687 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "cutselection/hybrid/minorthoroot", 0.1, quiet) );
3688 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/maxroundsrootsubrun", 5, quiet) );
3689 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/maxaddrounds", 5, quiet) );
3690 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/maxcutsroot", 5000, quiet) );
3691 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/poolfreq", 10, quiet) );
3692
3693 /* explicitly change a separating parameter of the linear constraint handler, if included */
3694#ifndef NDEBUG
3695 if( SCIPsetFindConshdlr(set, "linear") != NULL )
3696#endif
3697 {
3698 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "constraints/linear/separateall", TRUE, quiet) );
3699 }
3700
3701 /* explicitly change a separating parameter of cmir separator, if included */
3702#ifndef NDEBUG
3703 if( SCIPsetFindSepa(set, "aggregation") != NULL )
3704#endif
3705 {
3706 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/aggregation/maxfailsroot", 200, quiet) );
3707 }
3708
3709 /* explicitly change separating parameters of mcf separator, if included */
3710#ifndef NDEBUG
3711 if( SCIPsetFindSepa(set, "mcf") != NULL )
3712#endif
3713 {
3714 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/mcf/maxtestdelta", -1, quiet) );
3715 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "separating/mcf/trynegscaling", TRUE, quiet) );
3716 }
3717
3718 return SCIP_OKAY;
3719}
3720
3721/** sets separating to fast */
3722static
3724 SCIP_PARAMSET* paramset, /**< parameter set */
3725 SCIP_SET* set, /**< global SCIP settings */
3726 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
3727 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
3728 )
3729{
3730 /* reset previous changes on separating parameters */
3731 SCIP_CALL( paramsetSetSeparatingDefault(paramset, set, messagehdlr, quiet) );
3732
3733 /* explicitly decrease maxbounddist */
3734 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "separating/maxbounddist", 0.0, quiet) );
3735
3736 /* explicitly turn off expensive separators, if included */
3737#ifndef NDEBUG
3738 if( SCIPsetFindConshdlr(set, "and") != NULL )
3739#endif
3740 {
3741 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "constraints/and/sepafreq", 0, quiet) );
3742 }
3743#ifndef NDEBUG
3744 if( SCIPsetFindSepa(set, "aggregation") != NULL )
3745#endif
3746 {
3747 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/aggregation/maxroundsroot", 5, quiet) );
3748 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/aggregation/maxtriesroot", 100, quiet) );
3749 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/aggregation/maxaggrsroot", 3, quiet) );
3750 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/aggregation/maxsepacutsroot", 200, quiet) );
3751 }
3752#ifndef NDEBUG
3753 if( SCIPsetFindSepa(set, "zerohalf") != NULL )
3754#endif
3755 {
3756 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "separating/zerohalf/maxslackroot", 0.0, quiet) );
3757 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "separating/zerohalf/maxslack", 0.0, quiet) );
3758 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/zerohalf/maxsepacutsroot", 200, quiet) );
3759 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/zerohalf/maxroundsroot", 5, quiet) );
3760 }
3761#ifndef NDEBUG
3762 if( SCIPsetFindSepa(set, "gomory") != NULL )
3763#endif
3764 {
3765 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/gomory/maxroundsroot", 20, quiet) );
3766 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/gomory/maxsepacutsroot", 200, quiet) );
3767 }
3768#ifndef NDEBUG
3769 if( SCIPsetFindSepa(set, "mcf") != NULL )
3770#endif
3771 {
3772 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/mcf/freq", -1, quiet) );
3773 }
3774
3775 return SCIP_OKAY;
3776}
3777
3778/** turns all cuts off */
3779static
3781 SCIP_PARAMSET* paramset, /**< parameter set */
3782 SCIP_SET* set, /**< global SCIP settings */
3783 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
3784 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
3785 )
3786{
3787 SCIP_SEPA** sepas;
3788 SCIP_CONSHDLR** conshdlrs;
3790 int nsepas;
3791 int nconshdlrs;
3792 int i;
3793
3794 /* reset previous changes on separating parameters */
3795 SCIP_CALL( paramsetSetSeparatingDefault(paramset, set, messagehdlr, quiet) );
3796
3797 sepas = set->sepas;
3798 nsepas = set->nsepas;
3799
3800 /* turn each individual separator off */
3801 for( i = 0; i < nsepas; ++i )
3802 {
3803 const char* sepaname;
3804 sepaname = SCIPsepaGetName(sepas[i]);
3805
3806 /* get frequency parameter of separator */
3807 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "separating/%s/freq", sepaname);
3808 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, paramname, -1, quiet) );
3809 }
3810
3811 conshdlrs = set->conshdlrs;
3812 nconshdlrs = set->nconshdlrs;
3813
3814 /* turn off separation for each individual constraint handler */
3815 for( i = 0; i < nconshdlrs; ++i )
3816 {
3817 const char* conshdlrname;
3818 conshdlrname = SCIPconshdlrGetName(conshdlrs[i]);
3819
3820 /* get separation frequency parameter of constraint handler */
3821 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/sepafreq", conshdlrname);
3822 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, paramname, -1, quiet) );
3823 }
3824
3825 return SCIP_OKAY;
3826}
3827
3828/** sets parameters to
3829 *
3830 * - \ref SCIP_PARAMEMPHASIS_DEFAULT to use default values (see also SCIPparamsetSetToDefault())
3831 * - \ref SCIP_PARAMEMPHASIS_COUNTER to get feasible and "fast" counting process
3832 * - \ref SCIP_PARAMEMPHASIS_CPSOLVER to get CP like search (e.g. no LP relaxation)
3833 * - \ref SCIP_PARAMEMPHASIS_EASYCIP to solve easy problems fast
3834 * - \ref SCIP_PARAMEMPHASIS_FEASIBILITY to detect feasibility fast
3835 * - \ref SCIP_PARAMEMPHASIS_HARDLP to be capable to handle hard LPs
3836 * - \ref SCIP_PARAMEMPHASIS_OPTIMALITY to prove optimality fast
3837 * - \ref SCIP_PARAMEMPHASIS_PHASEFEAS to find feasible solutions during a 3 phase solution process
3838 * - \ref SCIP_PARAMEMPHASIS_PHASEIMPROVE to find improved solutions during a 3 phase solution process
3839 * - \ref SCIP_PARAMEMPHASIS_PHASEPROOF to proof optimality during a 3 phase solution process
3840 * - \ref SCIP_PARAMEMPHASIS_NUMERICS to solve problems which cause numerical issues
3841 * - \ref SCIP_PARAMEMPHASIS_BENCHMARK to not try to avoid running into memory limit
3842 */
3844 SCIP_PARAMSET* paramset, /**< parameter set */
3845 SCIP_SET* set, /**< global SCIP settings */
3846 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
3847 SCIP_PARAMEMPHASIS paramemphasis, /**< parameter emphasis */
3848 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
3849 )
3850{
3851 switch( paramemphasis )
3852 {
3854 /* reset all parameter to default */
3855 SCIP_CALL( SCIPparamsetSetToDefaults(paramset, set, messagehdlr) );
3856 break;
3857
3859 /* TODO: should constraints/linear/detectlowerbound and detectcutoffbound be set to FALSE? */
3860 /* avoid logicor upgrade since the logicor constraint handler does not perform full propagation */
3861 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "constraints/linear/upgrade/logicor", FALSE, quiet) );
3862
3863 /* set priority for inference branching to highest possible value */
3864 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "branching/inference/priority", INT_MAX/4, quiet) );
3865
3866 /* set priority for depth first search to highest possible value */
3867 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "nodeselection/dfs/stdpriority", INT_MAX/4, quiet) );
3868
3869 /* avoid that the ZIMPL reader transforms the problem before the problem is generated */
3870 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "reading/zplreader/usestartsol", FALSE, quiet) );
3871
3872 /* turn off all heuristics */
3873 SCIP_CALL( paramsetSetHeuristicsOff(paramset, set, messagehdlr, quiet) );
3874
3875 /* turn off all separation */
3876 SCIP_CALL( paramsetSetSeparatingOff(paramset, set, messagehdlr, quiet) );
3877
3878 /* turn off restart */
3879 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "presolving/maxrestarts", 0, quiet) );
3880
3881 /* unlimited number of propagation rounds in any branch and bound node */
3882 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "propagating/maxrounds", -1, quiet) );
3883 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "propagating/maxroundsroot", -1, quiet) );
3884
3885 /* adjust conflict analysis for depth first search */
3886 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "conflict/fuiplevels", 1, quiet) );
3887 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "conflict/dynamic", FALSE, quiet) );
3888
3889 /* prefer binary variables for branching */
3890 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "branching/preferbinary", TRUE, quiet) );
3891
3892 /* turn on aggressive constraint aging */
3893 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "constraints/agelimit", 1, quiet) );
3894
3895 /* turn off symmetry handling */
3896 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "misc/usesymmetry", 0, quiet) );
3897
3898 /* turn off components presolver since we are currently not able to handle that in case of counting */
3899#ifndef NDEBUG
3900 if( SCIPsetFindConshdlr(set, "components") != NULL )
3901#endif
3902 {
3903 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "constraints/components/maxprerounds", 0, quiet) );
3904 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "constraints/components/propfreq", -1, quiet) );
3905 }
3906 break;
3907
3909 /* shrink the minimal maximum value for the conflict length */
3910 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "conflict/minmaxvars", 10, quiet) );
3911
3912 /* use only first unique implication point */
3913 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "conflict/fuiplevels", 1, quiet) );
3914
3915 /* do not use reconversion conflicts */
3916 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "conflict/reconvlevels", 0, quiet) );
3917
3918 /* after 250 conflict we force a restart since then the variable statistics are reasonable initialized */
3919 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "conflict/restartnum", 250, quiet) );
3920
3921 /* increase the number of conflicts which induce a restart */
3922 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "conflict/restartfac", 2.0, quiet) );
3923
3924 /* weight the variable which made into a conflict */
3925 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "conflict/conflictweight", 1.0, quiet) );
3926
3927 /* do not check pseudo solution (for performance reasons) */
3928 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "constraints/disableenfops", TRUE, quiet) );
3929
3930 /* use value based history to detect a reasonable branching point */
3931 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "history/valuebased", TRUE, quiet) );
3932
3933 /* turn of LP relaxation */
3934 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "lp/solvefreq", -1, quiet) );
3935
3936 /* prefer the down branch in case the value based history does not suggest something */
3937 SCIP_CALL( paramSetChar(paramset, set, messagehdlr, "nodeselection/childsel", 'd', quiet) );
3938
3939 /* accept any bound change */
3940 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "numerics/boundstreps", 1e-6, quiet) );
3941
3942 /* allow for at most 10 restart, after that the value based history should be reliable */
3943 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "presolving/maxrestarts", 10, quiet) );
3944
3945 /* set priority for depth first search to highest possible value */
3946 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "nodeselection/dfs/stdpriority", INT_MAX/4, quiet) );
3947
3948 break;
3949
3951 /* set heuristics to fast, to avoid spending to much time for involved heuristics */
3952 SCIP_CALL( paramsetSetHeuristicsFast(paramset, set, messagehdlr, quiet) );
3953
3954 /* set presolving to fast, to avoid spending to much time for involved presolving */
3955 SCIP_CALL( paramsetSetPresolvingFast(paramset, set, messagehdlr, quiet) );
3956
3957 /* set separating to fast, to avoid spending to much time for involved separators */
3958 SCIP_CALL( paramsetSetSeparatingFast(paramset, set, messagehdlr, quiet) );
3959
3960 break;
3961
3963 /* set heuristics aggressive */
3964 SCIP_CALL( paramsetSetHeuristicsAggressive(paramset, set, messagehdlr, quiet) );
3965
3966 /* reduce the amount of separation rounds and disable most expensive separators */
3967 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/maxrounds", 1, quiet) );
3968 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/maxroundsroot", 5, quiet) );
3969 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/aggregation/freq", -1, quiet) );
3970 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/mcf/freq", -1, quiet) );
3971
3972 /* set priority for node selection "restartdfs" to be higher as the current used one */
3973 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "nodeselection/restartdfs/stdpriority", INT_MAX/4, quiet) );
3974 break;
3975
3977 /* set heuristics to fast, to avoid heuristics which solve also an LP */
3978 SCIP_CALL( paramsetSetHeuristicsFast(paramset, set, messagehdlr, quiet) );
3979
3980 /* set presolving to fast, to avoid spending to much time for involved presolving */
3981 SCIP_CALL( paramsetSetPresolvingFast(paramset, set, messagehdlr, quiet) );
3982
3983 /* reduce the amount of strong branching */
3984 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "branching/relpscost/maxreliable", 1.0, quiet) );
3985 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "branching/relpscost/inititer", 10, quiet) );
3986
3987 /* reduce the amount of separation rounds */
3988 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/maxrounds", 1, quiet) );
3989 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "separating/maxroundsroot", 5, quiet) );
3990
3991 break;
3992
3994 /* set cuts aggressive */
3995 SCIP_CALL( paramsetSetSeparatingAggressive(paramset, set, messagehdlr, quiet) );
3996
3997 /* increase the amount of strong branching */
3998 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "branching/fullstrong/maxdepth", 10, quiet) );
3999 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "branching/fullstrong/priority", INT_MAX / 4, quiet) );
4000 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "branching/fullstrong/maxbounddist", 0.0, quiet) );
4001 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "branching/relpscost/sbiterquot", 1.0, quiet) );
4002 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "branching/relpscost/sbiterofs", 1000000, quiet) );
4003 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "branching/relpscost/maxreliable", 10.0, quiet) );
4004 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "branching/relpscost/usehyptestforreliability",TRUE, quiet) );
4005 break;
4007
4008 /* enable two phase node selection: UCT will run first, but deactivate itself after a small number of nodes */
4009 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "nodeselection/uct/stdpriority", (INT_MAX / 4) + 1, quiet) );
4010 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "nodeselection/restartdfs/stdpriority", INT_MAX/4, quiet) );
4011
4012 /* enable inference branching */
4013 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "branching/inference/priority", INT_MAX / 4, quiet) );
4014 break;
4015
4017 /* use UCT node selection in all subSCIP heuristics that have this parameter */
4018 {
4019 int h;
4020 SCIP_HEUR** heurs = set->heurs;
4021 int nheurs = set->nheurs;
4022
4023 for( h = 0; h < nheurs; ++h )
4024 {
4026 if( SCIPheurUsesSubscip(heurs[h]) )
4027 {
4028 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/useuct", SCIPheurGetName(heurs[h]));
4029
4030 if( (SCIP_PARAM*)SCIPhashtableRetrieve(paramset->hashtable, (void*)paramname) != NULL )
4031 {
4032 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, paramname, TRUE, quiet) );
4033 }
4034 }
4035 }
4036
4037 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "heuristics/useuctsubscip", TRUE, quiet) );
4038 }
4039 break;
4041 /* deactivate primal heuristics */
4042 SCIP_CALL( paramsetSetHeuristicsOff(paramset, set, messagehdlr, quiet) );
4043
4044 /* make aggressive use of separators, also locally */
4045 SCIP_CALL( paramsetSetSeparatingAggressive(paramset, set, messagehdlr, quiet) );
4046
4047 /* use depth-first node selection strategy that makes best use of LP warmstarts */
4048 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "nodeselection/dfs/stdpriority", INT_MAX/4, quiet) );
4049
4050 /* enable dynamic weights for reliability pseudo cost branching */
4051 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "branching/relpscost/dynamicweights", TRUE, quiet) );
4052 break;
4053
4055
4056 /* huge val is used as a threshold in multiaggregation; decreasing it leads to safer multiaggregations */
4057 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "numerics/hugeval", 1e+10, quiet) );
4058
4059 /* The higher the Markowitz Parameter is, more sparse pivots will be ignored and the numerically
4060 more stable ones will be used as pivot */
4061 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "lp/minmarkowitz", 0.999, quiet) );
4062
4063 /* Added parameters as suggested here: https://git.zib.de/integer/scip/issues/2002#note_92716 */
4064 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "lp/fastmip", 0, quiet) );
4065 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "lp/scaling", 2, quiet) );
4066 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "lp/presolving", FALSE, quiet) );
4067 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "lp/refactorinterval", 40, quiet) );
4068
4069 /* To prevent numerically bad multiaggregations in dualPresolve() and convertLongEquality() set maxmultiaggrqout small*/
4070 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "constraints/linear/maxmultaggrquot", 10.0, quiet) );
4071 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "constraints/linear/maxdualmultaggrquot", 10.0, quiet) );
4072
4073 /* When upgrading constr with knapsack/setppc causes problems */
4074 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "constraints/linear/upgrade/knapsack", FALSE, quiet) );
4075 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "constraints/linear/upgrade/setppc", FALSE, quiet) );
4076
4077 /* For numerical stability turn rangedrowpropagation, simplifyInequalities and extractCliques off */
4078 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "constraints/linear/rangedrowpropagation", FALSE, quiet) );
4079 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "constraints/linear/extractcliques", FALSE, quiet) );
4080 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "constraints/linear/simplifyinequalities", FALSE, quiet) );
4081
4082 /* Reduce the max coefratio to prevent the creation of potentially numerical unstable cuts */
4083 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "separating/maxcoefratio", 100.0, quiet) );
4084 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "separating/maxcoefratiofacrowprep", 1.0, quiet) );
4085
4086#ifdef SCIP_WITH_PAPILO
4087 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "presolving/milp/hugebound", 1e6, quiet) );
4088 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "presolving/milp/markowitztolerance", 0.1, quiet) );
4089#endif
4090
4091 /* weaken domain propagation of nonlinear constraints by increasing relaxation of variable bounds and constraint sides */
4092 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "constraints/nonlinear/conssiderelaxamount", 1e-7, quiet) );
4093 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "constraints/nonlinear/varboundrelaxamount", 1e-7, quiet) );
4094
4095 break;
4096
4098
4099 /* turn off memory saving mode and do not try to avoid memory limit */
4100 SCIP_CALL( paramSetReal(paramset, set, messagehdlr, "memory/savefac", 1.0, quiet) );
4101 SCIP_CALL( paramSetBool(paramset, set, messagehdlr, "misc/avoidmemout", FALSE, quiet) );
4102 break;
4103
4104 default:
4105 SCIPerrorMessage("the parameter setting <%d> is not allowed for emphasis call\n", paramemphasis);
4106 return SCIP_INVALIDCALL;
4107 }
4108 return SCIP_OKAY;
4109}
4110
4111/** sets parameters to deactivate separators and heuristics that use auxiliary SCIP instances; should be called for
4112 * auxiliary SCIP instances to avoid recursion
4113 */
4115 SCIP_PARAMSET* paramset, /**< parameter set */
4116 SCIP_SET* set, /**< global SCIP settings */
4117 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
4118 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
4119 )
4120{
4121 SCIP_HEUR** heurs;
4122 SCIP_SEPA** sepas;
4123
4125
4126 int nheurs;
4127 int nsepas;
4128 int i;
4129
4130 heurs = set->heurs;
4131 nheurs = set->nheurs;
4132
4133 /* disable all heuristics that use auxiliary SCIP instances */
4134 for( i = 0; i < nheurs; ++i )
4135 {
4136 if( SCIPheurUsesSubscip(heurs[i]) )
4137 {
4138 const char* heurname;
4139 heurname = SCIPheurGetName(heurs[i]);
4140
4141 /* get frequency parameter of heuristic */
4142 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/freq", heurname);
4143
4144 /* we have to unfix the parameter if it fixed and not already set to -1 */
4145 if( SCIPparamsetIsFixed(paramset, paramname) )
4146 {
4147 int oldfreq;
4148
4149 SCIP_CALL( SCIPparamsetGetInt(paramset, paramname, &oldfreq) );
4150
4151 /* if the frequency is already set to -1, we do not have to unfix it, but must not try to set it, either */
4152 if( oldfreq == -1 )
4153 continue;
4154
4155 /* unfix parameter */
4156 SCIPmessageFPrintInfo(messagehdlr, NULL, "unfixing parameter %s in order to disable sub-SCIPs in the current (sub-)SCIP instance\n", paramname);
4158 }
4159
4160 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, paramname, -1, quiet) );
4161 }
4162 }
4163
4164 sepas = set->sepas;
4165 nsepas = set->nsepas;
4166
4167 /* disable all separators that use auxiliary SCIP instances */
4168 for( i = 0; i < nsepas; ++i )
4169 {
4170 if( SCIPsepaUsesSubscip(sepas[i]) )
4171 {
4172 const char* sepaname;
4173 sepaname = SCIPsepaGetName(sepas[i]);
4174
4175 /* get frequency parameter of separator */
4176 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "separating/%s/freq", sepaname);
4177
4178 /* we have to unfix the parameter if it fixed and not already set to -1 */
4179 if( SCIPparamsetIsFixed(paramset, paramname) )
4180 {
4181 int oldfreq;
4182
4183 SCIP_CALL( SCIPparamsetGetInt(paramset, paramname, &oldfreq) );
4184
4185 /* if the frequency is already set to -1, we do not have to unfix it, but must not try to set it, either */
4186 if( oldfreq == -1 )
4187 continue;
4188
4189 /* unfix parameter */
4190 SCIPmessageFPrintInfo(messagehdlr, NULL, "unfixing parameter %s in order to disable sub-SCIPs in the current (sub-)SCIP instance\n", paramname);
4192 }
4193
4194 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, paramname, -1, quiet) );
4195 }
4196 }
4197
4198 /* turn off components constraint handler */
4199 #ifndef NDEBUG
4200 if( SCIPsetFindConshdlr(set, "components") != NULL )
4201#endif
4202 {
4203 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "constraints/components/maxprerounds", 0, quiet) );
4204 SCIP_CALL( paramSetInt(paramset, set, messagehdlr, "constraints/components/propfreq", -1, quiet) );
4205 }
4206
4207 /* marking that the sub-SCIPs have been deactivated */
4208 set->subscipsoff = TRUE;
4209
4210 return SCIP_OKAY;
4211}
4212
4213/** sets heuristic parameters values to
4214 * - SCIP_PARAMSETTING_DEFAULT which are the default values of all heuristic parameters
4215 * - SCIP_PARAMSETTING_FAST such that the time spent on heuristics is decreased
4216 * - SCIP_PARAMSETTING_AGGRESSIVE such that the heuristics are called more aggressively
4217 * - SCIP_PARAMSETTING_OFF which turn off all heuristics
4218 */
4220 SCIP_PARAMSET* paramset, /**< parameter set */
4221 SCIP_SET* set, /**< global SCIP settings */
4222 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
4223 SCIP_PARAMSETTING paramsetting, /**< parameter settings */
4224 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
4225 )
4226{
4227 switch( paramsetting )
4228 {
4230 SCIP_CALL( paramsetSetHeuristicsDefault(paramset, set, messagehdlr, quiet) );
4231 break;
4233 SCIP_CALL( paramsetSetHeuristicsOff(paramset, set, messagehdlr, quiet) );
4234 break;
4236 SCIP_CALL( paramsetSetHeuristicsFast(paramset, set, messagehdlr, quiet) );
4237 break;
4239 SCIP_CALL( paramsetSetHeuristicsAggressive(paramset, set, messagehdlr, quiet) );
4240 break;
4241 default:
4242 SCIPerrorMessage("the parameter setting <%d> is not allowed for heuristics\n", paramsetting);
4243 return SCIP_INVALIDCALL;
4244 }
4245
4246 return SCIP_OKAY;
4247}
4248
4249/** sets presolving parameters to
4250 * - SCIP_PARAMSETTING_DEFAULT which are the default values of all presolving parameters
4251 * - SCIP_PARAMSETTING_FAST such that the time spent on presolving is decreased
4252 * - SCIP_PARAMSETTING_AGGRESSIVE such that the presolving is more aggressive
4253 * - SCIP_PARAMSETTING_OFF which turn off all presolving
4254 */
4256 SCIP_PARAMSET* paramset, /**< parameter set */
4257 SCIP_SET* set, /**< global SCIP settings */
4258 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
4259 SCIP_PARAMSETTING paramsetting, /**< parameter settings */
4260 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
4261 )
4262{
4263 switch( paramsetting )
4264 {
4266 SCIP_CALL( paramsetSetPresolvingDefault(paramset, set, messagehdlr, quiet) );
4267 break;
4269 SCIP_CALL( paramsetSetPresolvingOff(paramset, set, messagehdlr, quiet) );
4270 break;
4272 SCIP_CALL( paramsetSetPresolvingFast(paramset, set, messagehdlr, quiet) );
4273 break;
4275 SCIP_CALL( paramsetSetPresolvingAggressive(paramset, set, messagehdlr, quiet) );
4276 break;
4277 default:
4278 SCIPerrorMessage("the parameter setting <%d> is not allowed for presolving\n", paramsetting);
4279 return SCIP_INVALIDCALL;
4280 }
4281
4282 return SCIP_OKAY;
4283}
4284
4285/** sets separating parameters to
4286 * - SCIP_PARAMSETTING_DEFAULT which are the default values of all separating parameters
4287 * - SCIP_PARAMSETTING_FAST such that the time spent on separating is decreased
4288 * - SCIP_PARAMSETTING_AGGRESSIVE such that separating is more aggressive
4289 * - SCIP_PARAMSETTING_OFF which turn off all separating
4290 */
4292 SCIP_PARAMSET* paramset, /**< parameter set */
4293 SCIP_SET* set, /**< global SCIP settings */
4294 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
4295 SCIP_PARAMSETTING paramsetting, /**< parameter settings */
4296 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
4297 )
4298{
4299 switch( paramsetting )
4300 {
4302 SCIP_CALL( paramsetSetSeparatingDefault(paramset, set, messagehdlr, quiet) );
4303 break;
4305 SCIP_CALL( paramsetSetSeparatingOff(paramset, set, messagehdlr, quiet) );
4306 break;
4308 SCIP_CALL( paramsetSetSeparatingFast(paramset, set, messagehdlr, quiet) );
4309 break;
4311 SCIP_CALL( paramsetSetSeparatingAggressive(paramset, set, messagehdlr, quiet) );
4312 break;
4313 default:
4314 SCIPerrorMessage("the parameter setting <%d> is not allowed for separating\n", paramsetting);
4315 return SCIP_INVALIDCALL;
4316 }
4317
4318 return SCIP_OKAY;
4319}
4320
4321/** returns the array of parameters */
4323 SCIP_PARAMSET* paramset /**< parameter set */
4324 )
4325{
4326 assert(paramset != NULL);
4327
4328 return paramset->params;
4329}
4330
4331/** returns the number of parameters in the parameter set */
4333 SCIP_PARAMSET* paramset /**< parameter set */
4334 )
4335{
4336 assert(paramset != NULL);
4337
4338 return paramset->nparams;
4339}
4340
4341/** copies all parameter values of the source parameter set to the corresponding parameters in the target set
4342 *
4343 * by default reoptimization is disabled after copying the parameters. if you want to use reoptimization, you have
4344 * to enable it explicitly.
4345 */
4347 SCIP_PARAMSET* sourceparamset, /**< source parameter set */
4348 SCIP_PARAMSET* targetparamset, /**< target parameter set */
4349 SCIP_SET* set, /**< global SCIP settings of target SCIP */
4350 SCIP_MESSAGEHDLR* messagehdlr /**< message handler of target SCIP */
4351 )
4352{
4353 int i;
4354
4355 assert(sourceparamset != NULL);
4356 assert(targetparamset != NULL);
4357 assert(sourceparamset != targetparamset);
4358 assert(set != NULL);
4359
4360 assert(sourceparamset->nparams == 0 || sourceparamset->params != NULL);
4361 assert(targetparamset->nparams == 0 || targetparamset->params != NULL);
4362
4363 for( i = 0; i < sourceparamset->nparams; ++i )
4364 {
4365 SCIP_PARAM* sourceparam;
4366 SCIP_PARAM* targetparam;
4367 const char* paramname;
4368
4369 sourceparam = sourceparamset->params[i];
4370 assert(sourceparam != NULL);
4371
4372 /* find parameter of same name in target scip */
4373 paramname = SCIPparamGetName(sourceparam);
4374 targetparam = (SCIP_PARAM*)SCIPhashtableRetrieve(targetparamset->hashtable, (void*)paramname);
4375
4376 /* if a plugin was not copied, the parameter does not exist in the target SCIP */
4377 if( targetparam == NULL )
4378 continue;
4379
4380 assert(SCIPparamGetType(sourceparam) == SCIPparamGetType(targetparam));
4381
4382 /* set value of target parameter to value of source parameter */
4383 switch( SCIPparamGetType(sourceparam) )
4384 {
4386 SCIP_CALL( paramCopyBool(sourceparam, targetparam, set, messagehdlr) );
4387 break;
4388
4389 case SCIP_PARAMTYPE_INT:
4390 SCIP_CALL( paramCopyInt(sourceparam, targetparam, set, messagehdlr) );
4391 break;
4392
4394 SCIP_CALL( paramCopyLongint(sourceparam, targetparam, set, messagehdlr) );
4395 break;
4396
4398 SCIP_CALL( paramCopyReal(sourceparam, targetparam, set, messagehdlr) );
4399 break;
4400
4402 SCIP_CALL( paramCopyChar(sourceparam, targetparam, set, messagehdlr) );
4403 break;
4404
4406 /* the visualization parameters are explicitly not copied to avoid that the visualization file of the original SCIP is overwritten;
4407 * to avoid a hard coded comparison, each parameter could get a Bool flag which tells if the value
4408 * of that parameter can be copied
4409 */
4410 if( strncmp(sourceparam->name, "visual/", 7) != 0 )
4411 {
4412 SCIP_CALL( paramCopyString(sourceparam, targetparam, set, messagehdlr) );
4413 }
4414 break;
4415
4416 default:
4417 SCIPerrorMessage("unknown parameter type\n");
4418 return SCIP_INVALIDDATA;
4419 }
4420
4421 /* copy fixing status of parameter */
4422 SCIPparamSetFixed(targetparam, SCIPparamIsFixed(sourceparam));
4423 }
4424
4425 /* disable reoptimization explicitly */
4426 if( set->reopt_enable )
4427 {
4428 if( SCIPsetIsParamFixed(set, "reoptimization/enable") )
4429 {
4430 SCIP_CALL( SCIPsetChgParamFixed(set, "reoptimization/enable", FALSE) );
4431 }
4432 SCIP_CALL( SCIPparamsetSetBool(targetparamset, set, messagehdlr, "reoptimization/enable", FALSE) );
4434 }
4435
4436 return SCIP_OKAY;
4437}
4438
4439/** sets fixing status of given parameter */
4441 SCIP_PARAM* param, /**< parameter */
4442 SCIP_Bool fixed /**< new fixing status of the parameter */
4443 )
4444{
4445 assert(param != NULL);
4446
4447 param->isfixed = fixed;
4448}
4449
4450/** checks whether value of bool parameter is valid */
4452 SCIP_PARAM* param, /**< parameter */
4453 SCIP_Bool value /**< value to check */
4454 )
4455{ /*lint --e{715}*/
4456 assert(param != NULL);
4457 return ( value == TRUE || value == FALSE );
4458}
4459
4460/** checks whether value of integer parameter is valid */
4462 SCIP_PARAM* param, /**< parameter */
4463 int value /**< value to check */
4464 )
4465{
4466 assert(param != NULL);
4467
4468 return ( value >= param->data.intparam.minvalue && value <= param->data.intparam.maxvalue );
4469}
4470
4471/** checks whether value of SCIP_Longint parameter is valid */
4473 SCIP_PARAM* param, /**< parameter */
4474 SCIP_Longint value /**< value to check */
4475 )
4476{
4477 assert( param != NULL );
4478
4479 return ( value >= param->data.longintparam.minvalue && value <= param->data.longintparam.maxvalue );
4480}
4481
4482/** checks whether value of SCIP_Real parameter is valid */
4484 SCIP_PARAM* param, /**< parameter */
4485 SCIP_Real value /**< value to check */
4486 )
4487{
4488 assert( param != NULL );
4489
4490 return ( value >= param->data.realparam.minvalue && value <= param->data.realparam.maxvalue );
4491}
4492
4493/** checks whether value of char parameter is valid */
4495 SCIP_PARAM* param, /**< parameter */
4496 const char value /**< value to check */
4497 )
4498{
4499 assert( param != NULL );
4500
4501 if( value == '\b' || value == '\f' || value == '\n' || value == '\r' || value == '\v' )
4502 return FALSE;
4503
4504 if( param->data.charparam.allowedvalues != NULL )
4505 {
4506 char* c;
4507
4508 c = param->data.charparam.allowedvalues;
4509 while( *c != '\0' && *c != value )
4510 c++;
4511
4512 if( *c != value )
4513 return FALSE;
4514 }
4515
4516 return TRUE;
4517}
4518
4519/** checks whether value of string parameter is valid */
4521 SCIP_PARAM* param, /**< parameter */
4522 const char* value /**< value to check */
4523 )
4524{ /*lint --e{715}*/
4525 unsigned int i;
4526
4527 assert(param != NULL);
4528
4529 for( i = 0; i < (unsigned int) strlen(value); ++i )
4530 {
4531 if( value[i] == '\b' || value[i] == '\f' || value[i] == '\n' || value[i] == '\r' || value[i] == '\v' )
4532 return FALSE;
4533 }
4534 return TRUE;
4535}
4536
4537/** sets value of SCIP_Bool parameter */
4539 SCIP_PARAM* param, /**< parameter */
4540 SCIP_SET* set, /**< global SCIP settings, or NULL if param change method should not be called */
4541 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
4542 SCIP_Bool value, /**< new value of the parameter */
4543 SCIP_Bool initialize, /**< is this the initialization of the parameter? */
4544 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
4545 )
4546{
4547 assert(param != NULL);
4548
4549 /* check if value is possible for the parameter */
4550 SCIP_CALL_QUIET( paramTestBool(param, messagehdlr, value) );
4551
4552 /* is the value of the parameter changed? */
4553 if( initialize || (param->data.boolparam.valueptr != NULL && *param->data.boolparam.valueptr != value)
4554 || (param->data.boolparam.valueptr == NULL && param->data.boolparam.curvalue != value) )
4555 {
4556 SCIP_Bool oldvalue = FALSE;
4557
4558 /* check if the parameter is not fixed */
4559 SCIP_CALL_QUIET( paramTestFixed(param, messagehdlr) );
4560
4561 if( !initialize )
4562 oldvalue = SCIPparamGetBool(param);
4563
4564 /* set the parameter's current value */
4565 if( param->data.boolparam.valueptr != NULL )
4566 *param->data.boolparam.valueptr = value;
4567 else
4568 param->data.boolparam.curvalue = value;
4569
4570 /* call the parameter's change information method, unless initializing */
4571 if( !initialize && param->paramchgd != NULL && set != NULL )
4572 {
4573 SCIP_RETCODE retcode;
4574
4575 retcode = param->paramchgd(set->scip, param);
4576
4577 if( retcode == SCIP_PARAMETERWRONGVAL )
4578 {
4579 if( param->data.boolparam.valueptr != NULL )
4580 *param->data.boolparam.valueptr = oldvalue;
4581 else
4582 param->data.boolparam.curvalue = oldvalue;
4583 }
4584 else
4585 {
4586 SCIP_CALL( retcode );
4587 }
4588 }
4589 }
4590
4591 if( !quiet )
4592 {
4593 SCIP_CALL( paramWrite(param, messagehdlr, NULL, FALSE, TRUE) );
4594 }
4595
4596 return SCIP_OKAY;
4597}
4598
4599/** sets value of int parameter */
4601 SCIP_PARAM* param, /**< parameter */
4602 SCIP_SET* set, /**< global SCIP settings, or NULL if param change method should not be called */
4603 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
4604 int value, /**< new value of the parameter */
4605 SCIP_Bool initialize, /**< is this the initialization of the parameter? */
4606 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
4607 )
4608{
4609 assert(param != NULL);
4610
4611 /* check if value is possible for the parameter */
4612 SCIP_CALL_QUIET( paramTestInt(param, messagehdlr, value) );
4613
4614 /* is the value of the parameter changed? */
4615 if( initialize || (param->data.intparam.valueptr != NULL && *param->data.intparam.valueptr != value)
4616 || (param->data.intparam.valueptr == NULL && param->data.intparam.curvalue != value) )
4617 {
4618 int oldvalue = 0;
4619
4620 /* check if the parameter is not fixed */
4621 SCIP_CALL_QUIET( paramTestFixed(param, messagehdlr) );
4622
4623 if( !initialize )
4624 oldvalue = SCIPparamGetInt(param);
4625
4626 /* set the parameter's current value */
4627 if( param->data.intparam.valueptr != NULL )
4628 *param->data.intparam.valueptr = value;
4629 else
4630 param->data.intparam.curvalue = value;
4631
4632 /* call the parameter's change information method, unless initialization */
4633 if( !initialize && param->paramchgd != NULL && set != NULL )
4634 {
4635 SCIP_RETCODE retcode;
4636
4637 retcode = param->paramchgd(set->scip, param);
4638
4639 if( retcode == SCIP_PARAMETERWRONGVAL )
4640 {
4641 if( param->data.intparam.valueptr != NULL )
4642 *param->data.intparam.valueptr = oldvalue;
4643 else
4644 param->data.intparam.curvalue = oldvalue;
4645 }
4646 else
4647 {
4648 SCIP_CALL( retcode );
4649 }
4650 }
4651 }
4652
4653 if( !quiet )
4654 {
4655 SCIP_CALL( paramWrite(param, messagehdlr, NULL, FALSE, TRUE) );
4656 }
4657
4658 return SCIP_OKAY;
4659}
4660
4661/** sets value of SCIP_Longint parameter */
4663 SCIP_PARAM* param, /**< parameter */
4664 SCIP_SET* set, /**< global SCIP settings, or NULL if param change method should not be called */
4665 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
4666 SCIP_Longint value, /**< new value of the parameter */
4667 SCIP_Bool initialize, /**< is this the initialization of the parameter? */
4668 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
4669 )
4670{
4671 assert(param != NULL);
4672
4673 /* check if value is possible for the parameter */
4674 SCIP_CALL_QUIET( paramTestLongint(param, messagehdlr, value) );
4675
4676 /* is the value of the parameter changed? */
4677 if( initialize || (param->data.longintparam.valueptr != NULL && *param->data.longintparam.valueptr != value)
4678 || (param->data.longintparam.valueptr == NULL && param->data.longintparam.curvalue != value) )
4679 {
4680 SCIP_Longint oldvalue = 0L;
4681
4682 /* check if the parameter is not fixed */
4683 SCIP_CALL_QUIET( paramTestFixed(param, messagehdlr) );
4684
4685 if( !initialize )
4686 oldvalue = SCIPparamGetLongint(param);
4687
4688 /* set the parameter's current value */
4689 if( param->data.longintparam.valueptr != NULL )
4690 *param->data.longintparam.valueptr = value;
4691 else
4692 param->data.longintparam.curvalue = value;
4693
4694 /* call the parameter's change information method, unless initialization */
4695 if( !initialize && param->paramchgd != NULL && set != NULL )
4696 {
4697 SCIP_RETCODE retcode;
4698
4699 retcode = param->paramchgd(set->scip, param);
4700
4701 if( retcode == SCIP_PARAMETERWRONGVAL )
4702 {
4703 if( param->data.longintparam.valueptr != NULL )
4704 *param->data.longintparam.valueptr = oldvalue;
4705 else
4706 param->data.longintparam.curvalue = oldvalue;
4707 }
4708 else
4709 {
4710 SCIP_CALL( retcode );
4711 }
4712 }
4713 }
4714
4715 if( !quiet )
4716 {
4717 SCIP_CALL( paramWrite(param, messagehdlr, NULL, FALSE, TRUE) );
4718 }
4719
4720 return SCIP_OKAY;
4721}
4722
4723/** sets value of SCIP_Real parameter */
4725 SCIP_PARAM* param, /**< parameter */
4726 SCIP_SET* set, /**< global SCIP settings, or NULL if param change method should not be called */
4727 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
4728 SCIP_Real value, /**< new value of the parameter */
4729 SCIP_Bool initialize, /**< is this the initialization of the parameter? */
4730 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
4731 )
4732{
4733 assert(param != NULL);
4734
4735 /* check if value is possible for the parameter */
4736 value = MAX(value, SCIP_REAL_MIN);
4737 value = MIN(value, SCIP_REAL_MAX);
4738 SCIP_CALL_QUIET( paramTestReal(param, messagehdlr, value) );
4739
4740 /* is the value of the parameter changed? */
4741 if( initialize || (param->data.realparam.valueptr != NULL && *param->data.realparam.valueptr != value) /*lint !e777*/
4742 || (param->data.realparam.valueptr == NULL && param->data.realparam.curvalue != value) ) /*lint !e777*/
4743 {
4744 SCIP_Real oldvalue = 0.0;
4745
4746 /* check if the parameter is not fixed */
4747 SCIP_CALL_QUIET( paramTestFixed(param, messagehdlr) );
4748
4749 if( !initialize )
4750 oldvalue = SCIPparamGetReal(param);
4751
4752 /* set the parameter's current value */
4753 if( param->data.realparam.valueptr != NULL )
4754 *param->data.realparam.valueptr = value;
4755 else
4756 param->data.realparam.curvalue = value;
4757
4758 /* call the parameter's change information method, unless initializing */
4759 if( !initialize && param->paramchgd != NULL && set != NULL )
4760 {
4761 SCIP_RETCODE retcode;
4762
4763 retcode = param->paramchgd(set->scip, param);
4764
4765 if( retcode == SCIP_PARAMETERWRONGVAL )
4766 {
4767 if( param->data.realparam.valueptr != NULL )
4768 *param->data.realparam.valueptr = oldvalue;
4769 else
4770 param->data.realparam.curvalue = oldvalue;
4771 }
4772 else
4773 {
4774 SCIP_CALL( retcode );
4775 }
4776 }
4777 }
4778
4779 if( !quiet )
4780 {
4781 SCIP_CALL( paramWrite(param, messagehdlr, NULL, FALSE, TRUE) );
4782 }
4783
4784 return SCIP_OKAY;
4785}
4786
4787/** sets value of char parameter */
4789 SCIP_PARAM* param, /**< parameter */
4790 SCIP_SET* set, /**< global SCIP settings, or NULL if param change method should not be called */
4791 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
4792 char value, /**< new value of the parameter */
4793 SCIP_Bool initialize, /**< is this the initialization of the parameter? */
4794 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
4795 )
4796{
4797 assert(param != NULL);
4798
4799 /* check, if value is possible for the parameter and the parameter is not fixed */
4800 SCIP_CALL_QUIET( paramTestChar(param, messagehdlr, value) );
4801
4802 /* is the value of the parameter changed? */
4803 if( initialize || (param->data.charparam.valueptr != NULL && *param->data.charparam.valueptr != value)
4804 || (param->data.charparam.valueptr == NULL && param->data.charparam.curvalue != value) )
4805 {
4806 char oldvalue = '\0';
4807
4808 SCIP_CALL_QUIET( paramTestFixed(param, messagehdlr) );
4809
4810 if( !initialize )
4811 oldvalue = SCIPparamGetChar(param);
4812
4813 /* set the parameter's current value */
4814 if( param->data.charparam.valueptr != NULL )
4815 *param->data.charparam.valueptr = value;
4816 else
4817 param->data.charparam.curvalue = value;
4818
4819 /* call the parameter's change information method, unless initializing */
4820 if( !initialize && param->paramchgd != NULL && set != NULL )
4821 {
4822 SCIP_RETCODE retcode;
4823
4824 retcode = param->paramchgd(set->scip, param);
4825
4826 if( retcode == SCIP_PARAMETERWRONGVAL )
4827 {
4828 if( param->data.charparam.valueptr != NULL )
4829 *param->data.charparam.valueptr = oldvalue;
4830 else
4831 param->data.charparam.curvalue = oldvalue;
4832 }
4833 else
4834 {
4835 SCIP_CALL( retcode );
4836 }
4837 }
4838 }
4839
4840 if( !quiet )
4841 {
4842 SCIP_CALL( paramWrite(param, messagehdlr, NULL, FALSE, TRUE) );
4843 }
4844
4845 return SCIP_OKAY;
4846}
4847
4848/** sets value of string parameter */
4850 SCIP_PARAM* param, /**< parameter */
4851 SCIP_SET* set, /**< global SCIP settings, or NULL if param change method should not be called */
4852 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
4853 const char* value, /**< new value of the parameter */
4854 SCIP_Bool initialize, /**< is this the initialization of the parameter? */
4855 SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
4856 )
4857{
4858 char* oldvalue = NULL;
4859
4860 assert(param != NULL);
4861
4862 /* check if value is possible for the parameter and the parameter is not fixed */
4863 SCIP_CALL_QUIET( paramTestString(param, messagehdlr, value) );
4864 SCIP_CALL_QUIET( paramTestFixed(param, messagehdlr) );
4865
4866 /* set the parameter's current value */
4867 if( param->data.stringparam.valueptr != NULL )
4868 {
4869 if( !initialize )
4870 oldvalue = *param->data.stringparam.valueptr;
4871 SCIP_ALLOC( BMSduplicateMemoryArray(param->data.stringparam.valueptr, value, strlen(value)+1) );
4872 }
4873 else
4874 {
4875 if( !initialize )
4876 oldvalue = param->data.stringparam.curvalue;
4877 SCIP_ALLOC( BMSduplicateMemoryArray(&param->data.stringparam.curvalue, value, strlen(value)+1) );
4878 }
4879
4880 /* call the parameter's change information method, unless initializing */
4881 if( !initialize && param->paramchgd != NULL && set != NULL )
4882 {
4883 SCIP_RETCODE retcode;
4884
4885 retcode = param->paramchgd(set->scip, param);
4886
4887 if( retcode == SCIP_PARAMETERWRONGVAL )
4888 {
4889 if( param->data.stringparam.valueptr != NULL )
4890 {
4892 *param->data.stringparam.valueptr = oldvalue;
4893 }
4894 else
4895 {
4897 param->data.stringparam.curvalue = oldvalue;
4898 }
4899 }
4900 else
4901 {
4902 BMSfreeMemoryArrayNull(&oldvalue);
4903 SCIP_CALL( retcode );
4904 }
4905 }
4906 else
4907 {
4908 BMSfreeMemoryArrayNull(&oldvalue);
4909 }
4910
4911 if( !quiet )
4912 {
4913 SCIP_CALL( paramWrite(param, messagehdlr, NULL, FALSE, TRUE) );
4914 }
4915
4916 return SCIP_OKAY;
4917}
4918
4919/** changes default value of SCIP_Bool parameter */
4921 SCIP_PARAM* param, /**< parameter */
4922 SCIP_Bool defaultvalue /**< new default value */
4923 )
4924{
4925 assert(param != NULL);
4926 assert(param->paramtype == SCIP_PARAMTYPE_BOOL);
4927
4928 param->data.boolparam.defaultvalue = defaultvalue;
4929}
4930
4931/** changes default value of int parameter */
4933 SCIP_PARAM* param, /**< parameter */
4934 int defaultvalue /**< new default value */
4935 )
4936{
4937 assert(param != NULL);
4938 assert(param->paramtype == SCIP_PARAMTYPE_INT);
4939
4940 assert(param->data.intparam.minvalue <= defaultvalue && param->data.intparam.maxvalue >= defaultvalue);
4941
4942 param->data.intparam.defaultvalue = defaultvalue;
4943}
4944
4945/** sets default value of SCIP_Longint parameter */
4947 SCIP_PARAM* param, /**< parameter */
4948 SCIP_Longint defaultvalue /**< new default value */
4949 )
4950{
4951 assert(param != NULL);
4952 assert(param->paramtype == SCIP_PARAMTYPE_LONGINT);
4953
4954 assert(param->data.longintparam.minvalue <= defaultvalue && param->data.longintparam.maxvalue >= defaultvalue);
4955
4956 param->data.longintparam.defaultvalue = defaultvalue;
4957}
4958
4959/** sets default value of SCIP_Real parameter */
4961 SCIP_PARAM* param, /**< parameter */
4962 SCIP_Real defaultvalue /**< new default value */
4963 )
4964{
4965 assert(param != NULL);
4966 assert(param->paramtype == SCIP_PARAMTYPE_REAL);
4967
4968 assert(param->data.realparam.minvalue <= defaultvalue && param->data.realparam.maxvalue >= defaultvalue);
4969
4970 param->data.realparam.defaultvalue = defaultvalue;
4971}
4972
4973/** sets default value of char parameter */
4975 SCIP_PARAM* param, /**< parameter */
4976 char defaultvalue /**< new default value */
4977 )
4978{
4979 assert(param != NULL);
4980 assert(param->paramtype == SCIP_PARAMTYPE_CHAR);
4981
4982 param->data.charparam.defaultvalue = defaultvalue;
4983}
4984
4985/** sets default value of string parameter */
4987 SCIP_PARAM* param, /**< parameter */
4988 const char* defaultvalue /**< new default value */
4989 )
4990{
4991 assert(param != NULL);
4992 assert(param->paramtype == SCIP_PARAMTYPE_STRING);
4993
4995 SCIP_ALLOC_ABORT( BMSduplicateMemoryArray(&param->data.stringparam.defaultvalue, defaultvalue, strlen(defaultvalue)+1) );
4996}
4997
4998/** sets the parameter to its default setting */
5000 SCIP_PARAM* param, /**< parameter */
5001 SCIP_SET* set, /**< global SCIP settings */
5002 SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
5003 )
5004{
5005 assert(param != NULL);
5006
5007 /* do not change the parameter if it is fixed */
5008 if( SCIPparamIsFixed(param) )
5009 {
5010 SCIPsetDebugMsg(set, "parameter <%s> is fixed and is not reset to its default value.\n", param->name);
5011
5012 return SCIP_OKAY;
5013 }
5014
5015 switch( param->paramtype )
5016 {
5018 SCIP_CALL( SCIPparamSetBool(param, set, messagehdlr, SCIPparamGetBoolDefault(param), FALSE, TRUE) );
5019 break;
5020
5021 case SCIP_PARAMTYPE_INT:
5022 SCIP_CALL( SCIPparamSetInt(param, set, messagehdlr, SCIPparamGetIntDefault(param), FALSE, TRUE) );
5023 break;
5024
5026 SCIP_CALL( SCIPparamSetLongint(param, set, messagehdlr, SCIPparamGetLongintDefault(param), FALSE, TRUE) );
5027 break;
5028
5030 SCIP_CALL( SCIPparamSetReal(param, set, messagehdlr, SCIPparamGetRealDefault(param), FALSE, TRUE) );
5031 break;
5032
5034 SCIP_CALL( SCIPparamSetChar(param, set, messagehdlr, SCIPparamGetCharDefault(param), FALSE, TRUE) );
5035 break;
5036
5038 SCIP_CALL( SCIPparamSetString(param, set, messagehdlr, SCIPparamGetStringDefault(param), FALSE, TRUE) );
5039 break;
5040
5041 default:
5042 SCIPerrorMessage("unknown parameter type\n");
5043 return SCIP_INVALIDDATA;
5044 }
5045
5046 return SCIP_OKAY;
5047}
5048
5049/** writes a single parameter to a file */
5051 SCIP_PARAM* param, /**< parameter */
5052 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
5053 const char* filename, /**< file name, or NULL for stdout */
5054 SCIP_Bool comments, /**< should parameter descriptions be written as comments? */
5055 SCIP_Bool onlychanged /**< should only the parameters been written, that are changed from default? */
5056 )
5057{
5058 SCIP_RETCODE retcode;
5059 FILE* file;
5060
5061 assert(param != NULL);
5062
5063 /* open the file for writing */
5064 if( filename != NULL )
5065 {
5066 file = fopen(filename, "w");
5067 if( file == NULL )
5068 {
5069 SCIPerrorMessage("cannot open file <%s> for writing\n", filename);
5070 SCIPprintSysError(filename);
5071 return SCIP_FILECREATEERROR;
5072 }
5073 }
5074 else
5075 file = NULL;
5076
5077 /* write the parameter to the file */
5078 retcode = paramWrite(param, messagehdlr, file, comments, onlychanged);
5079
5080 /* close output file */
5081 if( filename != NULL )
5082 {
5083 assert(file != NULL); /*lint !e449*/
5084 fclose(file);
5085 }
5086
5087 SCIP_CALL( retcode );
5088
5089 return SCIP_OKAY;
5090}
SCIP_VAR * h
Definition: circlepacking.c:68
#define NULL
Definition: def.h:266
#define SCIP_MAXSTRLEN
Definition: def.h:287
#define SCIP_SUBVERSION
Definition: def.h:134
#define SCIP_Longint
Definition: def.h:157
#define SCIP_ALLOC_ABORT(x)
Definition: def.h:363
#define SCIP_REAL_MAX
Definition: def.h:173
#define SCIP_Bool
Definition: def.h:91
#define SCIP_CALL_QUIET(x)
Definition: def.h:348
#define MIN(x, y)
Definition: def.h:242
#define SCIP_ALLOC(x)
Definition: def.h:384
#define SCIP_Real
Definition: def.h:172
#define TRUE
Definition: def.h:93
#define FALSE
Definition: def.h:94
#define MAX(x, y)
Definition: def.h:238
#define SCIP_LONGINT_FORMAT
Definition: def.h:164
#define SCIP_HASHSIZE_PARAMS
Definition: def.h:297
#define SCIPABORT()
Definition: def.h:345
#define SCIP_REAL_MIN
Definition: def.h:174
#define EPSZ(x, eps)
Definition: def.h:202
#define SCIP_REAL_FORMAT
Definition: def.h:175
#define SCIP_CALL(x)
Definition: def.h:373
void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
Definition: misc.c:2349
SCIP_RETCODE SCIPhashtableSafeInsert(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2582
SCIP_RETCODE SCIPhashtableCreate(SCIP_HASHTABLE **hashtable, BMS_BLKMEM *blkmem, int tablesize, SCIP_DECL_HASHGETKEY((*hashgetkey)), SCIP_DECL_HASHKEYEQ((*hashkeyeq)), SCIP_DECL_HASHKEYVAL((*hashkeyval)), void *userptr)
Definition: misc.c:2299
void * SCIPhashtableRetrieve(SCIP_HASHTABLE *hashtable, void *key)
Definition: misc.c:2611
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4197
SCIP_HEUR ** SCIPgetHeurs(SCIP *scip)
Definition: scip_heur.c:271
SCIP_Bool SCIPheurUsesSubscip(SCIP_HEUR *heur)
Definition: heur.c:1504
int SCIPgetNHeurs(SCIP *scip)
Definition: scip_heur.c:282
const char * SCIPheurGetName(SCIP_HEUR *heur)
Definition: heur.c:1453
const char * SCIPpresolGetName(SCIP_PRESOL *presol)
Definition: presol.c:599
const char * SCIPpropGetName(SCIP_PROP *prop)
Definition: prop.c:941
const char * SCIPsepaGetName(SCIP_SEPA *sepa)
Definition: sepa.c:743
SCIP_Bool SCIPsepaUsesSubscip(SCIP_SEPA *sepa)
Definition: sepa.c:818
int SCIPstrcasecmp(const char *s1, const char *s2)
Definition: misc.c:10916
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10880
void SCIPprintSysError(const char *message)
Definition: misc.c:10772
static const char * paramname[]
Definition: lpi_msk.c:5096
#define BMSfreeMemory(ptr)
Definition: memory.h:145
#define BMSfreeBlockMemory(mem, ptr)
Definition: memory.h:465
#define BMSallocBlockMemory(mem, ptr)
Definition: memory.h:451
#define BMSreallocMemoryArray(ptr, num)
Definition: memory.h:127
#define BMSduplicateMemoryArray(ptr, source, num)
Definition: memory.h:143
#define BMSfreeMemoryArray(ptr)
Definition: memory.h:147
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:437
#define BMSfreeMemoryArrayNull(ptr)
Definition: memory.h:148
#define BMSallocMemory(ptr)
Definition: memory.h:118
void SCIPmessageFPrintInfo(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *formatstr,...)
Definition: message.c:618
void SCIPmessagehdlrSetQuiet(SCIP_MESSAGEHDLR *messagehdlr, SCIP_Bool quiet)
Definition: message.c:411
void SCIPmessagePrintWarning(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
Definition: message.c:427
SCIP_Bool SCIPmessagehdlrIsQuiet(SCIP_MESSAGEHDLR *messagehdlr)
Definition: message.c:910
SCIP_RETCODE SCIPparamsetGetBool(SCIP_PARAMSET *paramset, const char *name, SCIP_Bool *value)
Definition: paramset.c:1729
static SCIP_RETCODE paramParseReal(SCIP_PARAM *param, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, char *valuestr)
Definition: paramset.c:1329
SCIP_RETCODE SCIPparamsetCreate(SCIP_PARAMSET **paramset, BMS_BLKMEM *blkmem)
Definition: paramset.c:1426
SCIP_RETCODE SCIPparamsetSetDefaultString(SCIP_PARAMSET *paramset, const char *name, const char *defaultvalue)
Definition: paramset.c:2363
SCIP_RETCODE SCIPparamSetString(SCIP_PARAM *param, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, const char *value, SCIP_Bool initialize, SCIP_Bool quiet)
Definition: paramset.c:4849
static SCIP_RETCODE paramParseChar(SCIP_PARAM *param, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, char *valuestr)
Definition: paramset.c:1359
SCIP_RETCODE SCIPparamsetSetReal(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, const char *name, SCIP_Real value)
Definition: paramset.c:2047
SCIP_Bool SCIPparamIsDefault(SCIP_PARAM *param)
Definition: paramset.c:936
SCIP_RETCODE SCIPparamsetSetDefaultLongint(SCIP_PARAMSET *paramset, const char *name, SCIP_Longint defaultvalue)
Definition: paramset.c:2270
static SCIP_RETCODE paramsetSetSeparatingAggressive(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Bool quiet)
Definition: paramset.c:3549
void SCIPparamSetDefaultString(SCIP_PARAM *param, const char *defaultvalue)
Definition: paramset.c:4986
const char * SCIPparamGetName(SCIP_PARAM *param)
Definition: paramset.c:659
SCIP_Real SCIPparamGetRealMin(SCIP_PARAM *param)
Definition: paramset.c:842
char SCIPparamGetCharDefault(SCIP_PARAM *param)
Definition: paramset.c:900
static SCIP_RETCODE paramTestReal(SCIP_PARAM *param, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Real value)
Definition: paramset.c:154
SCIP_RETCODE SCIPparamsetGetString(SCIP_PARAMSET *paramset, const char *name, char **value)
Definition: paramset.c:1889
static SCIP_RETCODE paramsetSetPresolvingOff(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Bool quiet)
Definition: paramset.c:3391
SCIP_RETCODE SCIPparamSetLongint(SCIP_PARAM *param, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Longint value, SCIP_Bool initialize, SCIP_Bool quiet)
Definition: paramset.c:4662
SCIP_RETCODE SCIPparamWrite(SCIP_PARAM *param, SCIP_MESSAGEHDLR *messagehdlr, const char *filename, SCIP_Bool comments, SCIP_Bool onlychanged)
Definition: paramset.c:5050
SCIP_RETCODE SCIPparamSetReal(SCIP_PARAM *param, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Real value, SCIP_Bool initialize, SCIP_Bool quiet)
Definition: paramset.c:4724
int SCIPparamsetGetNParams(SCIP_PARAMSET *paramset)
Definition: paramset.c:4332
static SCIP_RETCODE paramCreateReal(SCIP_PARAM **param, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: paramset.c:1095
static SCIP_RETCODE paramParseBool(SCIP_PARAM *param, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, char *valuestr)
Definition: paramset.c:1238
#define NEXPENSIVEHEURFREQS
static SCIP_RETCODE paramsetSetSeparatingDefault(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Bool quiet)
Definition: paramset.c:3469
static SCIP_RETCODE paramSetChar(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, const char *paramname, char value, SCIP_Bool quiet)
Definition: paramset.c:380
static SCIP_RETCODE emphasisParse(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, char *line)
Definition: paramset.c:2395
void SCIPparamSetDefaultReal(SCIP_PARAM *param, SCIP_Real defaultvalue)
Definition: paramset.c:4960
static SCIP_RETCODE paramTestString(SCIP_PARAM *param, SCIP_MESSAGEHDLR *messagehdlr, const char *value)
Definition: paramset.c:213
SCIP_Bool SCIPparamIsValidInt(SCIP_PARAM *param, int value)
Definition: paramset.c:4461
SCIP_RETCODE SCIPparamsetSetInt(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, const char *name, int value)
Definition: paramset.c:1979
char * SCIPparamGetCharAllowedValues(SCIP_PARAM *param)
Definition: paramset.c:889
SCIP_RETCODE SCIPparamsetAddString(SCIP_PARAMSET *paramset, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, char **valueptr, SCIP_Bool isadvanced, const char *defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: paramset.c:1650
SCIP_PARAMDATA * SCIPparamGetData(SCIP_PARAM *param)
Definition: paramset.c:679
SCIP_RETCODE SCIPparamsetGetInt(SCIP_PARAMSET *paramset, const char *name, int *value)
Definition: paramset.c:1761
static SCIP_RETCODE paramCopyInt(SCIP_PARAM *sourceparam, SCIP_PARAM *targetparam, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr)
Definition: paramset.c:545
SCIP_Bool SCIPparamIsValidBool(SCIP_PARAM *param, SCIP_Bool value)
Definition: paramset.c:4451
static SCIP_DECL_HASHGETKEY(hashGetKeyParam)
Definition: paramset.c:58
void SCIPparamSetDefaultChar(SCIP_PARAM *param, char defaultvalue)
Definition: paramset.c:4974
static SCIP_RETCODE paramsetSetSeparatingFast(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Bool quiet)
Definition: paramset.c:3723
SCIP_Bool SCIPparamIsValidString(SCIP_PARAM *param, const char *value)
Definition: paramset.c:4520
static SCIP_RETCODE paramSetBool(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, const char *paramname, SCIP_Bool value, SCIP_Bool quiet)
Definition: paramset.c:344
static SCIP_RETCODE paramCreateString(SCIP_PARAM **param, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, char **valueptr, SCIP_Bool isadvanced, const char *defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: paramset.c:1164
SCIP_RETCODE SCIPparamsetGetLongint(SCIP_PARAMSET *paramset, const char *name, SCIP_Longint *value)
Definition: paramset.c:1793
static SCIP_RETCODE paramTestChar(SCIP_PARAM *param, SCIP_MESSAGEHDLR *messagehdlr, char value)
Definition: paramset.c:176
SCIP_Bool SCIPparamIsAdvanced(SCIP_PARAM *param)
Definition: paramset.c:689
static SCIP_RETCODE paramsetSetSeparatingOff(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Bool quiet)
Definition: paramset.c:3780
SCIP_RETCODE SCIPparamsetAddChar(SCIP_PARAMSET *paramset, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, char *valueptr, SCIP_Bool isadvanced, char defaultvalue, const char *allowedvalues, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: paramset.c:1621
SCIP_RETCODE SCIPparamsetSetPresolving(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: paramset.c:4255
SCIP_PARAMTYPE SCIPparamGetType(SCIP_PARAM *param)
Definition: paramset.c:649
static SCIP_RETCODE paramParseInt(SCIP_PARAM *param, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, char *valuestr)
Definition: paramset.c:1269
char * SCIPparamGetString(SCIP_PARAM *param)
Definition: paramset.c:911
static SCIP_RETCODE paramParseString(SCIP_PARAM *param, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, char *valuestr)
Definition: paramset.c:1389
int SCIPparamGetIntMin(SCIP_PARAM *param)
Definition: paramset.c:748
void SCIPparamSetFixed(SCIP_PARAM *param, SCIP_Bool fixed)
Definition: paramset.c:4440
void SCIPparamsetFree(SCIP_PARAMSET **paramset, BMS_BLKMEM *blkmem)
Definition: paramset.c:1446
SCIP_RETCODE SCIPparamSetToDefault(SCIP_PARAM *param, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr)
Definition: paramset.c:4999
SCIP_Longint SCIPparamGetLongintMin(SCIP_PARAM *param)
Definition: paramset.c:795
static SCIP_RETCODE paramsetAdd(SCIP_PARAMSET *paramset, SCIP_PARAM *param)
Definition: paramset.c:1476
static const char * paramtypeGetName(SCIP_PARAMTYPE paramtype)
Definition: paramset.c:1678
SCIP_RETCODE SCIPparamsetAddInt(SCIP_PARAMSET *paramset, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: paramset.c:1531
SCIP_PARAM * SCIPparamsetGetParam(SCIP_PARAMSET *paramset, const char *name)
Definition: paramset.c:1717
SCIP_RETCODE SCIPparamsetRead(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, const char *filename)
Definition: paramset.c:2665
static SCIP_RETCODE paramCreateLongint(SCIP_PARAM **param, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, SCIP_Longint *valueptr, SCIP_Bool isadvanced, SCIP_Longint defaultvalue, SCIP_Longint minvalue, SCIP_Longint maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: paramset.c:1062
SCIP_RETCODE SCIPparamsetSetChar(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, const char *name, char value)
Definition: paramset.c:2081
static SCIP_RETCODE paramsetSetHeuristicsOff(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Bool quiet)
Definition: paramset.c:3077
static SCIP_RETCODE paramSetInt(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, const char *paramname, int value, SCIP_Bool quiet)
Definition: paramset.c:416
SCIP_RETCODE SCIPparamsetSetDefaultChar(SCIP_PARAMSET *paramset, const char *name, char defaultvalue)
Definition: paramset.c:2332
SCIP_Bool SCIPparamGetBool(SCIP_PARAM *param)
Definition: paramset.c:709
const char * SCIPparamGetDesc(SCIP_PARAM *param)
Definition: paramset.c:669
SCIP_RETCODE SCIPparamsetSetDefaultBool(SCIP_PARAMSET *paramset, const char *name, SCIP_Bool defaultvalue)
Definition: paramset.c:2208
static SCIP_RETCODE paramTestLongint(SCIP_PARAM *param, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Longint value)
Definition: paramset.c:132
SCIP_Bool SCIPparamIsValidLongint(SCIP_PARAM *param, SCIP_Longint value)
Definition: paramset.c:4472
void SCIPparamSetDefaultBool(SCIP_PARAM *param, SCIP_Bool defaultvalue)
Definition: paramset.c:4920
SCIP_RETCODE SCIPparamsetGetChar(SCIP_PARAMSET *paramset, const char *name, char *value)
Definition: paramset.c:1857
int SCIPparamGetInt(SCIP_PARAM *param)
Definition: paramset.c:734
static SCIP_RETCODE paramCreateBool(SCIP_PARAM **param, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: paramset.c:1000
SCIP_Bool SCIPparamGetBoolDefault(SCIP_PARAM *param)
Definition: paramset.c:723
SCIP_RETCODE SCIPparamsetSetToSubscipsOff(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Bool quiet)
Definition: paramset.c:4114
SCIP_RETCODE SCIPparamsetSetToDefaults(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr)
Definition: paramset.c:2798
static SCIP_RETCODE paramsetSetHeuristicsFast(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Bool quiet)
Definition: paramset.c:3022
SCIP_Bool SCIPparamIsValidReal(SCIP_PARAM *param, SCIP_Real value)
Definition: paramset.c:4483
int SCIPparamGetIntMax(SCIP_PARAM *param)
Definition: paramset.c:759
SCIP_Real SCIPparamGetReal(SCIP_PARAM *param)
Definition: paramset.c:828
SCIP_Bool SCIPparamsetIsFixed(SCIP_PARAMSET *paramset, const char *name)
Definition: paramset.c:1695
int SCIPparamGetIntDefault(SCIP_PARAM *param)
Definition: paramset.c:770
void SCIPparamSetDefaultLongint(SCIP_PARAM *param, SCIP_Longint defaultvalue)
Definition: paramset.c:4946
SCIP_RETCODE SCIPparamsetAddBool(SCIP_PARAMSET *paramset, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: paramset.c:1504
char SCIPparamGetChar(SCIP_PARAM *param)
Definition: paramset.c:875
SCIP_Longint SCIPparamGetLongint(SCIP_PARAM *param)
Definition: paramset.c:781
SCIP_Longint SCIPparamGetLongintMax(SCIP_PARAM *param)
Definition: paramset.c:806
SCIP_RETCODE SCIPparamsetWrite(SCIP_PARAMSET *paramset, SCIP_MESSAGEHDLR *messagehdlr, const char *filename, SCIP_Bool comments, SCIP_Bool onlychanged)
Definition: paramset.c:2715
SCIP_Real SCIPparamGetRealMax(SCIP_PARAM *param)
Definition: paramset.c:853
SCIP_RETCODE SCIPparamsetSetString(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, const char *name, const char *value)
Definition: paramset.c:2115
SCIP_RETCODE SCIPparamsetSetToDefault(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, const char *paramname)
Definition: paramset.c:2816
static SCIP_RETCODE paramTestInt(SCIP_PARAM *param, SCIP_MESSAGEHDLR *messagehdlr, int value)
Definition: paramset.c:110
SCIP_RETCODE SCIPparamsetSetDefaultInt(SCIP_PARAMSET *paramset, const char *name, int defaultvalue)
Definition: paramset.c:2239
SCIP_RETCODE SCIPparamsetSetDefaultReal(SCIP_PARAMSET *paramset, const char *name, SCIP_Real defaultvalue)
Definition: paramset.c:2301
SCIP_RETCODE SCIPparamsetAddReal(SCIP_PARAMSET *paramset, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: paramset.c:1591
static SCIP_RETCODE paramTestBool(SCIP_PARAM *param, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Bool value)
Definition: paramset.c:89
SCIP_RETCODE SCIPparamsetCopyParams(SCIP_PARAMSET *sourceparamset, SCIP_PARAMSET *targetparamset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr)
Definition: paramset.c:4346
SCIP_RETCODE SCIPparamSetBool(SCIP_PARAM *param, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Bool value, SCIP_Bool initialize, SCIP_Bool quiet)
Definition: paramset.c:4538
void SCIPparamSetDefaultInt(SCIP_PARAM *param, int defaultvalue)
Definition: paramset.c:4932
SCIP_RETCODE SCIPparamsetSetHeuristics(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: paramset.c:4219
SCIP_RETCODE SCIPparamsetSetSeparating(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: paramset.c:4291
SCIP_RETCODE SCIPparamsetSetLongint(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, const char *name, SCIP_Longint value)
Definition: paramset.c:2013
SCIP_RETCODE SCIPparamsetSetEmphasis(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_PARAMEMPHASIS paramemphasis, SCIP_Bool quiet)
Definition: paramset.c:3843
SCIP_RETCODE SCIPparamsetGetReal(SCIP_PARAMSET *paramset, const char *name, SCIP_Real *value)
Definition: paramset.c:1825
static SCIP_RETCODE paramsetSetPresolvingFast(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Bool quiet)
Definition: paramset.c:3276
SCIP_PARAM ** SCIPparamsetGetParams(SCIP_PARAMSET *paramset)
Definition: paramset.c:4322
static SCIP_RETCODE paramCreate(SCIP_PARAM **param, BMS_BLKMEM *blkmem, const char *name, const char *desc, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata, SCIP_Bool isadvanced)
Definition: paramset.c:971
static SCIP_RETCODE paramCopyBool(SCIP_PARAM *sourceparam, SCIP_PARAM *targetparam, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr)
Definition: paramset.c:524
static SCIP_RETCODE paramCopyReal(SCIP_PARAM *sourceparam, SCIP_PARAM *targetparam, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr)
Definition: paramset.c:587
static SCIP_RETCODE paramSetLongint(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, const char *paramname, SCIP_Longint value, SCIP_Bool quiet)
Definition: paramset.c:452
SCIP_Bool SCIPparamIsValidChar(SCIP_PARAM *param, const char value)
Definition: paramset.c:4494
static SCIP_RETCODE paramCopyLongint(SCIP_PARAM *sourceparam, SCIP_PARAM *targetparam, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr)
Definition: paramset.c:566
static SCIP_RETCODE paramTestFixed(SCIP_PARAM *param, SCIP_MESSAGEHDLR *messagehdlr)
Definition: paramset.c:70
SCIP_RETCODE SCIPparamsetSet(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, const char *name, const char *value, SCIP_Bool fix)
Definition: paramset.c:2149
static SCIP_RETCODE paramsetSetHeuristicsAggressive(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Bool quiet)
Definition: paramset.c:2888
SCIP_RETCODE SCIPparamsetAddLongint(SCIP_PARAMSET *paramset, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, SCIP_Longint *valueptr, SCIP_Bool isadvanced, SCIP_Longint defaultvalue, SCIP_Longint minvalue, SCIP_Longint maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: paramset.c:1561
SCIP_Longint SCIPparamGetLongintDefault(SCIP_PARAM *param)
Definition: paramset.c:817
static SCIP_RETCODE paramsetParse(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, char *line, SCIP_Bool *foundnormalparam)
Definition: paramset.c:2548
SCIP_RETCODE SCIPparamsetFix(SCIP_PARAMSET *paramset, const char *name, SCIP_Bool fixed)
Definition: paramset.c:1921
static void paramFree(SCIP_PARAM **param, BMS_BLKMEM *blkmem)
Definition: paramset.c:1196
SCIP_RETCODE SCIPparamSetChar(SCIP_PARAM *param, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, char value, SCIP_Bool initialize, SCIP_Bool quiet)
Definition: paramset.c:4788
SCIP_Real SCIPparamGetRealDefault(SCIP_PARAM *param)
Definition: paramset.c:864
static SCIP_RETCODE paramParseLongint(SCIP_PARAM *param, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, char *valuestr)
Definition: paramset.c:1299
static SCIP_RETCODE paramCopyChar(SCIP_PARAM *sourceparam, SCIP_PARAM *targetparam, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr)
Definition: paramset.c:608
static SCIP_RETCODE paramCreateInt(SCIP_PARAM **param, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: paramset.c:1029
static SCIP_RETCODE paramCreateChar(SCIP_PARAM **param, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, char *valueptr, SCIP_Bool isadvanced, char defaultvalue, const char *allowedvalues, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: paramset.c:1128
static SCIP_RETCODE paramsetSetPresolvingAggressive(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Bool quiet)
Definition: paramset.c:3200
SCIP_RETCODE SCIPparamsetSetBool(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, const char *name, SCIP_Bool value)
Definition: paramset.c:1945
SCIP_RETCODE SCIPparamSetInt(SCIP_PARAM *param, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, int value, SCIP_Bool initialize, SCIP_Bool quiet)
Definition: paramset.c:4600
static SCIP_RETCODE paramSetReal(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, const char *paramname, SCIP_Real value, SCIP_Bool quiet)
Definition: paramset.c:488
static SCIP_RETCODE paramCopyString(SCIP_PARAM *sourceparam, SCIP_PARAM *targetparam, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr)
Definition: paramset.c:629
SCIP_Bool SCIPparamIsFixed(SCIP_PARAM *param)
Definition: paramset.c:699
static SCIP_RETCODE paramsetSetHeuristicsDefault(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Bool quiet)
Definition: paramset.c:2840
static SCIP_RETCODE paramsetSetPresolvingDefault(SCIP_PARAMSET *paramset, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Bool quiet)
Definition: paramset.c:3115
static SCIP_RETCODE paramWrite(SCIP_PARAM *param, SCIP_MESSAGEHDLR *messagehdlr, FILE *file, SCIP_Bool comments, SCIP_Bool onlychanged)
Definition: paramset.c:245
char * SCIPparamGetStringDefault(SCIP_PARAM *param)
Definition: paramset.c:925
internal methods for handling parameter settings
#define SCIPerrorMessage
Definition: pub_message.h:64
SCIP callable library.
SCIP_RETCODE SCIPsetSetSeparating(SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: set.c:3625
SCIP_RETCODE SCIPsetSetHeuristics(SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: set.c:3589
SCIP_RETCODE SCIPsetSetReoptimizationParams(SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr)
Definition: set.c:737
SCIP_Real SCIPsetCeil(SCIP_SET *set, SCIP_Real val)
Definition: set.c:6397
SCIP_HEUR * SCIPsetFindHeur(SCIP_SET *set, const char *name)
Definition: set.c:4605
SCIP_Bool SCIPsetIsParamFixed(SCIP_SET *set, const char *name)
Definition: set.c:3101
SCIP_CONSHDLR * SCIPsetFindConshdlr(SCIP_SET *set, const char *name)
Definition: set.c:3985
SCIP_RETCODE SCIPsetChgParamFixed(SCIP_SET *set, const char *name, SCIP_Bool fixed)
Definition: set.c:3207
SCIP_RETCODE SCIPsetSetPresolving(SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: set.c:3607
SCIP_SEPA * SCIPsetFindSepa(SCIP_SET *set, const char *name)
Definition: set.c:4250
SCIP_PROP * SCIPsetFindProp(SCIP_SET *set, const char *name)
Definition: set.c:4385
SCIP_PRESOL * SCIPsetFindPresol(SCIP_SET *set, const char *name)
Definition: set.c:4102
internal methods for global SCIP settings
#define SCIPsetDebugMsg
Definition: set.h:1784
SCIP_Bool defaultvalue
SCIP_Bool curvalue
SCIP_Bool * valueptr
SCIP_Longint * valueptr
SCIP_Longint curvalue
SCIP_Longint defaultvalue
SCIP_Longint minvalue
SCIP_Longint maxvalue
SCIP_PARAM ** params
SCIP_HASHTABLE * hashtable
SCIP_PARAMTYPE paramtype
SCIP_INTPARAM intparam
SCIP_STRINGPARAM stringparam
SCIP_LONGINTPARAM longintparam
SCIP_BOOLPARAM boolparam
unsigned int isfixed
SCIP_CHARPARAM charparam
SCIP_REALPARAM realparam
union SCIP_Param::@17 data
SCIP_PARAMDATA * paramdata
unsigned int isadvanced
SCIP_Real defaultvalue
SCIP_Real * valueptr
SCIP_Real curvalue
SCIP_Real maxvalue
SCIP_Real minvalue
datastructures for handling parameter settings
Definition: heur_padm.c:135
@ SCIP_PARAMSETTING_OFF
Definition: type_paramset.h:63
@ SCIP_PARAMSETTING_AGGRESSIVE
Definition: type_paramset.h:61
@ SCIP_PARAMSETTING_DEFAULT
Definition: type_paramset.h:59
@ SCIP_PARAMSETTING_FAST
Definition: type_paramset.h:62
@ SCIP_PARAMEMPHASIS_DEFAULT
Definition: type_paramset.h:70
@ SCIP_PARAMEMPHASIS_NUMERICS
Definition: type_paramset.h:81
@ SCIP_PARAMEMPHASIS_PHASEIMPROVE
Definition: type_paramset.h:79
@ SCIP_PARAMEMPHASIS_CPSOLVER
Definition: type_paramset.h:72
@ SCIP_PARAMEMPHASIS_HARDLP
Definition: type_paramset.h:75
@ SCIP_PARAMEMPHASIS_FEASIBILITY
Definition: type_paramset.h:74
@ SCIP_PARAMEMPHASIS_BENCHMARK
Definition: type_paramset.h:82
@ SCIP_PARAMEMPHASIS_PHASEPROOF
Definition: type_paramset.h:80
@ SCIP_PARAMEMPHASIS_EASYCIP
Definition: type_paramset.h:73
@ SCIP_PARAMEMPHASIS_PHASEFEAS
Definition: type_paramset.h:78
@ SCIP_PARAMEMPHASIS_COUNTER
Definition: type_paramset.h:77
@ SCIP_PARAMEMPHASIS_OPTIMALITY
Definition: type_paramset.h:76
enum SCIP_ParamSetting SCIP_PARAMSETTING
Definition: type_paramset.h:65
struct SCIP_ParamData SCIP_PARAMDATA
Definition: type_paramset.h:87
enum SCIP_ParamEmphasis SCIP_PARAMEMPHASIS
Definition: type_paramset.h:84
enum SCIP_ParamType SCIP_PARAMTYPE
Definition: type_paramset.h:54
#define SCIP_DECL_PARAMCHGD(x)
@ SCIP_PARAMTYPE_CHAR
Definition: type_paramset.h:51
@ SCIP_PARAMTYPE_STRING
Definition: type_paramset.h:52
@ SCIP_PARAMTYPE_BOOL
Definition: type_paramset.h:47
@ SCIP_PARAMTYPE_INT
Definition: type_paramset.h:48
@ SCIP_PARAMTYPE_LONGINT
Definition: type_paramset.h:49
@ SCIP_PARAMTYPE_REAL
Definition: type_paramset.h:50
@ SCIP_FILECREATEERROR
Definition: type_retcode.h:48
@ SCIP_NOFILE
Definition: type_retcode.h:47
@ SCIP_READERROR
Definition: type_retcode.h:45
@ SCIP_INVALIDDATA
Definition: type_retcode.h:52
@ SCIP_PARAMETERUNKNOWN
Definition: type_retcode.h:55
@ SCIP_PARAMETERWRONGVAL
Definition: type_retcode.h:57
@ SCIP_PARAMETERWRONGTYPE
Definition: type_retcode.h:56
@ SCIP_OKAY
Definition: type_retcode.h:42
@ SCIP_INVALIDCALL
Definition: type_retcode.h:51
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63