本文整理汇总了C++中ParameterSet::addArguments方法的典型用法代码示例。如果您正苦于以下问题:C++ ParameterSet::addArguments方法的具体用法?C++ ParameterSet::addArguments怎么用?C++ ParameterSet::addArguments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterSet
的用法示例。
在下文中一共展示了ParameterSet::addArguments方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defaultExecution
void defaultExecution(SysEnv &sysEnv, std::string &metricType, RegionTemplateCollection *rtCollection,
std::string tuningPolicy,
float *perf, float *totaldiffs, float *metricPerIteration,
float *diceNotCoolPerIteration,
uint64_t *totalexecutiontimes) {
int versionNorm = 0, versionSeg = 0;
int segCount = 0;
std::vector<int> segComponentIds[rtCollection->getNumRTs()];
std::vector<int> metricComponentIds[rtCollection->getNumRTs()];
std::vector<int> diceNotCoolComponentIds[rtCollection->getNumRTs()];
// Build application dependency graph
// Instantiate application dependency graph
for (int i = 0; i < rtCollection->getNumRTs(); i++) {
int previousSegCompId = 0;
// CREATE NORMALIZATION STEP
ParameterSet parSetNormalization;
std::vector<ArgumentBase *> targetMeanOptions;
ArgumentFloatArray *targetMeanAux = new ArgumentFloatArray(ArgumentFloat(-0.632356));
targetMeanAux->addArgValue(ArgumentFloat(-0.0516004));
targetMeanAux->addArgValue(ArgumentFloat(0.0376543));
targetMeanOptions.push_back(targetMeanAux);
parSetNormalization.addArguments(targetMeanOptions);
parSetNormalization.resetIterator();
std::vector<ArgumentBase *> argSetInstanceNorm = parSetNormalization.getNextArgumentSetInstance();
NormalizationComp *norm = new NormalizationComp();
// normalization parameters
norm->addArgument(new ArgumentInt(versionNorm));
norm->addArgument(argSetInstanceNorm[0]);
norm->addRegionTemplateInstance(rtCollection->getRT(i), rtCollection->getRT(i)->getName());
sysEnv.executeComponent(norm);
std::cout << "BEGIN: Default Execution: ";
std::cout << std::endl;
// Creating segmentation component
Segmentation *seg = new Segmentation();
// version of the data region red. Each parameter instance in norm creates a output w/ different version
seg->addArgument(new ArgumentInt(versionNorm));
// version of the data region generated by the segmentation stage
seg->addArgument(new ArgumentInt(versionSeg));
int blue = 220;
int green = 220;
int red = 220;
float T1 = 5.0;
float T2 = 4.0;
int G1 = 80;
int minSize = 11;
int maxSize = 1000;
int G2 = 45;
int minSizePl = 30;
int minSizeSeg = 21;
int maxSizeSeg = 1000;
int fillHolesConnectivity = 4;
int reconConnectivity = 8;
int watershedConnectivity = 8;
// add remaining (application specific) parameters from the argSegInstance
seg->addArgument(new ArgumentInt(
(int) round(blue)));
seg->addArgument(new ArgumentInt(
(int) round(green)));
seg->addArgument(new ArgumentInt(
(int) round(red)));
seg->addArgument(
new ArgumentFloat((float) (T1)));
seg->addArgument(
new ArgumentFloat((float) (T2)));
seg->addArgument(new ArgumentInt(
(int) round(G1)));
seg->addArgument(new ArgumentInt(
(int) round(G2)));
seg->addArgument(new ArgumentInt(
(int) round(minSize)));
seg->addArgument(new ArgumentInt(
(int) round(maxSize)));
seg->addArgument(new ArgumentInt(
(int) round(minSizePl)));
seg->addArgument(new ArgumentInt(
(int) round(minSizeSeg)));
seg->addArgument(new ArgumentInt(
(int) round(maxSizeSeg)));
seg->addArgument(new ArgumentInt(
(int) round(fillHolesConnectivity)));
seg->addArgument(new ArgumentInt(
(int) round(reconConnectivity)));
seg->addArgument(new ArgumentInt(
(int) round(watershedConnectivity)));
// and region template instance that it is suppose to process
seg->addRegionTemplateInstance(rtCollection->getRT(i), rtCollection->getRT(i)->getName());
seg->addDependency(norm->getId());
//.........这里部分代码省略.........
示例2: ArgumentFloat
//.........这里部分代码省略.........
iterator != tuningClient->getParamSet(i)->paramSet.end(); iterator++) {
//iterator.first key
//iterator.second value
oss << " - " << iterator->first << ": " << *(iterator->second);
}
// / if not found in performance database
if (perfDataBase.find(oss.str()) != perfDataBase.end()) {
perf[tuningClient->getIteration() * numClients +
(i)] = perfDataBase.find(oss.str())->second;
std::cout << "Parameters already tested: " << oss.str() << " perf: " << perf << std::endl;
executedAlready[i] = true;
} else {
executedAlready[i] = false;
}
}
int segCount = 0;
// Build application dependency graph
// Instantiate application dependency graph
for (int i = 0; i < rtCollection->getNumRTs(); i++) {
int previousSegCompId = 0;
// CREATE NORMALIZATION STEP
ParameterSet parSetNormalization;
std::vector<ArgumentBase *> targetMeanOptions;
ArgumentFloatArray *targetMeanAux = new ArgumentFloatArray(ArgumentFloat(-0.632356));
targetMeanAux->addArgValue(ArgumentFloat(-0.0516004));
targetMeanAux->addArgValue(ArgumentFloat(0.0376543));
targetMeanOptions.push_back(targetMeanAux);
parSetNormalization.addArguments(targetMeanOptions);
parSetNormalization.resetIterator();
std::vector<ArgumentBase *> argSetInstanceNorm = parSetNormalization.getNextArgumentSetInstance();
NormalizationComp *norm = new NormalizationComp();
// normalization parameters
norm->addArgument(new ArgumentInt(versionNorm));
norm->addArgument(argSetInstanceNorm[0]);
norm->addRegionTemplateInstance(rtCollection->getRT(i), rtCollection->getRT(i)->getName());
sysEnv.executeComponent(norm);
for (int j = 0; j < numClients; j++) {
if (executedAlready[j] == false) {
std::cout << "BEGIN: LoopIdx: " << tuningClient->getIteration() * numClients + (j);
typedef std::map<std::string, double *>::iterator it_type;
for (it_type iterator = tuningClient->getParamSet(j)->paramSet.begin();
iterator != tuningClient->getParamSet(j)->paramSet.end(); iterator++) {
std::cout << " - " << iterator->first << ": " << *(iterator->second);
}
std::cout << std::endl;
// Creating segmentation component
Segmentation *seg = new Segmentation();
// version of the data region red. Each parameter instance in norm creates a output w/ different version
seg->addArgument(new ArgumentInt(versionNorm));
// version of the data region generated by the segmentation stage
seg->addArgument(new ArgumentInt(versionSeg));
// add remaining (application specific) parameters from the argSegInstance