25 std::transform(s.begin(), s.end(), s.begin(), (
int(*)(
int))
tolower);
37" Use a linear lifting strategy (aka swiping).\n"
38" - alternate: if 1, switches direction between forward and backward \n"
39" whenever the end of the list is reached (default: 0)\n"
42" Use a predecessor lifting strategy (aka worklist).\n"
43" - stack: if 1, removes elements from the end of the queue instead \n"
44" of the beginning (default: 0)\n"
46"focuslist:alternate:max_size:lift_ratio\n"
47" Use swiping + focus list lifting strategy.\n"
48" - alternate: see 'linear' (default: 0)\n"
49" - max_size: the maximum size of the focus list, either as an absolute size\n"
50" greater than 1, or as a ratio (between 0 and 1) of the total number of\n"
51" vertices (default: 0.1)\n"
52" - lift_ratio: the maximum number of lifting attempts performed on the\n"
53" focus list before switching back to swiping, as a ratio of the maximum\n"
54" focus list size (default: 10.0)\n"
57" Maximum measure propagation; a variant of the predecessor lifting strategy\n"
58" that prefers to lift vertices with higher progress measures.\n"
59" - order: tie-breaking lifting order: 0 (queue-like), 1 (stack-like)\n"
60" or 2 (heap order) (default: 2)\n"
63" Maximum step variant of maximum measure propagation.\n"
64" - order: see 'maxmeasure'\n"
67" Minimum measure propagation.\n"
68" - order: see 'maxmeasure'\n"
71" Old implementation of max. measure lifting strategy.\n"
72" Included for regression testing purposes only.\n"
75" Obsolete (roughly equivalent to predecessor:0:0).\n";
81 if (description.empty())
return NULL;
84 std::vector<std::string> parts;
85 std::string::size_type i, j;
86 for (i = 0; (j = description.find(
':', i)) != std::string::npos; i = j + 1)
88 parts.push_back(std::string(description, i, j - i));
90 parts.push_back(std::string(description, i, j));
92 std::string case_ =
tolower(parts[0]);
93 if ( case_ ==
"linear" || case_ ==
"lin" )
95 bool alternate = parts.size() > 1 && 0 != atoi(parts[1].c_str());
98 else if ( case_ ==
"predecessor" || case_ ==
"pred" )
100 bool stack = parts.size() > 1 && 0 != atoi(parts[1].c_str());
103 else if ( case_ ==
"focuslist" || case_ ==
"focus" )
105 bool alternate = parts.size() > 1 && 0 != atoi(parts[1].c_str());
106 double max_size = (parts.size() > 2 ? atof(parts[2].c_str()) : 0);
107 double lift_ratio = (parts.size() > 3 ? atof(parts[3].c_str()) : 0);
109 alternate, max_size, lift_ratio );
111 else if (case_ ==
"maxmeasure")
113 int order = (parts.size() > 1 ? atoi(parts[1].c_str()) : 2);
118 else if (case_ ==
"maxstep")
120 int order = (parts.size() > 1 ? atoi(parts[1].c_str()) : 2);
125 else if (case_ ==
"minmeasure")
127 int order = (parts.size() > 1 ? atoi(parts[1].c_str()) : 2);
132 else if (case_ ==
"oldmaxmeasure")
136 else if (case_ ==
"linpred")
static std::string tolower(std::string s)
Convert string to lowercase.
static LiftingStrategyFactory * create(const std::string &description)
static const char * usage()
virtual ~LiftingStrategyFactory()