Scippy

UG

Ubiquity Generator framework

paraParamSet.h
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 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.h
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 #ifndef __PARA_PARAM_SET_H__
38 #define __PARA_PARAM_SET_H__
39 #include <algorithm>
40 #include <string>
41 #include <iostream>
42 #include <map>
43 #include <cmath>
44 #include "paraComm.h"
45 
46 #define OUTPUT_PARAM_VALUE_ERROR( msg1, msg2, msg3, msg4 ) \
47  std::cout << "[PARAM VALUE ERROR] Param type = " << msg1 << ", Param name = " << msg2 \
48  << ", Param value = " << msg3 << ": Param comment is as follows: " << std::endl \
49  << msg4 << std::endl; \
50  return (-1)
51 
52 namespace UG
53 {
54 
55 ///
56 /// Types of parameters
57 ///
58 static const int ParaParamTypeBool = 1; ///< bool values: true or false
59 static const int ParaParamTypeInt = 2; ///< integer values
60 static const int ParaParamTypeLongint = 3; ///< long integer values
61 static const int ParaParamTypeReal = 4; ///< real values
62 static const int ParaParamTypeChar = 5; ///< characters
63 static const int ParaParamTypeString = 6; ///< arrays of characters
64 
65 ///
66 /// Bool parameters
67 ///
68 static const int ParaParamsFirst = 0;
70 //-------------------------------------------------------------------------
71 static const int Quiet = ParaParamsBoolFirst + 0;
72 static const int TagTrace = ParaParamsBoolFirst + 1;
73 static const int LogSolvingStatus = ParaParamsBoolFirst + 2;
74 static const int LogTasksTransfer = ParaParamsBoolFirst + 3;
75 static const int Checkpoint = ParaParamsBoolFirst + 4;
76 static const int Deterministic = ParaParamsBoolFirst + 5;
77 static const int StatisticsToStdout = ParaParamsBoolFirst + 6;
78 static const int DynamicAdjustNotificationInterval = ParaParamsBoolFirst + 7;
79 //-------------------------------------------------------------------------
80 static const int ParaParamsBoolLast = ParaParamsBoolFirst + 7;
81 static const int ParaParamsBoolN = ParaParamsBoolLast - ParaParamsBoolFirst + 1;
82 ///
83 /// Int parameters
84 ///
85 static const int ParaParamsIntFirst = ParaParamsBoolLast + 1;
86 //-------------------------------------------------------------------------
87 static const int OutputParaParams = ParaParamsIntFirst + 0;
88 static const int NotificationSynchronization = ParaParamsIntFirst + 1;
89 //-------------------------------------------------------------------------
90 static const int ParaParamsIntLast = ParaParamsIntFirst + 1;
91 static const int ParaParamsIntN = ParaParamsIntLast - ParaParamsIntFirst + 1;
92 ///
93 /// Longint parameters
94 ///
95 static const int ParaParamsLongintFirst = ParaParamsIntLast + 1;
96 //-------------------------------------------------------------------------
97 //-------------------------------------------------------------------------
98 static const int ParaParamsLongintLast = ParaParamsLongintFirst - 1; // No params -1
99 static const int ParaParamsLongintN = ParaParamsLongintLast - ParaParamsLongintFirst + 1;
100 ///
101 /// Real parameters
102 ///
103 static const int ParaParamsRealFirst = ParaParamsLongintLast + 1;
104 //-------------------------------------------------------------------------
105 static const int NotificationInterval = ParaParamsRealFirst + 0;
106 static const int TimeLimit = ParaParamsRealFirst + 1;
107 static const int CheckpointInterval = ParaParamsRealFirst + 2;
108 static const int FinalCheckpointGeneratingTime = ParaParamsRealFirst + 3;
109 //-------------------------------------------------------------------------
110 static const int ParaParamsRealLast = ParaParamsRealFirst + 3;
111 static const int ParaParamsRealN = ParaParamsRealLast - ParaParamsRealFirst + 1;
112 ///
113 /// Char parameters
114 ///
115 static const int ParaParamsCharFirst = ParaParamsRealLast + 1;
116 //-------------------------------------------------------------------------
117 //-------------------------------------------------------------------------
118 static const int ParaParamsCharLast = ParaParamsCharFirst - 1; // No params -1
119 static const int ParaParamsCharN = ParaParamsCharLast - ParaParamsCharFirst + 1;
120 ///
121 /// String parameters
122 ///
123 static const int ParaParamsStringFirst = ParaParamsCharLast +1;
124 //-------------------------------------------------------------------------
125 static const int TempFilePath = ParaParamsStringFirst + 0;
126 static const int TagTraceFileName = ParaParamsStringFirst + 1;
127 static const int LogSolvingStatusFilePath = ParaParamsStringFirst + 2;
128 static const int LogTasksTransferFilePath = ParaParamsStringFirst + 3;
129 static const int SolutionFilePath = ParaParamsStringFirst + 4;
130 static const int CheckpointFilePath = ParaParamsStringFirst + 5;
131 static const int RacingParamsDirPath = ParaParamsStringFirst + 6;
132 //-------------------------------------------------------------------------
133 static const int ParaParamsStringLast = ParaParamsStringFirst + 6;
134 static const int ParaParamsStringN = ParaParamsStringLast - ParaParamsStringFirst + 1;
136 static const int ParaParamsSize = ParaParamsLast + 1;
137 
138 ///
139 /// class ParaParam
140 ///
141 class ParaParam {
142 
143  const char *paramName; ///< parameter name
144  const char *comment; ///< comments for this parameter
145 
146 public:
147 
148  ///
149  /// constructor
150  ///
152  const char *inParamName,
153  const char *inComment
154  )
155  : paramName(inParamName),
156  comment(inComment)
157  {
158  }
159 
160  ///
161  /// destructor
162  ///
163  virtual ~ParaParam(
164  )
165  {
166  }
167 
168  ///
169  /// getter of parameter name
170  /// @return string of parameter name
171  ///
172  const char *getParamName(
173  ) const
174  {
175  return paramName;
176  }
177 
178  ///
179  /// getter of comments string
180  /// @return string of comments
181  ///
182  const char *getComment(
183  ) const
184  {
185  return comment;
186  }
187 
188  ///
189  /// get parameter type
190  /// @return parameter type value
191  ///
192  virtual int getType(
193  ) const = 0;
194 
195 };
196 
197 ///
198 /// class ParaParamBool
199 ///
200 class ParaParamBool : public ParaParam {
201 
202  const bool defaultValue; ///< default bool parameter value
203  bool currentValue; ///< current bool parameter value
204 
205 public:
206 
207  ///
208  /// constructor
209  ///
211  const char *name, ///< parameter name
212  const char *inComment, ///< comments string of this parameter
213  bool value ///< default bool value of this parameter
214  )
215  : ParaParam(name, inComment),
216  defaultValue(value),
217  currentValue(value)
218  {
219  }
220 
221  ///
222  /// destructor
223  ///
225  )
226  {
227  }
228 
229  ///
230  /// get parameter type value
231  /// @return 1: Bool
232  ///
233  int getType(
234  ) const
235  {
236  return ParaParamTypeBool;
237  }
238 
239  ///
240  /// get default parameter value
241  /// @return default parameter value
242  ///
244  ) const
245  {
246  return defaultValue;
247  }
248 
249  ///
250  /// get current parameter value
251  /// @return current parameter value
252  ///
253  bool getValue(
254  ) const
255  {
256  return currentValue;
257  }
258 
259  ///
260  /// set default parameter value
261  ///
263  )
264  {
265  currentValue = defaultValue;
266  }
267 
268  ///
269  /// set parameter value
270  ///
271  void setValue(
272  bool value ///< value to be set
273  )
274  {
275  currentValue = value;
276  }
277 
278  ///
279  /// check if current value is default value or not
280  /// @return true if current value is default value
281  ///
283  ) const
284  {
285  return defaultValue == currentValue;
286  }
287 
288 };
289 
290 ///
291 /// class ParaParamInt
292 ///
293 class ParaParamInt : public ParaParam {
294 
295  const int defaultValue; ///< default int parameter value
296  int currentValue; ///< current int parameter value
297  const int minValue; ///< minimum int parameter value
298  const int maxValue; ///< maximum int parameter value
299 
300 public:
301 
302  ///
303  /// contractor
304  ///
306  const char *name, ///< int parameter name
307  const char *inComment, ///< comment string of this int parameter
308  int value, ///< default value of this int parameter
309  const int min, ///< minimum value of this int parameter
310  const int max ///< maximum value of this int parameter
311  )
312  : ParaParam(name, inComment),
313  defaultValue(value),
314  currentValue(value),
315  minValue(min),
316  maxValue(max)
317  {
318  }
319 
320  ///
321  /// destructor
322  ///
324  )
325  {
326  }
327 
328  ///
329  /// get parameter type
330  /// @return 2: Int
331  ///
332  int getType(
333  ) const
334  {
335  return ParaParamTypeInt;
336  }
337 
338  ///
339  /// get default value of this int parameter
340  /// @return default value
341  ///
343  ) const
344  {
345  return defaultValue;
346  }
347 
348  ///
349  /// get current value of this int parameter
350  /// @return current value
351  ///
352  int getValue(
353  ) const
354  {
355  return currentValue;
356  }
357 
358  ///
359  /// set default value
360  ///
362  )
363  {
364  currentValue = defaultValue;
365  }
366 
367  ///
368  /// set current value
369  ///
370  void setValue(
371  int value ///< int value to be set
372  )
373  {
374  currentValue = value;
375  }
376 
377  ///
378  /// check if current value is default value or not
379  /// @return true if current value is default value
380  ///
382  ) const
383  {
384  return defaultValue == currentValue;
385  }
386 
387  ///
388  /// get minimum value of this int parameter
389  /// @return minimum value
390  ///
392  ) const
393  {
394  return minValue;
395  }
396 
397  ///
398  /// get maximum value of this int parameter
399  /// @return maximum value
400  ///
402  ) const
403  {
404  return maxValue;
405  }
406 
407 };
408 
409 ///
410 /// class ParaParamLongint
411 ///
412 class ParaParamLongint : public ParaParam {
413 
414  const long long defaultValue; ///< default long int parameter value
415  long long currentValue; ///< current long int parameter value
416  const long long minValue; ///< minimum long int parameter value
417  const long long maxValue; ///< maximum long int parameter value
418 
419 public:
420 
421  ///
422  /// constructor
423  ///
425  const char *name, ///< long int parameter name
426  const char *inComment, ///< comment string of this long int parameter
427  long long value, ///< default value of this long int parameter
428  const long long min, ///< minimum value of this long int parameter
429  const long long max ///< maximum value of this long int parameter
430  )
431  : ParaParam(name, inComment),
432  defaultValue(value),
433  currentValue(value),
434  minValue(min),
435  maxValue(max)
436  {
437  }
438 
439  ///
440  /// destructor
441  ///
443  )
444  {
445  }
446 
447  ///
448  /// get parameter type
449  /// @return 3: Long int
450  ///
451  int getType(
452  ) const
453  {
454  return ParaParamTypeLongint;
455  }
456 
457  ///
458  /// get default value of this long int parameter
459  /// @return default value
460  ///
461  long long getDefaultValue(
462  ) const
463  {
464  return defaultValue;
465  }
466 
467  ///
468  /// get current value of this long int parameter
469  /// @return current value
470  ///
471  long long getValue(
472  ) const
473  {
474  return currentValue;
475  }
476 
477  ///
478  /// set default value of this long int parameter
479  ///
481  )
482  {
483  currentValue = defaultValue;
484  }
485 
486  ///
487  /// set current value of this long int parameter
488  ///
489  void setValue(
490  long long value ///< value to be set
491  )
492  {
493  currentValue = value;
494  }
495 
496  ///
497  /// check if current value is default value or not
498  /// @return true if current value is default value
499  ///
501  ) const
502  {
503  return defaultValue == currentValue;
504  }
505 
506  ///
507  /// get minimum value of this long int parameter
508  /// @return minimum value
509  ///
510  long long getMinValue(
511  ) const
512  {
513  return minValue;
514  }
515 
516  ///
517  /// get maximum value of this long
518  ///
519  long long getMaxValue(
520  ) const
521  {
522  return maxValue;
523  }
524 
525 };
526 
527 ///
528 /// class ParaParamReal
529 ///
530 class ParaParamReal : public ParaParam {
531 
532  const double defaultValue; ///< default real parameter value
533  double currentValue; ///< current real parameter value
534  const double minValue; ///< minimum real parameter value
535  const double maxValue; ///< maximum real parameter value
536 
537 public:
538 
539  ///
540  /// constructor
541  ///
543  const char *name, ///< real parameter name
544  const char *inComment, ///< comment string of this real parameter
545  double value, ///< default value of this real parameter
546  const double min, ///< minimum value of this real parameter
547  const double max ///< maximum value of this real parameter
548  )
549  : ParaParam(name, inComment),
550  defaultValue(value),
551  currentValue(value),
552  minValue(min),
553  maxValue(max)
554  {
555  }
556 
557  ///
558  /// destructor
559  ///
561  )
562  {
563  }
564 
565  ///
566  /// get parameter type
567  /// @return 4: real
568  ///
569  int getType(
570  ) const
571  {
572  return ParaParamTypeReal;
573  }
574 
575  ///
576  /// get default value of this real parameter
577  /// @return default value
578  ///
580  ) const
581  {
582  return defaultValue;
583  }
584 
585  ///
586  /// get current value of this real parameter
587  /// @return current value
588  ///
589  double getValue(
590  ) const
591  {
592  return currentValue;
593  }
594 
595  ///
596  /// set default value of this real parameter
597  ///
599  )
600  {
601  currentValue = defaultValue;
602  }
603 
604  ///
605  /// set current value of this real parameter
606  ///
607  void setValue(
608  double value ///< value to be set
609  )
610  {
611  currentValue = value;
612  }
613 
614  ///
615  /// check if current value is default value or not
616  /// @return true if current value is default value
617  ///
619  ) const
620  {
621  return ( fabs( defaultValue - currentValue ) < 1e-20 );
622  }
623 
624  ///
625  /// get minimum value of this long int parameter
626  /// @return minimum value
627  ///
628  double getMinValue(
629  ) const
630  {
631  return minValue;
632  }
633 
634  ///
635  /// get maximum value of this long
636  ///
637  double getMaxValue(
638  ) const
639  {
640  return maxValue;
641  }
642 
643 };
644 
645 ///
646 /// class ParaParamChar
647 ///
648 class ParaParamChar : public ParaParam {
649 
650  const char defaultValue; ///< default char parameter value
651  char currentValue; ///< current char parameter value
652  const char *allowedValues; ///< allowed char parameter values
653 
654 public:
655 
656  ///
657  /// constructor
658  ///
660  const char *name, ///< char parameter name
661  const char *inComment, ///< comment string of this char parameter
662  char value, ///< default value of this char parameter
663  const char *inAllowedValues ///< allowed char parameter values
664  )
665  : ParaParam(name, inComment),
666  defaultValue(value),
667  currentValue(value),
668  allowedValues(inAllowedValues)
669  {
670  }
671 
672  ///
673  /// destructor
674  ///
676  )
677  {
678  }
679 
680  ///
681  /// get parameter type
682  /// @return 5: char
683  ///
684  int getType(
685  ) const
686  {
687  return ParaParamTypeChar;
688  }
689 
690  ///
691  /// get default value of this char parameter
692  /// @return default value
693  ///
695  ) const
696  {
697  return defaultValue;
698  }
699 
700  ///
701  /// get current value of this char parameter
702  /// @return current value
703  ///
704  char getValue(
705  ) const
706  {
707  return currentValue;
708  }
709 
710  ///
711  /// set default value of this char parameter
712  ///
714  )
715  {
716  currentValue = defaultValue;
717  }
718 
719  ///
720  /// set current value of this char parameter
721  ///
722  void setValue(
723  char value ///< value to be set
724  )
725  {
726  currentValue = value;
727  }
728 
729  ///
730  /// check if current value is default value or not
731  /// @return true if current value is default value
732  ///
734  ) const
735  {
736  return defaultValue == currentValue;
737  }
738 
739  ///
740  /// get all allowed char parameter values
741  /// @return sting of allowed chars
742  ///
743  const char *getAllowedValues(
744  ) const
745  {
746  return allowedValues;
747  }
748 
749 };
750 
751 ///
752 /// class ParaParamString
753 ///
754 class ParaParamString : public ParaParam {
755 
756  const char *defaultValue; ///< default string parameter value
757  const char *currentValue; ///< current string parameter value
758 
759 public:
760 
761  ///
762  /// constructor
763  ///
765  const char *name, ///< string parameter name
766  const char *inComment, ///< comment string of this string parameter
767  const char *value ///< default value of this string parameter
768  )
769  : ParaParam(name, inComment),
770  defaultValue(value),
771  currentValue(value)
772  {
773  }
774 
775  ///
776  /// destructor
777  ///
779  )
780  {
781  if( currentValue != defaultValue ) delete [] currentValue;
782  }
783 
784  ///
785  /// get parameter type
786  /// @return 6: string
787  ///
788  int getType(
789  ) const
790  {
791  return ParaParamTypeString;
792  }
793 
794  ///
795  /// get default value of this string parameter
796  /// @return default value
797  ///
798  const char *getDefaultValue(
799  ) const
800  {
801  return defaultValue;
802  }
803 
804  ///
805  /// get current value of this string parameter
806  /// @return current value
807  ///
808  const char *getValue(
809  ) const
810  {
811  return currentValue;
812  }
813 
814  ///
815  /// set default value of this string parameter
816  ///
818  )
819  {
820  if( currentValue != defaultValue ) delete [] currentValue;
821  currentValue = defaultValue;
822  }
823 
824  ///
825  /// set current value of this sting parameter
826  ///
827  void setValue(
828  const char *value ///< value to be set
829  )
830  {
831  currentValue = value;
832  }
833 
834  ///
835  /// check if current value is default value or not
836  /// @return true if current value is default value
837  ///
839  ) const
840  {
841  return ( std::string(defaultValue) == std::string(currentValue) );
842  }
843 
844 };
845 
846 class ParaComm;
847 ///
848 /// class ParaParamSet
849 ///
851 
852 protected:
853 
854  // static ParaParam *paraParams[ParaParamsSize]; ///< array of ParaParms
855  size_t nParaParams; ///< number of ParaParams
856  ParaParam **paraParams; ///< array of ParaParams
857 
858  ///
859  /// parse bool parameter
860  /// @return 0, if the bool parameter value is valid, -1: error
861  ///
862  int paramParaseBool(
863  ParaParam *paraParam, ///< pointer to ParaParam object
864  char *valuestr ///< value string
865  );
866 
867  ///
868  /// parse int parameter
869  /// @return 0, if the int parameter value is valid, -1: error
870  ///
871  int paramParaseInt(
872  ParaParam *paraParam, ///< pointer to ParaParam object
873  char *valuestr ///< value string
874  );
875 
876  ///
877  /// parse long int parameter
878  /// @return 0, if the long int parameter value is valid, -1: error
879  ///
880  int paramParaseLongint(
881  ParaParam *paraParam, ///< pointer to ParaParam object
882  char *valuestr ///< value string
883  );
884 
885  ///
886  /// parse real parameter
887  /// @return 0, if the real parameter value is valid, -1: error
888  ///
889  int paramParaseReal(
890  ParaParam *paraParam, ///< pointer to ParaParam object
891  char *valuestr ///< value string
892  );
893 
894  ///
895  /// parse real parameter
896  /// @return 0, if the real parameter value is valid, -1: error
897  ///
898  int paramParaseChar(
899  ParaParam *paraParam, ///< pointer to ParaParam object
900  char *valuestr ///< value string
901  );
902 
903  ///
904  /// parse real parameter
905  /// @return 0, if the real parameter value is valid, -1: error
906  ///
907  int paramParaseString(
908  ParaParam *paraParam, ///< pointer to ParaParam object
909  char *valuestr ///< value string
910  );
911 
912  ///
913  /// parse parameter
914  /// (this routine is almost copy from paramset.c of SCIP code)
915  /// @return 0, if parameter in a line is valid, -1: error
916  ///
917  int parameterParse(
918  char *line, ///< parameter line
919  std::map<std::string, int> &mapStringToId ///< map of parameter sting to parameter id
920  );
921 
922 public:
923 
924  ///
925  /// constructor
926  ///
928  )
929  : nParaParams(0), paraParams(0)
930  {
931  }
932 
933  ///
934  /// constructor
935  ///
936  ParaParamSet(
937  size_t nInParaParams
938  );
939 
940  ///
941  /// destructor
942  ///
943  virtual ~ParaParamSet(
944  )
945  {
946  for( size_t i = 0; i < nParaParams; i++ )
947  {
948  delete paraParams[i];
949  }
950  delete [] paraParams;
951  }
952 
953  ///--------------------
954  /// for bool parameters
955  ///--------------------
956 
957  ///
958  /// get bool parameter value
959  /// @return value of the bool parameter specified
960  ///
961  bool getBoolParamValue(
962  int param ///< bool parameter id
963  );
964 
965  ///
966  /// set bool parameter value
967  ///
968  void setBoolParamValue(
969  int param, ///< bool parameter id
970  bool value ///< value to be set
971  );
972 
973  ///
974  /// get default value of bool parameter
975  /// @return default bool parameter value
976  ///
977  bool getBoolParamDefaultValue(
978  int param ///< bool parameter id
979  );
980 
981  ///
982  /// set bool parameter default value
983  ///
984  void setBoolParamDefaultValue(
985  int param ///< bool parameter id
986  );
987 
988  ///
989  /// check if bool parameter is default value or not
990  /// @return true if bool parameter is default value
991  ///
992  bool isBoolParamDefaultValue(
993  int param ///< bool parameter id
994  );
995 
996 
997  ///--------------------
998  /// for int parameters
999  ///--------------------
1000 
1001  ///
1002  /// get int parameter value
1003  /// @return value of the int parameter specified
1004  ///
1005  int getIntParamValue(
1006  int param ///< int parameter id
1007  );
1008 
1009  ///
1010  /// set int parameter value
1011  ///
1012  void setIntParamValue(
1013  int param, ///< int parameter id
1014  int value ///< value to be set
1015  );
1016 
1017  ///
1018  /// get default value of int parameter
1019  /// @return default int parameter value
1020  ///
1021  int getIntParamDefaultValue(
1022  int param ///< int parameter id
1023  );
1024 
1025  ///
1026  /// set int parameter default value
1027  ///
1028  void setIntParamDefaultValue(
1029  int param ///< int parameter id
1030  );
1031 
1032  ///
1033  /// check if int parameter is default value or not
1034  /// @return true if int parameter is default value
1035  ///
1036  bool isIntParamDefaultValue(
1037  int param ///< int parameter id
1038  );
1039 
1040  ///------------------------
1041  /// for long int parameters
1042  ///------------------------
1043 
1044  ///
1045  /// get long int parameter value
1046  /// @return value of the long int parameter specified
1047  ///
1048  long long getLongintParamValue(
1049  int param ///< long int parameter id
1050  );
1051 
1052  ///
1053  /// set long int parameter value
1054  ///
1055  void setLongintParamValue(
1056  int param, ///< long int parameter id
1057  long long value ///< value to be set
1058  );
1059 
1060  ///
1061  /// get default value of long int parameter
1062  /// @return default long int parameter value
1063  ///
1064  long long getLongintParamDefaultValue(
1065  int param ///< long int parameter id
1066  );
1067 
1068  ///
1069  /// set long int parameter default value
1070  ///
1071  void setLongintParamDefaultValue(
1072  int param ///< long int parameter id
1073  );
1074 
1075  ///
1076  /// check if long int parameter is default value or not
1077  /// @return true if long int parameter is default value
1078  ///
1079  bool isLongintParamDefaultValue(
1080  int param ///< long int parameter id
1081  );
1082 
1083  ///------------------------
1084  /// for real parameters
1085  ///------------------------
1086 
1087  ///
1088  /// get real parameter value
1089  /// @return value of the real parameter specified
1090  ///
1091  double getRealParamValue(
1092  int param ///< real parameter id
1093  );
1094 
1095  ///
1096  /// set real parameter value
1097  ///
1098  void setRealParamValue(
1099  int param, ///< real parameter id
1100  double value ///< value to be set
1101  );
1102 
1103  ///
1104  /// get default value of real parameter
1105  /// @return default real parameter value
1106  ///
1107  double getRealParamDefaultValue(
1108  int param ///< real parameter id
1109  );
1110 
1111  ///
1112  /// set real parameter default value
1113  ///
1114  void setRealParamDefaultValue(
1115  int param ///< real parameter id
1116  );
1117 
1118  ///
1119  /// check if real parameter is default value or not
1120  /// @return true if real parameter is default value
1121  ///
1122  bool isRealParamDefaultValue(
1123  int param ///< real parameter id
1124  );
1125 
1126  ///--------------------
1127  /// for char parameters
1128  ///--------------------
1129 
1130  ///
1131  /// get char parameter value
1132  /// @return value of the char parameter specified
1133  ///
1134  char getCharParamValue(
1135  int param ///< char parameter id
1136  );
1137 
1138  ///
1139  /// set char parameter value
1140  ///
1141  void setCharParamValue(
1142  int param, ///< char parameter id
1143  char value ///< value to be set
1144  );
1145 
1146  ///
1147  /// get default value of char parameter
1148  /// @return default char parameter value
1149  ///
1150  char getCharParamDefaultValue(
1151  int param ///< char parameter id
1152  );
1153 
1154  ///
1155  /// set char parameter default value
1156  ///
1157  void setCharParamDefaultValue(
1158  int param ///< char parameter id
1159  );
1160 
1161  ///
1162  /// check if char parameter is default value or not
1163  /// @return true if char parameter is default value
1164  ///
1165  bool isCharParamDefaultValue(
1166  int param ///< char parameter id
1167  );
1168 
1169  ///--------------------
1170  /// for char parameters
1171  ///--------------------
1172 
1173  ///
1174  /// get string parameter value
1175  /// @return value of the string parameter specified
1176  ///
1177  const char *getStringParamValue(
1178  int param ///< string parameter id
1179  );
1180 
1181  ///
1182  /// set string parameter value
1183  ///
1184  void setStringParamValue(
1185  int param, ///< string parameter id
1186  const char *value ///< value to be set
1187  );
1188 
1189  ///
1190  /// get default value of string parameter
1191  /// @return default string parameter value
1192  ///
1193  const char *getStringParamDefaultValue(
1194  int param ///< string parameter id
1195  );
1196 
1197  ///
1198  /// set string parameter default value
1199  ///
1200  void setStringParamDefaultValue(
1201  int param ///< string parameter id
1202  );
1203 
1204  ///
1205  /// check if string parameter is default value or not
1206  /// @return true if string parameter is default value
1207  ///
1208  bool isStringParamDefaultValue(
1209  int param ///< string parameter id
1210  );
1211 
1212 
1213  ///
1214  /// read ParaParams from file
1215  ///
1216  virtual void read(
1217  ParaComm *comm, ///< communicator used
1218  const char* filename ///< reading file name
1219  );
1220 
1221  ///
1222  /// write ParaParams to output stream
1223  ///
1224  void write(
1225  std::ostream *os ///< ostream for writing
1226  );
1227 
1228  ///
1229  /// get parameter table size
1230  /// @return size of parameter table
1231  ///
1233  )
1234  {
1235  return nParaParams;
1236  }
1237 
1238  ///
1239  /// get number of bool parameters
1240  /// @return size of parameter table
1241  ///
1242  virtual size_t getNumBoolParams(
1243  ) = 0;
1244 
1245  ///
1246  /// get number of int parameters
1247  /// @return size of parameter table
1248  ///
1249  virtual size_t getNumIntParams(
1250  ) = 0;
1251 
1252  ///
1253  /// get number of longint parameters
1254  /// @return size of parameter table
1255  ///
1256  virtual size_t getNumLongintParams(
1257  ) = 0;
1258 
1259  ///
1260  /// get number of real parameters
1261  /// @return size of parameter table
1262  ///
1263  virtual size_t getNumRealParams(
1264  ) = 0;
1265 
1266  ///
1267  /// get number of char parameters
1268  /// @return size of parameter table
1269  ///
1270  virtual size_t getNumCharParams(
1271  ) = 0;
1272 
1273  ///
1274  /// get number of string parameters
1275  /// @return size of parameter table
1276  ///
1277  virtual size_t getNumStringParams(
1278  ) = 0;
1279 
1280  ///
1281  /// broadcast ParaParams
1282  /// @return always 0 (for future extensions)
1283  ///
1284  virtual int bcast(
1285  ParaComm *comm, ///< communicator used
1286  int root ///< root rank for broadcast
1287  ) = 0;
1288 
1289 };
1290 
1291 }
1292 
1293 #endif // __PARA_PARAM_SET_H__
class ParaParam
Definition: paraParamSet.h:141
const char * getAllowedValues() const
get all allowed char parameter values
Definition: paraParamSet.h:743
~ParaParamInt()
destructor
Definition: paraParamSet.h:323
const char * comment
comments for this parameter
Definition: paraParamSet.h:144
static const int ParaParamTypeString
arrays of characters
Definition: paraParamSet.h:63
virtual ~ParaParam()
destructor
Definition: paraParamSet.h:163
virtual size_t getNumCharParams()
get number of char parameters
int currentValue
current int parameter value
Definition: paraParamSet.h:296
void setValue(char value)
set current value of this char parameter
Definition: paraParamSet.h:722
const long long maxValue
maximum long int parameter value
Definition: paraParamSet.h:417
bool getValue() const
get current parameter value
Definition: paraParamSet.h:253
long long getDefaultValue() const
get default value of this long int parameter
Definition: paraParamSet.h:461
const long long minValue
minimum long int parameter value
Definition: paraParamSet.h:416
int getMinValue() const
get minimum value of this int parameter
Definition: paraParamSet.h:391
class ParaParamLongint
Definition: paraParamSet.h:412
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
static const int ParaParamTypeReal
real values
Definition: paraParamSet.h:61
static const int LogSolvingStatusFilePath
Definition: paraParamSet.h:127
const double minValue
minimum real parameter value
Definition: paraParamSet.h:534
static ScipParaCommTh * comm
Definition: fscip.cpp:73
void setValue(bool value)
set parameter value
Definition: paraParamSet.h:271
long long getMaxValue() const
get maximum value of this long
Definition: paraParamSet.h:519
bool isDefaultValue() const
check if current value is default value or not
Definition: paraParamSet.h:282
static const int FinalCheckpointGeneratingTime
Definition: paraParamSet.h:108
const long long defaultValue
default long int parameter value
Definition: paraParamSet.h:414
double getMinValue() const
get minimum value of this long int parameter
Definition: paraParamSet.h:628
static const int ParaParamsCharLast
Definition: paraParamSet.h:118
static const int ParaParamTypeChar
characters
Definition: paraParamSet.h:62
ParaParamBool(const char *name, const char *inComment, bool value)
constructor
Definition: paraParamSet.h:210
static const int ParaParamsBoolN
Definition: paraParamSet.h:81
static const int ParaParamTypeInt
integer values
Definition: paraParamSet.h:59
static const int ParaParamsIntN
Definition: paraParamSet.h:91
static const int ParaParamsStringN
Definition: paraParamSet.h:134
static const int OutputParaParams
Definition: paraParamSet.h:87
ParaParamSet()
constructor
Definition: paraParamSet.h:927
static const int ParaParamsIntFirst
Int parameters.
Definition: paraParamSet.h:85
static const int TempFilePath
Definition: paraParamSet.h:125
char currentValue
current char parameter value
Definition: paraParamSet.h:651
static const int RacingParamsDirPath
Definition: paraParamSet.h:131
double currentValue
current real parameter value
Definition: paraParamSet.h:533
const char * getComment() const
getter of comments string
Definition: paraParamSet.h:182
virtual int getType() const =0
get parameter type
static const int Checkpoint
Definition: paraParamSet.h:75
int getType() const
get parameter type
Definition: paraParamSet.h:788
ParaParamReal(const char *name, const char *inComment, double value, const double min, const double max)
constructor
Definition: paraParamSet.h:542
virtual size_t getNumRealParams()
get number of real parameters
bool isDefaultValue() const
check if current value is default value or not
Definition: paraParamSet.h:500
ParaParamChar(const char *name, const char *inComment, char value, const char *inAllowedValues)
constructor
Definition: paraParamSet.h:659
bool getDefaultValue() const
get default parameter value
Definition: paraParamSet.h:243
long long currentValue
current long int parameter value
Definition: paraParamSet.h:415
class ParaParamReal
Definition: paraParamSet.h:530
const bool defaultValue
default bool parameter value
Definition: paraParamSet.h:202
static const int ParaParamsStringLast
Definition: paraParamSet.h:133
virtual ~ParaParamSet()
destructor
Definition: paraParamSet.h:943
const char * allowedValues
allowed char parameter values
Definition: paraParamSet.h:652
size_t getParaParamsSize()
get parameter table size
class ParaParamChar
Definition: paraParamSet.h:648
void setDefaultValue()
set default value
Definition: paraParamSet.h:361
static const int ParaParamsBoolLast
Definition: paraParamSet.h:80
~ParaParamReal()
destructor
Definition: paraParamSet.h:560
static const int Deterministic
Definition: paraParamSet.h:76
class ParaParamString
Definition: paraParamSet.h:754
const char * getDefaultValue() const
get default value of this string parameter
Definition: paraParamSet.h:798
static const int ParaParamTypeBool
Types of parameters.
Definition: paraParamSet.h:58
const char * currentValue
current string parameter value
Definition: paraParamSet.h:757
static const int TagTraceFileName
Definition: paraParamSet.h:126
double getMaxValue() const
get maximum value of this long
Definition: paraParamSet.h:637
const char * getValue() const
get current value of this string parameter
Definition: paraParamSet.h:808
ParaParamString(const char *name, const char *inComment, const char *value)
constructor
Definition: paraParamSet.h:764
int getMaxValue() const
get maximum value of this int parameter
Definition: paraParamSet.h:401
char getValue() const
get current value of this char parameter
Definition: paraParamSet.h:704
~ParaParamLongint()
destructor
Definition: paraParamSet.h:442
const char * defaultValue
default string parameter value
Definition: paraParamSet.h:756
void setValue(int value)
set current value
Definition: paraParamSet.h:370
void setDefaultValue()
set default value of this char parameter
Definition: paraParamSet.h:713
double getValue() const
get current value of this real parameter
Definition: paraParamSet.h:589
static const int ParaParamsLongintN
Definition: paraParamSet.h:99
const char defaultValue
default char parameter value
Definition: paraParamSet.h:650
class ParaParamInt
Definition: paraParamSet.h:293
virtual size_t getNumIntParams()
get number of int parameters
bool isDefaultValue() const
check if current value is default value or not
Definition: paraParamSet.h:733
virtual size_t getNumLongintParams()
get number of longint parameters
long long getMinValue() const
get minimum value of this long int parameter
Definition: paraParamSet.h:510
static const int ParaParamsBoolFirst
Definition: paraParamSet.h:69
static const int LogTasksTransfer
Definition: paraParamSet.h:74
Base class of communicator for UG Framework.
static const int TagTrace
Definition: paraParamSet.h:72
static const int ParaParamsStringFirst
String parameters.
Definition: paraParamSet.h:123
int getValue() const
get current value of this int parameter
Definition: paraParamSet.h:352
int getDefaultValue() const
get default value of this int parameter
Definition: paraParamSet.h:342
static const int SolutionFilePath
Definition: paraParamSet.h:129
bool isDefaultValue() const
check if current value is default value or not
Definition: paraParamSet.h:618
void setDefaultValue()
set default value of this long int parameter
Definition: paraParamSet.h:480
const int defaultValue
default int parameter value
Definition: paraParamSet.h:295
const char * paramName
parameter name
Definition: paraParamSet.h:143
const char * getParamName() const
getter of parameter name
Definition: paraParamSet.h:172
class ParaParamSet
Definition: paraParamSet.h:850
bool isDefaultValue() const
check if current value is default value or not
Definition: paraParamSet.h:838
void setDefaultValue()
set default parameter value
Definition: paraParamSet.h:262
void setValue(long long value)
set current value of this long int parameter
Definition: paraParamSet.h:489
static const int NotificationSynchronization
Definition: paraParamSet.h:88
void read(ParaComm *comm, const char *filename)
read ParaParams from file
bool isDefaultValue() const
check if current value is default value or not
Definition: paraParamSet.h:381
~ParaParamString()
destructor
Definition: paraParamSet.h:778
double getDefaultValue() const
get default value of this real parameter
Definition: paraParamSet.h:579
int getType() const
get parameter type
Definition: paraParamSet.h:332
static const int CheckpointInterval
Definition: paraParamSet.h:107
const int maxValue
maximum int parameter value
Definition: paraParamSet.h:298
void setDefaultValue()
set default value of this real parameter
Definition: paraParamSet.h:598
virtual size_t getNumStringParams()
get number of string parameters
static const int ParaParamsRealFirst
Real parameters.
Definition: paraParamSet.h:103
static const int Quiet
Definition: paraParamSet.h:71
static const int NotificationInterval
Definition: paraParamSet.h:105
const int minValue
minimum int parameter value
Definition: paraParamSet.h:297
static const int ParaParamsLast
Definition: paraParamSet.h:135
static const int ParaParamsLongintLast
Definition: paraParamSet.h:98
ParaParamInt(const char *name, const char *inComment, int value, const int min, const int max)
contractor
Definition: paraParamSet.h:305
const double maxValue
maximum real parameter value
Definition: paraParamSet.h:535
size_t nParaParams
number of ParaParams
Definition: paraParamSet.h:855
char getDefaultValue() const
get default value of this char parameter
Definition: paraParamSet.h:694
ParaParam(const char *inParamName, const char *inComment)
constructor
Definition: paraParamSet.h:151
ParaParamLongint(const char *name, const char *inComment, long long value, const long long min, const long long max)
constructor
Definition: paraParamSet.h:424
static const int ParaParamsCharFirst
Char parameters.
Definition: paraParamSet.h:115
bool currentValue
current bool parameter value
Definition: paraParamSet.h:203
class ParaParamBool
Definition: paraParamSet.h:200
static const int LogSolvingStatus
Definition: paraParamSet.h:73
static const int ParaParamsRealLast
Definition: paraParamSet.h:110
static const int TimeLimit
Definition: paraParamSet.h:106
static const int ParaParamsRealN
Definition: paraParamSet.h:111
void setValue(double value)
set current value of this real parameter
Definition: paraParamSet.h:607
long long getValue() const
get current value of this long int parameter
Definition: paraParamSet.h:471
~ParaParamChar()
destructor
Definition: paraParamSet.h:675
const double defaultValue
default real parameter value
Definition: paraParamSet.h:532
static const int DynamicAdjustNotificationInterval
Definition: paraParamSet.h:78
static const int StatisticsToStdout
Definition: paraParamSet.h:77
virtual size_t getNumBoolParams()
get number of bool parameters
~ParaParamBool()
destructor
Definition: paraParamSet.h:224
int getType() const
get parameter type
Definition: paraParamSet.h:684
int getType() const
get parameter type
Definition: paraParamSet.h:569
static const int ParaParamsFirst
Bool parameters.
Definition: paraParamSet.h:68
static const int ParaParamsCharN
Definition: paraParamSet.h:119
int getType() const
get parameter type value
Definition: paraParamSet.h:233
static const int LogTasksTransferFilePath
Definition: paraParamSet.h:128
Base class of communicator object.
Definition: paraComm.h:101
int getType() const
get parameter type
Definition: paraParamSet.h:451
static const int ParaParamsLongintFirst
Longint parameters.
Definition: paraParamSet.h:95
ParaParam ** paraParams
array of ParaParams
Definition: paraParamSet.h:856
static const int ParaParamsIntLast
Definition: paraParamSet.h:90
static const int ParaParamTypeLongint
long integer values
Definition: paraParamSet.h:60
static const int CheckpointFilePath
Definition: paraParamSet.h:130
static const int ParaParamsSize
Definition: paraParamSet.h:136