Scippy

UG

Ubiquity Generator framework

paraParamSet.cpp
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and software framework */
4/* UG --- Ubquity Generator Framework */
5/* */
6/* Copyright Written by Yuji Shinano <shinano@zib.de>, */
7/* Copyright (C) 2021-2024 by Zuse Institute Berlin, */
8/* licensed under LGPL version 3 or later. */
9/* Commercial licenses are available through <licenses@zib.de> */
10/* */
11/* This code is free software; you can redistribute it and/or */
12/* modify it under the terms of the GNU Lesser General Public License */
13/* as published by the Free Software Foundation; either version 3 */
14/* of the License, or (at your option) any later version. */
15/* */
16/* This program is distributed in the hope that it will be useful, */
17/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
18/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
19/* GNU Lesser General Public License for more details. */
20/* */
21/* You should have received a copy of the GNU Lesser General Public License */
22/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
23/* */
24/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
25
26/**@file paraParamSet.cpp
27 * @brief Parameter set for UG framework.
28 * @author Yuji Shinano
29 *
30 *
31 *
32 */
33
34/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35
36
37#include <string>
38#include <map>
39#include <cstdio>
40#include <cstring>
41#include <fstream>
42#include <cfloat>
43#include <climits>
44#include <cassert>
45#include "paraComm.h"
46#include "paraParamSet.h"
47
48using namespace UG;
49
50ParaParamSet::ParaParamSet(
51 size_t nInParaParams
52 )
53 : nParaParams(nInParaParams)
54{
56 for(size_t i = 0; i < nParaParams; i++ )
57 {
58 paraParams[i] = 0;
59 }
60
61 /** bool params */
63 "Quiet",
64 "# Set log output to minimal information [Default value: TRUE]",
65 true);
67 "TagTrace",
68 "# Control log output of communication tags [Default value: FALSE]",
69 false);
71 "LogSolvingStatus",
72 "# Control of solving status log [Default value: FALSE]",
73 false);
75 "LogTasksTransfer",
76 "# Control output of tasks transfer log [Default value: FALSE]",
77 false);
79 "Checkpoint",
80 "# Control checkpointing functionality [Default value: FALSE]",
81 false);
83 "Deterministic",
84 "# Control deterministic mode [Default value: FALSE]",
85 false);
87 "StatisticsToStdout",
88 "# Control output of statistics to stdout [Default value: FALSE]",
89 false);
91 "DynamicAdjustNotificationInterval",
92 "# Control dynamic adjustment of notification interval time [Default value: FALSE]",
93 false);
94
95 /** int params */
97 "OutputParaParams",
98 "# Control output of ParaParams: 0 - no output, 1 - output only non-default values, 2 - output non-default values with comments, 3 - output all values, 4 - output all values with comments [Default value: 4]",
99 4,
100 0,
101 4);
103 "NotificationSynchronization",
104 "# Set notification synchronization strategy: 0 - always synchronize, 1 - collect in every iteration, 2 - no synchronization [Default value: 0]",
105 0,
106 0,
107 2);
108
109 /** longint params */
110
111 /** real params */
113 "NotificationInterval",
114 "# Set interval between notifications from active solver of its solvers status to LoadCoordinator. [Default: 1.0][0.0, DBL_MAX]",
115 1.0,
116 0.0,
117 DBL_MAX);
119 "TimeLimit",
120 "# Time limit for computation. -1.0 means no time limit. [Default: -1.0] [-1.0, DBL_MAX]",
121 -1.0,
122 -1.0,
123 DBL_MAX);
125 "CheckpointInterval",
126 "# Time interval between checkpoints. [Default: 3600.0] [5.0, DBL_MAX]",
127 3600.0,
128 5.0,
129 DBL_MAX);
131 "FinalCheckpointGeneratingTime",
132 "# Time until start of generation of final checkpointing files. When this parameter is specified, TimeLimit is ignored. -1.0 means no specification. [Default: -1.0] [-1.0, DBL_MAX]",
133 -1.0,
134 -1.0,
135 DBL_MAX);
136
137 /** char params */
138
139 /** string params */
141 "TempFilePath",
142 "# Path for temporary files [Default: /tmp/]",
143 "/tmp/");
145 "TagTraceFileName",
146 "# Filename for tag trace log [Default: std::cout]",
147 "std::cout");
149 "LogSolvingStatusFilePath",
150 "# Path to solving statuses log [Default: ./]",
151 "./");
153 "LogTasksTransferFilePath",
154 "# Path to tasks transfer log [Default: ./]",
155 "./");
157 "SolutionFilePath",
158 "# Path to output solution [Default: ./]",
159 "./");
161 "CheckpointFilePath",
162 "# Path to checkpoint files [Default: ./]",
163 "./");
165 "RacingParamsDirPath",
166 "# Path racing parameter configuration files. \"\" means to use default racing set. [Default: \"\"]",
167 "");
168}
169
170/*********************
171 * for bool params *
172 ********************/
173bool
175 int param
176 )
177{
178 assert(paraParams[param]->getType() == ParaParamTypeBool);
179 ParaParamBool *paraParamBool = dynamic_cast< ParaParamBool *>(paraParams[param]);
180 return paraParamBool->getValue();
181}
182
183void
185 int param,
186 bool value
187 )
188{
189 assert(paraParams[param]->getType() == ParaParamTypeBool);
190 ParaParamBool *paraParamBool = dynamic_cast< ParaParamBool *>(paraParams[param]);
191 return paraParamBool->setValue(value);
192}
193
194bool
196 int param
197 )
198{
199 assert(paraParams[param]->getType() == ParaParamTypeBool);
200 ParaParamBool *paraParamBool = dynamic_cast< ParaParamBool *>(paraParams[param]);
201 return paraParamBool->getDefaultValue();
202}
203
204void
206 int param
207 )
208{
209 assert(paraParams[param]->getType() == ParaParamTypeBool);
210 ParaParamBool *paraParamBool = dynamic_cast< ParaParamBool *>(paraParams[param]);
211 return paraParamBool->setDefaultValue();
212}
213
214bool
216 int param
217 )
218{
219 assert(paraParams[param]->getType() == ParaParamTypeBool);
220 ParaParamBool *paraParamBool = dynamic_cast< ParaParamBool *>(paraParams[param]);
221 return paraParamBool->isDefaultValue();
222}
223
224/********************
225 * for int params *
226 *******************/
227int
229 int param
230 )
231{
232 assert(paraParams[param]->getType() == ParaParamTypeInt);
233 ParaParamInt *paraParamInt = dynamic_cast< ParaParamInt *>(paraParams[param]);
234 return paraParamInt->getValue();
235}
236
237void
239 int param,
240 int value
241 )
242{
243 assert(paraParams[param]->getType() == ParaParamTypeInt);
244 ParaParamInt *paraParamInt = dynamic_cast< ParaParamInt *>(paraParams[param]);
245 return paraParamInt->setValue(value);
246}
247
248int
250 int param
251 )
252{
253 assert(paraParams[param]->getType() == ParaParamTypeInt);
254 ParaParamInt *paraParamInt = dynamic_cast< ParaParamInt *>(paraParams[param]);
255 return paraParamInt->getDefaultValue();
256}
257
258void
260 int param
261 )
262{
263 assert(paraParams[param]->getType() == ParaParamTypeInt);
264 ParaParamInt *paraParamInt = dynamic_cast< ParaParamInt *>(paraParams[param]);
265 paraParamInt->setDefaultValue();
266}
267
268bool
270 int param
271 )
272{
273 assert(paraParams[param]->getType() == ParaParamTypeInt);
274 ParaParamInt *paraParamInt = dynamic_cast< ParaParamInt *>(paraParams[param]);
275 return paraParamInt->isDefaultValue();
276}
277
278/*********************
279 * for longint params *
280 ********************/
281long long
283 int param
284 )
285{
286 assert(paraParams[param]->getType() == ParaParamTypeLongint);
287 ParaParamLongint *paraParamLongint = dynamic_cast< ParaParamLongint *>(paraParams[param]);
288 return paraParamLongint->getValue();
289}
290
291void
293 int param,
294 long long value
295 )
296{
297 assert(paraParams[param]->getType() == ParaParamTypeLongint);
298 ParaParamLongint *paraParamLongint = dynamic_cast< ParaParamLongint *>(paraParams[param]);
299 paraParamLongint->setValue(value);
300}
301
302long long
304 int param
305 )
306{
307 assert(paraParams[param]->getType() == ParaParamTypeLongint);
308 ParaParamLongint *paraParamLongint = dynamic_cast< ParaParamLongint *>(paraParams[param]);
309 return paraParamLongint->getDefaultValue();
310}
311
312void
314 int param
315 )
316{
317 assert(paraParams[param]->getType() == ParaParamTypeLongint);
318 ParaParamLongint *paraParamLongint = dynamic_cast< ParaParamLongint *>(paraParams[param]);
319 paraParamLongint->setDefaultValue();
320}
321
322bool
324 int param
325 )
326{
327 assert(paraParams[param]->getType() == ParaParamTypeLongint);
328 ParaParamLongint *paraParamLongint = dynamic_cast< ParaParamLongint *>(paraParams[param]);
329 return paraParamLongint->isDefaultValue();
330}
331
332/*********************
333 * for real params *
334 ********************/
335double
337 int param
338 )
339{
340 assert(paraParams[param]->getType() == ParaParamTypeReal);
341 ParaParamReal *paraParamReal = dynamic_cast< ParaParamReal *>(paraParams[param]);
342 return paraParamReal->getValue();
343}
344
345void
347 int param,
348 double value
349 )
350{
351 assert(paraParams[param]->getType() == ParaParamTypeReal);
352 ParaParamReal *paraParamReal = dynamic_cast< ParaParamReal *>(paraParams[param]);
353 paraParamReal->setValue(value);
354}
355
356double
358 int param
359 )
360{
361 assert(paraParams[param]->getType() == ParaParamTypeReal);
362 ParaParamReal *paraParamReal = dynamic_cast< ParaParamReal *>(paraParams[param]);
363 return paraParamReal->getDefaultValue();
364}
365
366void
368 int param
369 )
370{
371 assert(paraParams[param]->getType() == ParaParamTypeReal);
372 ParaParamReal *paraParamReal = dynamic_cast< ParaParamReal *>(paraParams[param]);
373 paraParamReal->setDefaultValue();
374}
375
376bool
378 int param
379 )
380{
381 assert(paraParams[param]->getType() == ParaParamTypeReal);
382 ParaParamReal *paraParamReal = dynamic_cast< ParaParamReal *>(paraParams[param]);
383 return paraParamReal->isDefaultValue();
384}
385
386/*********************
387 * for char params *
388 ********************/
389char
391 int param
392 )
393{
394 assert(paraParams[param]->getType() == ParaParamTypeChar);
395 ParaParamChar *paraParamChar = dynamic_cast< ParaParamChar *>(paraParams[param]);
396 return paraParamChar->getValue();
397}
398
399void
401 int param,
402 char value
403 )
404{
405 assert(paraParams[param]->getType() == ParaParamTypeChar);
406 ParaParamChar *paraParamChar = dynamic_cast< ParaParamChar *>(paraParams[param]);
407 paraParamChar->setValue(value);
408}
409
410char
412 int param
413 )
414{
415 assert(paraParams[param]->getType() == ParaParamTypeChar);
416 ParaParamChar *paraParamChar = dynamic_cast< ParaParamChar *>(paraParams[param]);
417 return paraParamChar->getDefaultValue();
418}
419
420void
422 int param
423 )
424{
425 assert(paraParams[param]->getType() == ParaParamTypeChar);
426 ParaParamChar *paraParamChar = dynamic_cast< ParaParamChar *>(paraParams[param]);
427 paraParamChar->setDefaultValue();
428}
429
430bool
432 int param
433 )
434{
435 assert(paraParams[param]->getType() == ParaParamTypeChar);
436 ParaParamChar *paraParamChar = dynamic_cast< ParaParamChar *>(paraParams[param]);
437 return paraParamChar->isDefaultValue();
438}
439
440/**********************
441 * for string params *
442 *********************/
443const char *
445 int param
446 )
447{
448 assert(paraParams[param]->getType() == ParaParamTypeString);
449 ParaParamString *paraParamString = dynamic_cast< ParaParamString *>(paraParams[param]);
450 return paraParamString->getValue();
451}
452
453void
455 int param,
456 const char *value
457 )
458{
459 assert(paraParams[param]->getType() == ParaParamTypeString);
460 ParaParamString *paraParamString = dynamic_cast< ParaParamString *>(paraParams[param]);
461 char *str = new char[std::strlen(value) + 1];
462 std::strcpy(str, value);
463 paraParamString->setValue(value);
464}
465
466const char *
468 int param
469 )
470{
471 assert(paraParams[param]->getType() == ParaParamTypeString);
472 ParaParamString *paraParamString = dynamic_cast< ParaParamString *>(paraParams[param]);
473 return paraParamString->getDefaultValue();
474}
475
476void
478 int param
479 )
480{
481 assert(paraParams[param]->getType() == ParaParamTypeString);
482 ParaParamString *paraParamString = dynamic_cast< ParaParamString *>(paraParams[param]);
483 paraParamString->setDefaultValue();
484}
485
486bool
488 int param
489 )
490{
491 assert(paraParams[param]->getType() == ParaParamTypeString);
492 ParaParamString *paraParamString = dynamic_cast< ParaParamString *>(paraParams[param]);
493 return paraParamString->isDefaultValue();
494}
495
496int
498 ParaParam *paraParam,
499 char *valuestr
500 )
501{
502 ParaParamBool *paraParamBool = dynamic_cast< ParaParamBool * >(paraParam);
503 assert(valuestr != NULL);
504 if( std::string(valuestr) == std::string("TRUE") )
505 {
506 paraParamBool->setValue(true);
507 }
508 else if( std::string(valuestr) == std::string("FALSE") )
509 {
510 paraParamBool->setValue(false);
511 }
512 else
513 {
514 std::cout << "Invalid parameter value <" << valuestr
515 << "> for ParaParam_Bool parameter <"
516 << paraParamBool->getParamName() << ">" << std::endl;
517 return -1;
518 }
519 return 0;
520}
521
522int
524 ParaParam *paraParam,
525 char *valuestr
526 )
527{
528 int value;
529 ParaParamInt *paraParamInt = dynamic_cast< ParaParamInt * >(paraParam);
530 assert(valuestr != NULL);
531 if( std::sscanf(valuestr, "%d", &value) == 1 )
532 {
533 if( value >= paraParamInt->getMinValue() && value <= paraParamInt->getMaxValue() )
534 {
535 paraParamInt->setValue(value);
536 }
537 else
538 {
539 OUTPUT_PARAM_VALUE_ERROR("Int", paraParamInt->getParamName(), value, paraParamInt->getComment() );
540 }
541 }
542 else
543 {
544 std::cout << "Invalid parameter value <" << valuestr
545 << "> for int parameter <"
546 << paraParamInt->getParamName() << ">" << std::endl;
547 return -1;
548 }
549 return 0;
550}
551
552int
554 ParaParam *paraParam,
555 char *valuestr
556 )
557{
558 long long value;
559 ParaParamLongint *paraParamLongint = dynamic_cast< ParaParamLongint * >(paraParam);
560 assert(valuestr != NULL);
561 if( std::sscanf(valuestr, "%lld", &value) == 1 )
562 {
563 if( value >= paraParamLongint->getMinValue() && value <= paraParamLongint->getMaxValue() )
564 {
565 paraParamLongint->setValue(value);
566 }
567 else
568 {
569 OUTPUT_PARAM_VALUE_ERROR("Longint", paraParamLongint->getParamName(), value, paraParamLongint->getComment() );
570 }
571 }
572 else
573 {
574 std::cout << "Invalid parameter value <" << valuestr
575 << "> for longint parameter <"
576 << paraParamLongint->getParamName() << ">" << std::endl;
577 return -1;
578 }
579 return 0;
580}
581
582int
584 ParaParam *paraParam,
585 char *valuestr
586 )
587{
588 double value;
589 ParaParamReal *paraParamReal = dynamic_cast< ParaParamReal * >(paraParam);
590 assert(valuestr != NULL);
591 if( std::sscanf(valuestr, "%lf", &value) == 1 )
592 {
593 if( value >= paraParamReal->getMinValue() && value <= paraParamReal->getMaxValue() )
594 {
595 paraParamReal->setValue(value);
596 }
597 else
598 {
599 OUTPUT_PARAM_VALUE_ERROR("Real", paraParamReal->getParamName(), value, paraParamReal->getComment() );
600 }
601 }
602 else
603 {
604 std::cout << "Invalid parameter value <" << valuestr
605 << "> for real parameter <"
606 << paraParamReal->getParamName() << ">" << std::endl;
607 return -1;
608 }
609 return 0;
610}
611
612int
614 ParaParam *paraParam,
615 char *valuestr
616 )
617{
618 char value;
619 ParaParamChar *paraParamChar = dynamic_cast< ParaParamChar * >(paraParam);
620 assert(valuestr != NULL);
621 if( std::sscanf(valuestr, "%c", &value) == 1 )
622 {
623 std::string allowedString(paraParamChar->getAllowedValues());
624 char cString[2]; cString[0] = value; cString[1] = '\0';
625 if( allowedString.find(cString) != std::string::npos )
626 {
627 paraParamChar->setValue(value);
628 }
629 else
630 {
631 OUTPUT_PARAM_VALUE_ERROR("Char", paraParamChar->getParamName(), value, paraParamChar->getComment() );
632 }
633 }
634 else
635 {
636 std::cout << "Invalid parameter value <" << valuestr
637 << "> for char parameter <"
638 << paraParamChar->getParamName() << ">" << std::endl;
639 return -1;
640 }
641 return 0;
642}
643
644int
646 ParaParam *paraParam,
647 char *valuestr
648 )
649{
650 ParaParamString *paraParamString = dynamic_cast< ParaParamString * >(paraParam);
651 assert(valuestr != NULL);
652
653 /* check for quotes */
654 size_t len = std::strlen(valuestr);
655 if( len <= 1 || valuestr[0] != '"' || valuestr[len-1] != '"' )
656 {
657 std::cout << "Invalid parameter value <" << valuestr
658 << "> for string parameter <"
659 << paraParamString->getParamName() << ">" << std::endl;
660 return -1;
661 }
662 /* remove the quotes */
663 valuestr[len-1] = '\0';
664 valuestr++;
665 char *paramValue = new char[strlen(valuestr) + 1 ];
666 strcpy(paramValue, valuestr);
667 paraParamString->setValue(paramValue);
668 return 0;
669}
670
671// -1: error
672/** the parameterParse routine is almost copy from paramset.c of SCIP code */
673int
675 char *line,
676 std::map<std::string, int> &mapStringToId
677 )
678{
679 char* paramname;
680 char* paramvaluestr;
681 char* lastquote;
682 unsigned int quoted;
683
684 /* find the start of the parameter name */
685 while( *line == ' ' || *line == '\t' || *line == '\r' )
686 line++;
687 if( *line == '\0' || *line == '\n' || *line == '#' )
688 return 0;
689 paramname = line;
690
691 /* find the end of the parameter name */
692 while( *line != ' ' && *line != '\t' && *line != '\r' && *line != '\n' && *line != '#' && *line != '\0' && *line != '=' )
693 line++;
694 if( *line == '=' )
695 {
696 *line = '\0';
697 line++;
698 }
699 else
700 {
701 *line = '\0';
702 line++;
703
704 /* search for the '=' char in the line */
705 while( *line == ' ' || *line == '\t' || *line == '\r' )
706 line++;
707 if( *line != '=' )
708 {
709 std::cout << "Character '=' was expected after the parameter name" << std::endl;
710 return -1;
711 }
712 line++;
713 }
714
715 /* find the start of the parameter value string */
716 while( *line == ' ' || *line == '\t' || *line == '\r' )
717 line++;
718 if( *line == '\0' || *line == '\n' || *line == '#' )
719 {
720 std::cout << "Parameter value is missing" << std::endl;
721 return -1;
722 }
723 paramvaluestr = line;
724
725 /* find the end of the parameter value string */
726 quoted = (*paramvaluestr == '"');
727 lastquote = NULL;
728 while( (quoted || (*line != ' ' && *line != '\t' && *line != '\r' && *line != '\n' && *line != '#')) && *line != '\0' )
729 {
730 if( *line == '"' )
731 lastquote = line;
732 line++;
733 }
734 if( lastquote != NULL )
735 line = lastquote+1;
736 if( *line == '#' )
737 *line = '\0';
738 else if( *line != '\0' )
739 {
740 /* check, if the rest of the line is clean */
741 *line = '\0';
742 line++;
743 while( *line == ' ' || *line == '\t' || *line == '\r' )
744 line++;
745 if( *line != '\0' && *line != '\n' && *line != '#' )
746 {
747 std::cout << "Additional characters after parameter value" << std::endl;
748 return -1;
749 }
750 }
751
752 std::map<std::string, int>::iterator pos;
753 pos = mapStringToId.find(paramname);
754 if( pos == mapStringToId.end() )
755 {
756 std::cout << "Unknown parameter <" << paramname << ">" << std::endl;
757 return -1;
758 }
759 int paramId = pos->second;
760 switch ( paraParams[paramId]->getType() )
761 {
763 return paramParaseBool(paraParams[paramId], paramvaluestr);
764 case ParaParamTypeInt:
765 return paramParaseInt(paraParams[paramId], paramvaluestr);
767 return paramParaseLongint(paraParams[paramId], paramvaluestr);
769 return paramParaseReal(paraParams[paramId], paramvaluestr);
771 return paramParaseChar(paraParams[paramId], paramvaluestr);
773 return paramParaseString(paraParams[paramId], paramvaluestr);
774 default:
775 std::cout << "Unknown parameter type" << std::endl;
776 return -1;
777 }
778}
779
780void
782 ParaComm *comm,
783 const char* filename
784 )
785{
786 const int MaxLineSize = 1024;
787 char line[MaxLineSize];
788
789 std::ifstream ifs;
790 ifs.open(filename);
791 if( !ifs ){
792 std::cout << "Cannot open ParaParams read file: file name = " << filename << std::endl;
793 exit(1);
794 }
795
796 std::map<std::string, int> mapStringToId;
797 // for( int i = ParaParamsFirst; i < ParaParamsSize; i ++ )
798 for( size_t i = 0; i < getParaParamsSize(); i ++ )
799 {
800 assert( paraParams[i] );
801 mapStringToId.insert(std::make_pair(paraParams[i]->getParamName(),i));
802 }
803
804 int lineNo = 0;
805 while( ifs.getline(line, MaxLineSize) )
806 {
807 lineNo++;
808 int retCode = parameterParse(line, mapStringToId);
809 if( retCode ){
810 ifs.close();
811 std::cout << "Input error in file <" << filename << "> line " << lineNo << std::endl;
812 exit(1);
813 }
814 }
815 ifs.close();
816
817#ifndef UG_WITH_ZLIB
819 {
820 std::cout << "Cannot compile checkpointing without zlib. Checkpoint must be FALSE." << std::endl;
821 exit(1);
822 }
823#endif
824}
825
826void
828 std::ostream *os
829 )
830{
831 bool comments = false;
832 bool onlyChanged = false;
833
834 if( this->getIntParamValue(OutputParaParams) == 1 ||
836 )
837 {
838 onlyChanged = true;
839 }
840
841 if( this->getIntParamValue(OutputParaParams) == 2 ||
843 )
844 {
845 comments = true;
846 }
847
848 // for( int i = 0; i < ParaParamsSize; i++ )
849 for( size_t i = 0; i < getParaParamsSize(); i++ )
850 {
851 assert( paraParams[i] );
852 switch ( paraParams[i]->getType() )
853 {
855 {
856 ParaParamBool *paraParamBool = dynamic_cast< ParaParamBool * >(paraParams[i]);
857 if( onlyChanged )
858 {
859 if (!paraParamBool->isDefaultValue()){
860 if( comments )
861 {
862 *os << paraParamBool->getComment() << std::endl;
863 }
864 *os << paraParamBool->getParamName() << " = " << ( ( paraParamBool->getValue() == true ) ? "TRUE" : "FALSE" ) << std::endl << std::endl;
865 }
866 } else {
867 if( comments )
868 {
869 *os << paraParamBool->getComment() << std::endl;
870 }
871 *os << paraParamBool->getParamName() << " = " << ( ( paraParamBool->getValue() == true ) ? "TRUE" : "FALSE" ) << std::endl << std::endl;
872 }
873 break;
874 }
875 case ParaParamTypeInt:
876 {
877 ParaParamInt *paraParamInt = dynamic_cast< ParaParamInt * >(paraParams[i]);
878 if( onlyChanged )
879 {
880 if (!paraParamInt->isDefaultValue()){
881 if( comments )
882 {
883 *os << paraParamInt->getComment() << std::endl;
884 }
885 *os << paraParamInt->getParamName() << " = " << paraParamInt->getValue() << std::endl<< std::endl;
886 }
887 }
888 else
889 {
890 if( comments )
891 {
892 *os << paraParamInt->getComment() << std::endl;
893 }
894 *os << paraParamInt->getParamName() << " = " << paraParamInt->getValue() << std::endl << std::endl;
895 }
896 break;
897 }
899 {
900 ParaParamLongint *paraParamLongint = dynamic_cast< ParaParamLongint * >(paraParams[i]);
901 if( onlyChanged )
902 {
903 if (!paraParamLongint->isDefaultValue()){
904 if( comments )
905 {
906 *os << paraParamLongint->getComment() << std::endl;
907 }
908 *os << paraParamLongint->getParamName() << " = " << paraParamLongint->getValue() << std::endl << std::endl;
909 }
910 }
911 else
912 {
913 if( comments )
914 {
915 *os << paraParamLongint->getComment() << std::endl;
916 }
917 *os << paraParamLongint->getParamName() << " = " << paraParamLongint->getValue() << std::endl << std::endl;
918 }
919 break;
920 }
922 {
923 ParaParamReal *paraParamReal = dynamic_cast< ParaParamReal * >(paraParams[i]);
924 if( onlyChanged )
925 {
926 if (!paraParamReal->isDefaultValue()){
927 if( comments )
928 {
929 *os << paraParamReal->getComment() << std::endl;
930 }
931 *os << paraParamReal->getParamName() << " = " << paraParamReal->getValue() << std::endl << std::endl;
932 }
933 }
934 else
935 {
936 if( comments )
937 {
938 *os << paraParamReal->getComment() << std::endl;
939 }
940 *os << paraParamReal->getParamName() << " = " << paraParamReal->getValue() << std::endl << std::endl;
941 }
942 break;
943 }
945 {
946 ParaParamChar *paraParamChar = dynamic_cast< ParaParamChar * >(paraParams[i]);
947 if( onlyChanged )
948 {
949 if (!paraParamChar->isDefaultValue()){
950 if( comments )
951 {
952 *os << paraParamChar->getComment() << std::endl;
953 }
954 *os << paraParamChar->getParamName() << " = " << paraParamChar->getValue() << std::endl << std::endl;
955 }
956 }
957 else
958 {
959 if( comments )
960 {
961 *os << paraParamChar->getComment() << std::endl;
962 }
963 *os << paraParamChar->getParamName() << " = " << paraParamChar->getValue() << std::endl << std::endl;
964 }
965 break;
966 }
968 {
969 ParaParamString *paraParamString = dynamic_cast< ParaParamString * >(paraParams[i]);
970 if( onlyChanged )
971 {
972 if (!paraParamString->isDefaultValue())
973 {
974 if( comments )
975 {
976 *os << paraParamString->getComment() << std::endl;
977 }
978 *os << paraParamString->getParamName() << " = \"" << paraParamString->getValue() << "\"" << std::endl << std::endl;
979 }
980 }
981 else
982 {
983 if( comments )
984 {
985 *os << paraParamString->getComment() << std::endl;
986 }
987 *os << paraParamString->getParamName() << " = \"" << paraParamString->getValue() << "\"" << std::endl << std::endl;
988 }
989 break;
990 }
991 default:
992 std::cout << "Unknown parameter type" << std::endl;
993 throw "Unknown parameter type";
994 }
995 }
996 (*os).clear();
997}
Base class of communicator object.
Definition: paraComm.h:102
class ParaParamBool
Definition: paraParamSet.h:200
void setDefaultValue()
set default parameter value
Definition: paraParamSet.h:262
bool isDefaultValue() const
check if current value is default value or not
Definition: paraParamSet.h:282
bool getValue() const
get current parameter value
Definition: paraParamSet.h:253
bool getDefaultValue() const
get default parameter value
Definition: paraParamSet.h:243
void setValue(bool value)
set parameter value
Definition: paraParamSet.h:271
class ParaParamChar
Definition: paraParamSet.h:648
char getValue() const
get current value of this char parameter
Definition: paraParamSet.h:704
void setDefaultValue()
set default value of this char parameter
Definition: paraParamSet.h:713
bool isDefaultValue() const
check if current value is default value or not
Definition: paraParamSet.h:733
char getDefaultValue() const
get default value of this char parameter
Definition: paraParamSet.h:694
const char * getAllowedValues() const
get all allowed char parameter values
Definition: paraParamSet.h:743
void setValue(char value)
set current value of this char parameter
Definition: paraParamSet.h:722
class ParaParamInt
Definition: paraParamSet.h:293
void setValue(int value)
set current value
Definition: paraParamSet.h:370
void setDefaultValue()
set default value
Definition: paraParamSet.h:361
int getMinValue() const
get minimum value of this int parameter
Definition: paraParamSet.h:391
bool isDefaultValue() const
check if current value is default value or not
Definition: paraParamSet.h:381
int getDefaultValue() const
get default value of this int parameter
Definition: paraParamSet.h:342
int getValue() const
get current value of this int parameter
Definition: paraParamSet.h:352
class ParaParamLongint
Definition: paraParamSet.h:412
void setDefaultValue()
set default value of this long int parameter
Definition: paraParamSet.h:480
bool isDefaultValue() const
check if current value is default value or not
Definition: paraParamSet.h:500
void setValue(long long value)
set current value of this long int parameter
Definition: paraParamSet.h:489
long long getMinValue() const
get minimum value of this long int parameter
Definition: paraParamSet.h:510
long long getDefaultValue() const
get default value of this long int parameter
Definition: paraParamSet.h:461
long long getValue() const
get current value of this long int parameter
Definition: paraParamSet.h:471
class ParaParamReal
Definition: paraParamSet.h:530
void setValue(double value)
set current value of this real parameter
Definition: paraParamSet.h:607
void setDefaultValue()
set default value of this real parameter
Definition: paraParamSet.h:598
bool isDefaultValue() const
check if current value is default value or not
Definition: paraParamSet.h:618
double getDefaultValue() const
get default value of this real parameter
Definition: paraParamSet.h:579
double getValue() const
get current value of this real parameter
Definition: paraParamSet.h:589
double getMinValue() const
get minimum value of this long int parameter
Definition: paraParamSet.h:628
bool getBoolParamValue(int param)
get bool parameter value
size_t nParaParams
number of ParaParams
Definition: paraParamSet.h:855
int parameterParse(char *line, std::map< std::string, int > &mapStringToId)
parse parameter (this routine is almost copy from paramset.c of SCIP code)
ParaParam ** paraParams
array of ParaParams
Definition: paraParamSet.h:856
int paramParaseLongint(ParaParam *paraParam, char *valuestr)
parse long int parameter
char getCharParamValue(int param)
get char parameter value
void setStringParamValue(int param, const char *value)
set string parameter value
int paramParaseChar(ParaParam *paraParam, char *valuestr)
parse real parameter
double getRealParamDefaultValue(int param)
get default value of real parameter
int getIntParamDefaultValue(int param)
get default value of int parameter
void write(std::ostream *os)
write ParaParams to output stream
int paramParaseInt(ParaParam *paraParam, char *valuestr)
parse int parameter
void setCharParamDefaultValue(int param)
set char parameter default value
bool isCharParamDefaultValue(int param)
check if char parameter is default value or not
void setLongintParamDefaultValue(int param)
set long int parameter default value
virtual void read(ParaComm *comm, const char *filename)
read ParaParams from file
void setBoolParamValue(int param, bool value)
set bool parameter value
const char * getStringParamDefaultValue(int param)
get default value of string parameter
void setIntParamValue(int param, int value)
set int parameter value
bool isStringParamDefaultValue(int param)
check if string parameter is default value or not
char getCharParamDefaultValue(int param)
get default value of char parameter
int paramParaseReal(ParaParam *paraParam, char *valuestr)
parse real parameter
bool getBoolParamDefaultValue(int param)
get default value of bool parameter
double getRealParamValue(int param)
get real parameter value
int paramParaseBool(ParaParam *paraParam, char *valuestr)
parse bool parameter
void setIntParamDefaultValue(int param)
set int parameter default value
bool isLongintParamDefaultValue(int param)
check if long int parameter is default value or not
long long getLongintParamDefaultValue(int param)
get default value of long int parameter
void setRealParamDefaultValue(int param)
set real parameter default value
void setCharParamValue(int param, char value)
set char parameter value
bool isBoolParamDefaultValue(int param)
check if bool parameter is default value or not
long long getLongintParamValue(int param)
get long int parameter value
void setLongintParamValue(int param, long long value)
set long int parameter value
void setBoolParamDefaultValue(int param)
set bool parameter default value
int getIntParamValue(int param)
get int parameter value
bool isIntParamDefaultValue(int param)
check if int parameter is default value or not
size_t getParaParamsSize()
get parameter table size
const char * getStringParamValue(int param)
get string parameter value
void setRealParamValue(int param, double value)
set real parameter value
bool isRealParamDefaultValue(int param)
check if real parameter is default value or not
void setStringParamDefaultValue(int param)
set string parameter default value
int paramParaseString(ParaParam *paraParam, char *valuestr)
parse real parameter
class ParaParamString
Definition: paraParamSet.h:754
void setDefaultValue()
set default value of this string parameter
Definition: paraParamSet.h:817
void setValue(const char *value)
set current value of this sting parameter
Definition: paraParamSet.h:827
const char * getDefaultValue() const
get default value of this string parameter
Definition: paraParamSet.h:798
bool isDefaultValue() const
check if current value is default value or not
Definition: paraParamSet.h:838
const char * getValue() const
get current value of this string parameter
Definition: paraParamSet.h:808
class ParaParam
Definition: paraParamSet.h:141
const char * getParamName() const
getter of parameter name
Definition: paraParamSet.h:172
const char * getComment() const
getter of comments string
Definition: paraParamSet.h:182
static ScipParaCommTh * comm
Definition: fscip.cpp:73
static const int RacingParamsDirPath
Definition: paraParamSet.h:131
static const int ParaParamTypeInt
integer values
Definition: paraParamSet.h:59
static const int CheckpointInterval
Definition: paraParamSet.h:107
static const int TempFilePath
Definition: paraParamSet.h:125
static const int FinalCheckpointGeneratingTime
Definition: paraParamSet.h:108
static const int ParaParamTypeReal
real values
Definition: paraParamSet.h:61
static const int LogTasksTransferFilePath
Definition: paraParamSet.h:128
static const int SolutionFilePath
Definition: paraParamSet.h:129
static const int NotificationInterval
Definition: paraParamSet.h:105
static const int NotificationSynchronization
Definition: paraParamSet.h:88
static const int OutputParaParams
Definition: paraParamSet.h:87
static const int LogSolvingStatus
Definition: paraParamSet.h:73
static const int CheckpointFilePath
Definition: paraParamSet.h:130
static const int LogSolvingStatusFilePath
Definition: paraParamSet.h:127
static const int ParaParamTypeLongint
long integer values
Definition: paraParamSet.h:60
static const int TimeLimit
Definition: paraParamSet.h:106
static const int ParaParamTypeChar
characters
Definition: paraParamSet.h:62
static const int Checkpoint
Definition: paraParamSet.h:75
static const int Deterministic
Definition: paraParamSet.h:76
static const int ParaParamTypeBool
Types of parameters.
Definition: paraParamSet.h:58
static const int TagTraceFileName
Definition: paraParamSet.h:126
static const int ParaParamTypeString
arrays of characters
Definition: paraParamSet.h:63
static const int LogTasksTransfer
Definition: paraParamSet.h:74
static const int Quiet
Definition: paraParamSet.h:71
static const int DynamicAdjustNotificationInterval
Definition: paraParamSet.h:78
static const int TagTrace
Definition: paraParamSet.h:72
static const int StatisticsToStdout
Definition: paraParamSet.h:77
Base class of communicator for UG Framework.
Parameter set for UG framework.
#define OUTPUT_PARAM_VALUE_ERROR(msg1, msg2, msg3, msg4)
Definition: paraParamSet.h:46