Scippy

SCIP

Solving Constraint Integer Programs

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