50ParaParamSet::ParaParamSet(
53 : nParaParams(nInParaParams)
64 "# Set log output to minimal information [Default value: TRUE]",
68 "# Control log output of communication tags [Default value: FALSE]",
72 "# Control of solving status log [Default value: FALSE]",
76 "# Control output of tasks transfer log [Default value: FALSE]",
80 "# Control checkpointing functionality [Default value: FALSE]",
84 "# Control deterministic mode [Default value: FALSE]",
88 "# Control output of statistics to stdout [Default value: FALSE]",
91 "DynamicAdjustNotificationInterval",
92 "# Control dynamic adjustment of notification interval time [Default value: FALSE]",
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]",
103 "NotificationSynchronization",
104 "# Set notification synchronization strategy: 0 - always synchronize, 1 - collect in every iteration, 2 - no synchronization [Default value: 0]",
113 "NotificationInterval",
114 "# Set interval between notifications from active solver of its solvers status to LoadCoordinator. [Default: 1.0][0.0, DBL_MAX]",
120 "# Time limit for computation. -1.0 means no time limit. [Default: -1.0] [-1.0, DBL_MAX]",
125 "CheckpointInterval",
126 "# Time interval between checkpoints. [Default: 3600.0] [5.0, 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]",
142 "# Path for temporary files [Default: /tmp/]",
146 "# Filename for tag trace log [Default: std::cout]",
149 "LogSolvingStatusFilePath",
150 "# Path to solving statuses log [Default: ./]",
153 "LogTasksTransferFilePath",
154 "# Path to tasks transfer log [Default: ./]",
158 "# Path to output solution [Default: ./]",
161 "CheckpointFilePath",
162 "# Path to checkpoint files [Default: ./]",
165 "RacingParamsDirPath",
166 "# Path racing parameter configuration files. \"\" means to use default racing set. [Default: \"\"]",
191 return paraParamBool->
setValue(value);
245 return paraParamInt->
setValue(value);
288 return paraParamLongint->
getValue();
461 char *str =
new char[std::strlen(value) + 1];
462 std::strcpy(str, value);
503 assert(valuestr != NULL);
504 if( std::string(valuestr) == std::string(
"TRUE") )
508 else if( std::string(valuestr) == std::string(
"FALSE") )
514 std::cout <<
"Invalid parameter value <" << valuestr
515 <<
"> for ParaParam_Bool parameter <"
530 assert(valuestr != NULL);
531 if( std::sscanf(valuestr,
"%d", &value) == 1 )
533 if( value >= paraParamInt->
getMinValue() && value <= paraParamInt->getMaxValue() )
544 std::cout <<
"Invalid parameter value <" << valuestr
545 <<
"> for int parameter <"
560 assert(valuestr != NULL);
561 if( std::sscanf(valuestr,
"%lld", &value) == 1 )
563 if( value >= paraParamLongint->
getMinValue() && value <= paraParamLongint->getMaxValue() )
574 std::cout <<
"Invalid parameter value <" << valuestr
575 <<
"> for longint parameter <"
576 << paraParamLongint->
getParamName() <<
">" << std::endl;
590 assert(valuestr != NULL);
591 if( std::sscanf(valuestr,
"%lf", &value) == 1 )
593 if( value >= paraParamReal->
getMinValue() && value <= paraParamReal->getMaxValue() )
604 std::cout <<
"Invalid parameter value <" << valuestr
605 <<
"> for real parameter <"
620 assert(valuestr != NULL);
621 if( std::sscanf(valuestr,
"%c", &value) == 1 )
624 char cString[2]; cString[0] = value; cString[1] =
'\0';
625 if( allowedString.find(cString) != std::string::npos )
636 std::cout <<
"Invalid parameter value <" << valuestr
637 <<
"> for char parameter <"
651 assert(valuestr != NULL);
654 size_t len = std::strlen(valuestr);
655 if( len <= 1 || valuestr[0] !=
'"' || valuestr[len-1] !=
'"' )
657 std::cout <<
"Invalid parameter value <" << valuestr
658 <<
"> for string parameter <"
663 valuestr[len-1] =
'\0';
665 char *paramValue =
new char[strlen(valuestr) + 1 ];
666 strcpy(paramValue, valuestr);
667 paraParamString->
setValue(paramValue);
676 std::map<std::string, int> &mapStringToId
685 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
687 if( *line ==
'\0' || *line ==
'\n' || *line ==
'#' )
692 while( *line !=
' ' && *line !=
'\t' && *line !=
'\r' && *line !=
'\n' && *line !=
'#' && *line !=
'\0' && *line !=
'=' )
705 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
709 std::cout <<
"Character '=' was expected after the parameter name" << std::endl;
716 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
718 if( *line ==
'\0' || *line ==
'\n' || *line ==
'#' )
720 std::cout <<
"Parameter value is missing" << std::endl;
723 paramvaluestr = line;
726 quoted = (*paramvaluestr ==
'"');
728 while( (quoted || (*line !=
' ' && *line !=
'\t' && *line !=
'\r' && *line !=
'\n' && *line !=
'#')) && *line !=
'\0' )
734 if( lastquote != NULL )
738 else if( *line !=
'\0' )
743 while( *line ==
' ' || *line ==
'\t' || *line ==
'\r' )
745 if( *line !=
'\0' && *line !=
'\n' && *line !=
'#' )
747 std::cout <<
"Additional characters after parameter value" << std::endl;
752 std::map<std::string, int>::iterator pos;
753 pos = mapStringToId.find(paramname);
754 if( pos == mapStringToId.end() )
756 std::cout <<
"Unknown parameter <" << paramname <<
">" << std::endl;
759 int paramId = pos->second;
775 std::cout <<
"Unknown parameter type" << std::endl;
786 const int MaxLineSize = 1024;
787 char line[MaxLineSize];
792 std::cout <<
"Cannot open ParaParams read file: file name = " << filename << std::endl;
796 std::map<std::string, int> mapStringToId;
801 mapStringToId.insert(std::make_pair(
paraParams[i]->getParamName(),i));
805 while( ifs.getline(line, MaxLineSize) )
811 std::cout <<
"Input error in file <" << filename <<
"> line " << lineNo << std::endl;
820 std::cout <<
"Cannot compile checkpointing without zlib. Checkpoint must be FALSE." << std::endl;
831 bool comments =
false;
832 bool onlyChanged =
false;
862 *os << paraParamBool->
getComment() << std::endl;
864 *os << paraParamBool->
getParamName() <<
" = " << ( ( paraParamBool->
getValue() == true ) ?
"TRUE" :
"FALSE" ) << std::endl << std::endl;
869 *os << paraParamBool->
getComment() << std::endl;
871 *os << paraParamBool->
getParamName() <<
" = " << ( ( paraParamBool->
getValue() == true ) ?
"TRUE" :
"FALSE" ) << std::endl << std::endl;
883 *os << paraParamInt->
getComment() << std::endl;
885 *os << paraParamInt->
getParamName() <<
" = " << paraParamInt->
getValue() << std::endl<< std::endl;
892 *os << paraParamInt->
getComment() << std::endl;
894 *os << paraParamInt->
getParamName() <<
" = " << paraParamInt->
getValue() << std::endl << std::endl;
906 *os << paraParamLongint->
getComment() << std::endl;
908 *os << paraParamLongint->
getParamName() <<
" = " << paraParamLongint->
getValue() << std::endl << std::endl;
915 *os << paraParamLongint->
getComment() << std::endl;
917 *os << paraParamLongint->
getParamName() <<
" = " << paraParamLongint->
getValue() << std::endl << std::endl;
929 *os << paraParamReal->
getComment() << std::endl;
931 *os << paraParamReal->
getParamName() <<
" = " << paraParamReal->
getValue() << std::endl << std::endl;
938 *os << paraParamReal->
getComment() << std::endl;
940 *os << paraParamReal->
getParamName() <<
" = " << paraParamReal->
getValue() << std::endl << std::endl;
952 *os << paraParamChar->
getComment() << std::endl;
954 *os << paraParamChar->
getParamName() <<
" = " << paraParamChar->
getValue() << std::endl << std::endl;
961 *os << paraParamChar->
getComment() << std::endl;
963 *os << paraParamChar->
getParamName() <<
" = " << paraParamChar->
getValue() << std::endl << std::endl;
976 *os << paraParamString->
getComment() << std::endl;
978 *os << paraParamString->
getParamName() <<
" = \"" << paraParamString->
getValue() <<
"\"" << std::endl << std::endl;
985 *os << paraParamString->
getComment() << std::endl;
987 *os << paraParamString->
getParamName() <<
" = \"" << paraParamString->
getValue() <<
"\"" << std::endl << std::endl;
992 std::cout <<
"Unknown parameter type" << std::endl;
993 throw "Unknown parameter type";
Base class of communicator object.
void setDefaultValue()
set default parameter value
bool isDefaultValue() const
check if current value is default value or not
bool getValue() const
get current parameter value
bool getDefaultValue() const
get default parameter value
void setValue(bool value)
set parameter value
char getValue() const
get current value of this char parameter
void setDefaultValue()
set default value of this char parameter
bool isDefaultValue() const
check if current value is default value or not
char getDefaultValue() const
get default value of this char parameter
const char * getAllowedValues() const
get all allowed char parameter values
void setValue(char value)
set current value of this char parameter
void setValue(int value)
set current value
void setDefaultValue()
set default value
int getMinValue() const
get minimum value of this int parameter
bool isDefaultValue() const
check if current value is default value or not
int getDefaultValue() const
get default value of this int parameter
int getValue() const
get current value of this int parameter
void setDefaultValue()
set default value of this long int parameter
bool isDefaultValue() const
check if current value is default value or not
void setValue(long long value)
set current value of this long int parameter
long long getMinValue() const
get minimum value of this long int parameter
long long getDefaultValue() const
get default value of this long int parameter
long long getValue() const
get current value of this long int parameter
void setValue(double value)
set current value of this real parameter
void setDefaultValue()
set default value of this real parameter
bool isDefaultValue() const
check if current value is default value or not
double getDefaultValue() const
get default value of this real parameter
double getValue() const
get current value of this real parameter
double getMinValue() const
get minimum value of this long int parameter
bool getBoolParamValue(int param)
get bool parameter value
size_t nParaParams
number of ParaParams
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
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
void setDefaultValue()
set default value of this string parameter
void setValue(const char *value)
set current value of this sting parameter
const char * getDefaultValue() const
get default value of this string parameter
bool isDefaultValue() const
check if current value is default value or not
const char * getValue() const
get current value of this string parameter
const char * getParamName() const
getter of parameter name
const char * getComment() const
getter of comments string
static ScipParaCommTh * comm
static const int RacingParamsDirPath
static const int ParaParamTypeInt
integer values
static const int CheckpointInterval
static const int TempFilePath
static const int FinalCheckpointGeneratingTime
static const int ParaParamTypeReal
real values
static const int LogTasksTransferFilePath
static const int SolutionFilePath
static const int NotificationInterval
static const int NotificationSynchronization
static const int OutputParaParams
static const int LogSolvingStatus
static const int CheckpointFilePath
static const int LogSolvingStatusFilePath
static const int ParaParamTypeLongint
long integer values
static const int TimeLimit
static const int ParaParamTypeChar
characters
static const int Checkpoint
static const int Deterministic
static const int ParaParamTypeBool
Types of parameters.
static const int TagTraceFileName
static const int ParaParamTypeString
arrays of characters
static const int LogTasksTransfer
static const int DynamicAdjustNotificationInterval
static const int TagTrace
static const int StatisticsToStdout
Base class of communicator for UG Framework.
Parameter set for UG framework.
#define OUTPUT_PARAM_VALUE_ERROR(msg1, msg2, msg3, msg4)