本文整理汇总了C++中OutputVariable::setLockValidOutput方法的典型用法代码示例。如果您正苦于以下问题:C++ OutputVariable::setLockValidOutput方法的具体用法?C++ OutputVariable::setLockValidOutput怎么用?C++ OutputVariable::setLockValidOutput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputVariable
的用法示例。
在下文中一共展示了OutputVariable::setLockValidOutput方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: edit
void Variable::edit(const OutputVariable* outputVariable) {
variable->setMinimum(outputVariable->getMinimum());
variable->setMaximum(outputVariable->getMaximum());
for (int i = 0; i < outputVariable->numberOfTerms(); ++i) {
this->variable->addTerm(outputVariable->getTerm(i)->copy());
}
scalar singleStep = (variable->getMaximum() - variable->getMinimum()) / 100;
ui->sbx_min->setSingleStep(std::max(scalar(0.01), singleStep));
ui->sbx_max->setSingleStep(std::max(scalar(0.01), singleStep));
setWindowTitle("Edit variable");
ui->led_name->setText(QString::fromStdString(outputVariable->getName()));
ui->cbx_enabled->setChecked(outputVariable->isEnabled());
OutputVariable* editable = dynamic_cast<OutputVariable*> (this->variable);
editable->setDefaultValue(outputVariable->getDefaultValue());
editable->setLastValidOutput(fl::nan);
editable->setLockValidOutput(outputVariable->isLockingValidOutput());
editable->setLockOutputRange(outputVariable->isLockingOutputRange());
editable->fuzzyOutput()->setAccumulation(outputVariable->fuzzyOutput()->getAccumulation());
Defuzzifier* defuzzifier = outputVariable->getDefuzzifier();
// if (not defuzzifier) {
// defuzzifier = Factory::instance()->defuzzifier()->
// create(Centroid().className(), fl::fuzzylite::defaultDivisions());
// }
editable->setDefuzzifier(defuzzifier);
reloadModel();
}
示例2: processOutputVariable
void FllImporter::processOutputVariable(const std::string& block, Engine* engine) const {
std::istringstream reader(block);
std::string line;
OutputVariable* outputVariable = new OutputVariable;
engine->addOutputVariable(outputVariable);
while (std::getline(reader, line)) {
std::pair<std::string, std::string> keyValue = parseKeyValue(line, ':');
if ("OutputVariable" == keyValue.first) {
outputVariable->setName(keyValue.second);
} else if ("enabled" == keyValue.first) {
outputVariable->setEnabled(parseBoolean(keyValue.second));
} else if ("range" == keyValue.first) {
std::pair<scalar, scalar> range = parseRange(keyValue.second);
outputVariable->setRange(range.first, range.second);
} else if ("default" == keyValue.first) {
outputVariable->setDefaultValue(Op::toScalar(keyValue.second));
} else if ("lock-valid" == keyValue.first) {
outputVariable->setLockValidOutput(parseBoolean(keyValue.second));
} else if ("lock-range" == keyValue.first) {
outputVariable->setLockOutputRange(parseBoolean(keyValue.second));
} else if ("defuzzifier" == keyValue.first) {
outputVariable->setDefuzzifier(parseDefuzzifier(keyValue.second));
} else if ("accumulation" == keyValue.first) {
outputVariable->fuzzyOutput()->setAccumulation(parseSNorm(keyValue.second));
} else if ("term" == keyValue.first) {
outputVariable->addTerm(parseTerm(keyValue.second, engine));
} else {
throw fl::Exception("[import error] key <" + keyValue.first + "> not "
"recognized in pair <" + keyValue.first + ":" + keyValue.second + ">", FL_AT);
}
}
}
示例3: accept
void Variable::accept() {
OutputVariable* outputVariable = dynamic_cast<OutputVariable*> (variable);
if (outputVariable) {
try {
outputVariable->setDefaultValue(
fl::Op::toScalar(ui->led_default->text().toStdString()));
} catch (fl::Exception& ex) {
std::ostringstream message;
message << ex.what() << std::endl <<
"Expected numeric values (including nan or inf)" << std::endl;
QMessageBox::critical(this, tr("Error"),
fl::qt::Window::toHtmlEscaped(
QString::fromStdString(message.str())),
QMessageBox::Ok);
return;
}
outputVariable->setLockValidOutput(ui->chx_lock_valid->isChecked());
outputVariable->setLockOutputRange(ui->chx_lock_range->isChecked());
SNorm* accumulation = FactoryManager::instance()->snorm()->createInstance(
ui->cbx_accumulation->currentText().toStdString());
outputVariable->fuzzyOutput()->setAccumulation(accumulation);
Defuzzifier* defuzzifier = NULL;
if (ui->cbx_defuzzifier->currentIndex() >= 0) {
defuzzifier = FactoryManager::instance()->defuzzifier()->createInstance(
ui->cbx_defuzzifier->currentText().toStdString());
IntegralDefuzzifier* integralDefuzzifier =
dynamic_cast<IntegralDefuzzifier*> (defuzzifier);
if (integralDefuzzifier) {
integralDefuzzifier->setResolution(ui->sbx_accuracy->value());
}
}
outputVariable->setDefuzzifier(defuzzifier);
}
variable->setName(fl::Op::makeValidId(ui->led_name->text().toStdString()));
variable->setEnabled(ui->cbx_enabled->isChecked());
QDialog::accept();
}