本文整理汇总了C++中Strategy::setDoeSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Strategy::setDoeSize方法的具体用法?C++ Strategy::setDoeSize怎么用?C++ Strategy::setDoeSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Strategy
的用法示例。
在下文中一共展示了Strategy::setDoeSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseStrategies
void File::parseStrategies(TiXmlNode* s){
int tries;
s->ToElement()->QueryIntAttribute("tries",&tries);
for(TiXmlElement* pElem=s->FirstChild()->ToElement();pElem != NULL; pElem=pElem->NextSiblingElement()){
string type = pElem->Attribute("type");
// Strategy to add with memoization option
Strategy *s = NULL;
if(type.compare("doe") == 0){
s = new DesignOfExperiments();
s->setDoeSize(128);
}
else if(type.compare("random_greedy") == 0){
s = new RandomGreedy();
}
else if(type.compare("hill_climbing") == 0){
s = new HillClimbing();
}
else if(type.compare("genetic") == 0){
s = new Genetic();
}
// Always memoization
s->setMemo(true);
// Add to list
int intValue;
string strValue;
double doubValue;
if(pElem->QueryIntAttribute("doesize",&intValue) != TIXML_NO_ATTRIBUTE){
s->setDoeSize(intValue);
}
if(pElem->QueryValueAttribute("onlynew",&strValue) != TIXML_NO_ATTRIBUTE){
bool newRandom = to_bool(strValue);
s->setOnlyNewRandom(newRandom);
}
if(pElem->QueryValueAttribute("random",&strValue) != TIXML_NO_ATTRIBUTE){
bool randomInit = to_bool(strValue);
s->setRandomInit(randomInit);
}
// if(pElem->QueryValueAttribute("memoization",&strValue) != TIXML_NO_ATTRIBUTE){
// bool memo = to_bool(strValue);
// s->setMemo(memo);
// }
if(pElem->QueryValueAttribute("limit_energy",&doubValue) != TIXML_NO_ATTRIBUTE){
limit_t l;
l.amountType = ENERGY;
l.amount = doubValue;
s->setLimited(true);
s->setLimitType(l);
s->setMemo(true);
}
if(pElem->QueryValueAttribute("limit_duration",&doubValue) != TIXML_NO_ATTRIBUTE){
limit_t l;
l.amountType = DURATION;
l.amount = doubValue;
s->setLimited(true);
s->setLimitType(l);
s->setMemo(true);
}
if(pElem->QueryValueAttribute("limit_memory",&doubValue) != TIXML_NO_ATTRIBUTE){
limit_t l;
l.amountType = MEMORY;
l.amount = doubValue;
s->setLimited(true);
s->setLimitType(l);
s->setMemo(true);
}
if(pElem->QueryValueAttribute("hit_percent",&doubValue) != TIXML_NO_ATTRIBUTE){
s->fillToHitPercent = true;
s->setHitPercentGoal(doubValue);
s->setMemo(true);
}
if(pElem->QueryValueAttribute("doeLimits",&strValue) != TIXML_NO_ATTRIBUTE){
bool doeLimits = to_bool(strValue);
s->setDoeLimits(doeLimits);
s->setDoeSize(128);
}
//tfunc format (line|cons|temp)tp1[:tp2] Ex: "line|5.0|1.0"
if(pElem->QueryValueAttribute("tfunc",&strValue) != TIXML_NO_ATTRIBUTE){
string func,tp1_str,tp2_str;
temp_func function;
int delim;
float tp1 = 0,tp2 = 0;
// Function is first 4 characters
func = strValue.substr(0,4);
strValue = strValue.substr(4+1,strValue.length()-4-1);
// One parameter function
if(func.compare("cons") == 0){
function = CONSTANT;
tp1_str = strValue.c_str();
}
// Two parameter function
else{
if(func.compare("line") == 0){
function = LINEAR;
//.........这里部分代码省略.........