本文整理汇总了C++中OutputVariable::getDefuzzifier方法的典型用法代码示例。如果您正苦于以下问题:C++ OutputVariable::getDefuzzifier方法的具体用法?C++ OutputVariable::getDefuzzifier怎么用?C++ OutputVariable::getDefuzzifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputVariable
的用法示例。
在下文中一共展示了OutputVariable::getDefuzzifier方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: applyDefaults
void Preferences::applyDefaults() {
fl::Engine* engine = Model::Default()->engine();
if (engine->numberOfRuleBlocks() == 0) {
QMessageBox::critical(this, "Error",
"Current engine has no rule blocks. "
"At least one ruleblock was expected.",
QMessageBox::Ok);
return;
}
std::string tnorm = Minimum().className();
std::string snorm = Maximum().className();
std::string activation = Minimum().className();
RuleBlock* ruleblock = engine->getRuleBlock(0);
if (ruleblock->getTnorm()) tnorm = ruleblock->getTnorm()->className();
if (ruleblock->getSnorm()) snorm = ruleblock->getSnorm()->className();
if (ruleblock->getActivation()) activation = ruleblock->getActivation()->className();
std::string defuzzifier = Centroid().className();
int divisions = fl::fuzzylite::defaultDivisions();
std::string accumulation = Maximum().className();
if (engine->numberOfOutputVariables() > 0) {
OutputVariable* variable = engine->getOutputVariable(0);
if (variable->getDefuzzifier()) {
defuzzifier = variable->getDefuzzifier()->className();
divisions = variable->getDefuzzifier()->getDivisions();
}
if (variable->output()->getAccumulation())
accumulation = variable->output()->getAccumulation()->className();
}
engine->configure(tnorm, snorm, activation, accumulation, defuzzifier, divisions);
}
示例2: reloadModel
void Variable::reloadModel() {
if (ui->btn_sort_centroid->isChecked()) {
variable->sort();
}
ui->lvw_terms->clear();
for (int i = 0; i < variable->numberOfTerms(); ++i) {
fl::Term* term = variable->getTerm(i);
std::string text = term->getName() + " " + term->className()
+ " " + term->parameters();
QListWidgetItem* item = new QListWidgetItem;
item->setText(QString::fromStdString(text));
item->setToolTip(QString::fromStdString(text));
ui->lvw_terms->addItem(item);
}
OutputVariable* outputVariable = dynamic_cast<OutputVariable*> (variable);
if (outputVariable) {
ui->led_default->setText(QString::number(outputVariable->getDefaultValue()));
ui->chx_lock_range->setChecked(outputVariable->isLockingOutputRange());
ui->chx_lock_valid->setChecked(outputVariable->isLockingValidOutput());
if (outputVariable->fuzzyOutput()->getAccumulation()) {
ui->cbx_accumulation->setCurrentIndex(
ui->cbx_accumulation->findText(
QString::fromStdString(
outputVariable->fuzzyOutput()->getAccumulation()->className())));
} else {
ui->cbx_accumulation->setCurrentIndex(-1);
}
if (outputVariable->getDefuzzifier()) {
ui->cbx_defuzzifier->setCurrentIndex(
ui->cbx_defuzzifier->findText(
QString::fromStdString(
outputVariable->getDefuzzifier()->className())));
IntegralDefuzzifier* integralDefuzzifier =
dynamic_cast<IntegralDefuzzifier*> (outputVariable->getDefuzzifier());
if (integralDefuzzifier) {
ui->sbx_accuracy->setValue(integralDefuzzifier->getResolution());
}
} else {
ui->cbx_defuzzifier->setCurrentIndex(-1);
}
}
scalar minimum = variable->getMinimum();
scalar maximum = variable->getMaximum();
ui->sbx_min->setValue(minimum);
ui->sbx_max->setValue(maximum);
ui->btn_term_down->setEnabled(not ui->btn_sort_centroid->isChecked()
and ui->lvw_terms->selectedItems().size() > 0);
ui->btn_term_up->setEnabled(not ui->btn_sort_centroid->isChecked()
and ui->lvw_terms->selectedItems().size() > 0);
redraw();
}
示例3: onChangeDivisions
void Preferences::onChangeDivisions(int value) {
fl::Engine* engine = Model::Default()->engine();
for (int i = 0; i < engine->numberOfOutputVariables(); ++i) {
OutputVariable* outputVariable = engine->getOutputVariable(i);
outputVariable->getDefuzzifier()->setDivisions(value);
}
}
示例4: loadFromModel
void Preferences::loadFromModel() {
disconnect();
fl::Engine* engine = Model::Default()->engine();
if (engine->numberOfRuleBlocks() == 0) {
QMessageBox::critical(this, "Error",
"Current engine has no rule blocks. "
"At least one ruleblock was expected.",
QMessageBox::Ok);
return;
}
RuleBlock* ruleblock = engine->getRuleBlock(0);
ui->cbx_tnorm->setCurrentIndex(indexOfTnorm(ruleblock->getTnorm()->className()));
ui->cbx_snorm->setCurrentIndex(indexOfSnorm(ruleblock->getSnorm()->className()));
ui->cbx_activation->setCurrentIndex(indexOfTnorm(ruleblock->getActivation()->className()));
if (engine->numberOfOutputVariables() > 0) {
OutputVariable* variable = engine->getOutputVariable(0);
ui->cbx_defuzzifier->setCurrentIndex(
indexOfDefuzzifier(variable->getDefuzzifier()->className()));
ui->sbx_divisions->setValue(variable->getDefuzzifier()->getDivisions());
ui->cbx_accumulation->setCurrentIndex(
indexOfSnorm(variable->output()->getAccumulation()->className()));
} else {
ui->cbx_defuzzifier->setCurrentIndex(0);
ui->sbx_divisions->setValue(fl::fuzzylite::defaultDivisions());
ui->cbx_accumulation->setCurrentIndex(0);
}
ui->ckx_any->setChecked(engine->hasHedge(Any().name()));
ui->ckx_extremely->setChecked(engine->hasHedge(Extremely().name()));
ui->ckx_not->setChecked(engine->hasHedge(Not().name()));
ui->ckx_seldom->setChecked(engine->hasHedge(Seldom().name()));
ui->ckx_somewhat->setChecked(engine->hasHedge(Somewhat().name()));
ui->ckx_very->setChecked(engine->hasHedge(Very().name()));
connect();
}