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