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