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