当前位置: 首页>>代码示例>>C++>>正文


C++ OutputVariable::setDefuzzifier方法代码示例

本文整理汇总了C++中OutputVariable::setDefuzzifier方法的典型用法代码示例。如果您正苦于以下问题:C++ OutputVariable::setDefuzzifier方法的具体用法?C++ OutputVariable::setDefuzzifier怎么用?C++ OutputVariable::setDefuzzifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OutputVariable的用法示例。


在下文中一共展示了OutputVariable::setDefuzzifier方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
        }
开发者ID:maciek-slon,项目名称:Fuzzy,代码行数:31,代码来源:Variable.cpp

示例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);
         }
     }
 }
开发者ID:maciek-slon,项目名称:Fuzzy,代码行数:32,代码来源:FllImporter.cpp

示例3: main

int main(int argc, char** argv){
//Code automatically generated with jfuzzylite 6.0.

using namespace fl;

Engine* engine = new Engine;
engine->setName("tipper");
engine->setDescription("");

InputVariable* service = new InputVariable;
service->setName("service");
service->setDescription("");
service->setEnabled(true);
service->setRange(0.000, 10.000);
service->setLockValueInRange(false);
service->addTerm(new Gaussian("poor", 0.000, 1.500));
service->addTerm(new Gaussian("good", 5.000, 1.500));
service->addTerm(new Gaussian("excellent", 10.000, 1.500));
engine->addInputVariable(service);

InputVariable* food = new InputVariable;
food->setName("food");
food->setDescription("");
food->setEnabled(true);
food->setRange(0.000, 10.000);
food->setLockValueInRange(false);
food->addTerm(new Trapezoid("rancid", 0.000, 0.000, 1.000, 3.000));
food->addTerm(new Trapezoid("delicious", 7.000, 9.000, 10.000, 10.000));
engine->addInputVariable(food);

OutputVariable* tip = new OutputVariable;
tip->setName("tip");
tip->setDescription("");
tip->setEnabled(true);
tip->setRange(0.000, 30.000);
tip->setLockValueInRange(false);
tip->setAggregation(new Maximum);
tip->setDefuzzifier(new Centroid(200));
tip->setDefaultValue(fl::nan);
tip->setLockPreviousValue(false);
tip->addTerm(new Triangle("cheap", 0.000, 5.000, 10.000));
tip->addTerm(new Triangle("average", 10.000, 15.000, 20.000));
tip->addTerm(new Triangle("generous", 20.000, 25.000, 30.000));
engine->addOutputVariable(tip);

RuleBlock* ruleBlock = new RuleBlock;
ruleBlock->setName("");
ruleBlock->setDescription("");
ruleBlock->setEnabled(true);
ruleBlock->setConjunction(new Minimum);
ruleBlock->setDisjunction(new Maximum);
ruleBlock->setImplication(new Minimum);
ruleBlock->setActivation(new General);
ruleBlock->addRule(Rule::parse("if service is poor or food is rancid then tip is cheap", engine));
ruleBlock->addRule(Rule::parse("if service is good then tip is average", engine));
ruleBlock->addRule(Rule::parse("if service is excellent or food is delicious then tip is generous", engine));
engine->addRuleBlock(ruleBlock);


}
开发者ID:fuzzylite,项目名称:jfuzzylite,代码行数:60,代码来源:tipper.cpp

示例4: main

int main(int argc, char** argv){
//C++ code generated with fuzzylite 6.0.

using namespace fl;

Engine* engine = new Engine;
engine->setName("sltbu_fl");

InputVariable* distance = new InputVariable;
distance->setEnabled(true);
distance->setName("distance");
distance->setRange(0.000, 25.000);
distance->setLockValueInRange(false);
distance->addTerm(new ZShape("near", 1.000, 2.000));
distance->addTerm(new SShape("far", 1.000, 2.000));
engine->addInputVariable(distance);

InputVariable* control1 = new InputVariable;
control1->setEnabled(true);
control1->setName("control1");
control1->setRange(-0.785, 0.785);
control1->setLockValueInRange(false);
engine->addInputVariable(control1);

InputVariable* control2 = new InputVariable;
control2->setEnabled(true);
control2->setName("control2");
control2->setRange(-0.785, 0.785);
control2->setLockValueInRange(false);
engine->addInputVariable(control2);

OutputVariable* control = new OutputVariable;
control->setEnabled(true);
control->setName("control");
control->setRange(-0.785, 0.785);
control->setLockValueInRange(false);
control->fuzzyOutput()->setAggregation(fl::null);
control->setDefuzzifier(new WeightedAverage("TakagiSugeno"));
control->setDefaultValue(fl::nan);
control->setLockPreviousValue(false);
control->addTerm(Linear::create("out1mf1", engine, 0.000, 0.000, 1.000, 0.000));
control->addTerm(Linear::create("out1mf2", engine, 0.000, 1.000, 0.000, 0.000));
engine->addOutputVariable(control);

RuleBlock* ruleBlock = new RuleBlock;
ruleBlock->setEnabled(true);
ruleBlock->setName("");
ruleBlock->setConjunction(fl::null);
ruleBlock->setDisjunction(fl::null);
ruleBlock->setImplication(fl::null);
ruleBlock->setActivation(new General);
ruleBlock->addRule(Rule::parse("if distance is near then control is out1mf1", engine));
ruleBlock->addRule(Rule::parse("if distance is far then control is out1mf2", engine));
engine->addRuleBlock(ruleBlock);


}
开发者ID:NatalProductions,项目名称:fuzzylite,代码行数:57,代码来源:sltbu_fl.cpp

示例5: onChangeDefuzzifier

 void Preferences::onChangeDefuzzifier(int) {
     std::string defuzzifier = ui->cbx_defuzzifier->currentText().toStdString();
     fl::Engine* engine = Model::Default()->engine();
     for (int i = 0; i < engine->numberOfOutputVariables(); ++i) {
         OutputVariable* outputVariable = engine->getOutputVariable(i);
         outputVariable->setDefuzzifier(
                 Factory::instance()->defuzzifier()->create(defuzzifier));
     }
 }
开发者ID:DevasenaInupakutika,项目名称:assn2,代码行数:9,代码来源:Preferences.cpp

示例6: main

int main(int argc, char** argv) {
    using namespace fl;

    Engine* engine = new Engine;
    engine->setName("mam21");

    InputVariable* angle = new InputVariable;
    angle->setEnabled(true);
    angle->setName("angle");
    angle->setRange(-5.000, 5.000);
    angle->setLockValueInRange(false);
    angle->addTerm(new Bell("small", -5.000, 5.000, 8.000));
    angle->addTerm(new Bell("big", 5.000, 5.000, 8.000));
    engine->addInputVariable(angle);

    InputVariable* velocity = new InputVariable;
    velocity->setEnabled(true);
    velocity->setName("velocity");
    velocity->setRange(-5.000, 5.000);
    velocity->setLockValueInRange(false);
    velocity->addTerm(new Bell("small", -5.000, 5.000, 2.000));
    velocity->addTerm(new Bell("big", 5.000, 5.000, 2.000));
    engine->addInputVariable(velocity);

    OutputVariable* force = new OutputVariable;
    force->setEnabled(true);
    force->setName("force");
    force->setRange(-5.000, 5.000);
    force->setLockValueInRange(false);
    force->fuzzyOutput()->setAggregation(new Maximum);
    force->setDefuzzifier(new Centroid(200));
    force->setDefaultValue(fl::nan);
    force->setLockPreviousValue(false);
    force->addTerm(new Bell("negBig", -5.000, 1.670, 8.000));
    force->addTerm(new Bell("negSmall", -1.670, 1.670, 8.000));
    force->addTerm(new Bell("posSmall", 1.670, 1.670, 8.000));
    force->addTerm(new Bell("posBig", 5.000, 1.670, 8.000));
    engine->addOutputVariable(force);

    RuleBlock* ruleBlock = new RuleBlock;
    ruleBlock->setEnabled(true);
    ruleBlock->setName("");
    ruleBlock->setConjunction(new Minimum);
    ruleBlock->setDisjunction(new Maximum);
    ruleBlock->setImplication(new Minimum);
    ruleBlock->setActivation(new General);
    ruleBlock->addRule(fl::Rule::parse("if angle is small and velocity is small then force is negBig", engine));
    ruleBlock->addRule(fl::Rule::parse("if angle is small and velocity is big then force is negSmall", engine));
    ruleBlock->addRule(fl::Rule::parse("if angle is big and velocity is small then force is posSmall", engine));
    ruleBlock->addRule(fl::Rule::parse("if angle is big and velocity is big then force is posBig", engine));
    engine->addRuleBlock(ruleBlock);


}
开发者ID:rdoume,项目名称:fuzzylite,代码行数:54,代码来源:mam21.cpp

示例7: main

int main(int argc, char** argv){
using namespace fl;

Engine* engine = new Engine;
engine->setName("anfis");

InputVariable* inputVariable1 = new InputVariable;
inputVariable1->setEnabled(true);
inputVariable1->setName("in_n1");
inputVariable1->setRange(1.000, 31.000);
inputVariable1->setLockValueInRange(false);
inputVariable1->addTerm(new Bell("in1mf1", 2.253, 16.220, 5.050));
inputVariable1->addTerm(new Bell("in1mf2", 31.260, 15.021, 1.843));
engine->addInputVariable(inputVariable1);

InputVariable* inputVariable2 = new InputVariable;
inputVariable2->setEnabled(true);
inputVariable2->setName("in_n2");
inputVariable2->setRange(1.000, 31.000);
inputVariable2->setLockValueInRange(false);
inputVariable2->addTerm(new Bell("in2mf1", 0.740, 15.021, 1.843));
inputVariable2->addTerm(new Bell("in2mf2", 29.747, 16.220, 5.050));
engine->addInputVariable(inputVariable2);

OutputVariable* outputVariable = new OutputVariable;
outputVariable->setEnabled(true);
outputVariable->setName("out1");
outputVariable->setRange(-0.334, 1.000);
outputVariable->setLockValueInRange(false);
outputVariable->fuzzyOutput()->setAccumulation(fl::null);
outputVariable->setDefuzzifier(new WeightedAverage("TakagiSugeno"));
outputVariable->setDefaultValue(fl::nan);
outputVariable->setLockPreviousValue(false);
outputVariable->addTerm(Linear::create("out1mf1", engine, 0.026, 0.071, -0.615));
outputVariable->addTerm(Linear::create("out1mf2", engine, -0.036, 0.036, -1.169));
outputVariable->addTerm(Linear::create("out1mf3", engine, -0.094, 0.094, 2.231));
outputVariable->addTerm(Linear::create("out1mf4", engine, -0.071, -0.026, 2.479));
engine->addOutputVariable(outputVariable);

RuleBlock* ruleBlock = new RuleBlock;
ruleBlock->setEnabled(true);
ruleBlock->setName("");
ruleBlock->setConjunction(new AlgebraicProduct);
ruleBlock->setDisjunction(fl::null);
ruleBlock->setImplication(fl::null);
ruleBlock->addRule(fl::Rule::parse("if in_n1 is in1mf1 and in_n2 is in2mf1 then out1 is out1mf1", engine));
ruleBlock->addRule(fl::Rule::parse("if in_n1 is in1mf1 and in_n2 is in2mf2 then out1 is out1mf2", engine));
ruleBlock->addRule(fl::Rule::parse("if in_n1 is in1mf2 and in_n2 is in2mf1 then out1 is out1mf3", engine));
ruleBlock->addRule(fl::Rule::parse("if in_n1 is in1mf2 and in_n2 is in2mf2 then out1 is out1mf4", engine));
engine->addRuleBlock(ruleBlock);


}
开发者ID:ecksun,项目名称:fuzzylite,代码行数:53,代码来源:membrn1.cpp

示例8: main

int main(int argc, char** argv){
using namespace fl;

Engine* engine = new Engine;
engine->setName("tipper");

InputVariable* inputVariable1 = new InputVariable;
inputVariable1->setEnabled(true);
inputVariable1->setName("service");
inputVariable1->setRange(0.000, 10.000);
inputVariable1->setLockValueInRange(false);
inputVariable1->addTerm(new Gaussian("poor", 0.000, 1.500));
inputVariable1->addTerm(new Gaussian("good", 5.000, 1.500));
inputVariable1->addTerm(new Gaussian("excellent", 10.000, 1.500));
engine->addInputVariable(inputVariable1);

InputVariable* inputVariable2 = new InputVariable;
inputVariable2->setEnabled(true);
inputVariable2->setName("food");
inputVariable2->setRange(0.000, 10.000);
inputVariable2->setLockValueInRange(false);
inputVariable2->addTerm(new Trapezoid("rancid", 0.000, 0.000, 1.000, 3.000));
inputVariable2->addTerm(new Trapezoid("delicious", 7.000, 9.000, 10.000, 10.000));
engine->addInputVariable(inputVariable2);

OutputVariable* outputVariable = new OutputVariable;
outputVariable->setEnabled(true);
outputVariable->setName("tip");
outputVariable->setRange(0.000, 30.000);
outputVariable->setLockValueInRange(false);
outputVariable->fuzzyOutput()->setAccumulation(new Maximum);
outputVariable->setDefuzzifier(new Centroid(200));
outputVariable->setDefaultValue(fl::nan);
outputVariable->setLockPreviousValue(false);
outputVariable->addTerm(new Triangle("cheap", 0.000, 5.000, 10.000));
outputVariable->addTerm(new Triangle("average", 10.000, 15.000, 20.000));
outputVariable->addTerm(new Triangle("generous", 20.000, 25.000, 30.000));
engine->addOutputVariable(outputVariable);

RuleBlock* ruleBlock = new RuleBlock;
ruleBlock->setEnabled(true);
ruleBlock->setName("");
ruleBlock->setConjunction(new Minimum);
ruleBlock->setDisjunction(new Maximum);
ruleBlock->setImplication(new Minimum);
ruleBlock->addRule(fl::Rule::parse("if service is poor or food is rancid then tip is cheap", engine));
ruleBlock->addRule(fl::Rule::parse("if service is good then tip is average", engine));
ruleBlock->addRule(fl::Rule::parse("if service is excellent or food is delicious then tip is generous", engine));
engine->addRuleBlock(ruleBlock);


}
开发者ID:ecksun,项目名称:fuzzylite,代码行数:52,代码来源:tipper.cpp

示例9: main

int main(int argc, char** argv){
using namespace fl;

Engine* engine = new Engine;
engine->setName("simple-dimmer");

InputVariable* inputVariable = new InputVariable;
inputVariable->setEnabled(true);
inputVariable->setName("Ambient");
inputVariable->setRange(0.000, 1.000);
inputVariable->addTerm(new Triangle("DARK", 0.000, 0.250, 0.500));
inputVariable->addTerm(new Triangle("MEDIUM", 0.250, 0.500, 0.750));
inputVariable->addTerm(new Triangle("BRIGHT", 0.500, 0.750, 1.000));
engine->addInputVariable(inputVariable);

OutputVariable* outputVariable = new OutputVariable;
outputVariable->setEnabled(true);
outputVariable->setName("Power");
outputVariable->setRange(0.000, 1.000);
outputVariable->fuzzyOutput()->setAccumulation(fl::null);
outputVariable->setDefuzzifier(new WeightedAverage("TakagiSugeno"));
outputVariable->setDefaultValue(fl::nan);
outputVariable->setLockPreviousOutputValue(false);
outputVariable->setLockOutputValueInRange(false);
outputVariable->addTerm(new Constant("LOW", 0.250));
outputVariable->addTerm(new Constant("MEDIUM", 0.500));
outputVariable->addTerm(new Constant("HIGH", 0.750));
engine->addOutputVariable(outputVariable);

RuleBlock* ruleBlock = new RuleBlock;
ruleBlock->setEnabled(true);
ruleBlock->setName("");
ruleBlock->setConjunction(fl::null);
ruleBlock->setDisjunction(fl::null);
ruleBlock->setActivation(fl::null);
ruleBlock->addRule(fl::Rule::parse("if Ambient is DARK then Power is HIGH", engine));
ruleBlock->addRule(fl::Rule::parse("if Ambient is MEDIUM then Power is MEDIUM", engine));
ruleBlock->addRule(fl::Rule::parse("if Ambient is BRIGHT then Power is LOW", engine));
engine->addRuleBlock(ruleBlock);


}
开发者ID:9468305,项目名称:fuzzylite,代码行数:42,代码来源:SimpleDimmer.cpp

示例10: 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();
        }
开发者ID:maciek-slon,项目名称:Fuzzy,代码行数:39,代码来源:Variable.cpp

示例11: main

int main(int argc, char** argv){
//Code automatically generated with jfuzzylite 6.0.

using namespace fl;

Engine* engine = new Engine;
engine->setName("tsukamoto");
engine->setDescription("");

InputVariable* X = new InputVariable;
X->setName("X");
X->setDescription("");
X->setEnabled(true);
X->setRange(-10.000, 10.000);
X->setLockValueInRange(false);
X->addTerm(new Bell("small", -10.000, 5.000, 3.000));
X->addTerm(new Bell("medium", 0.000, 5.000, 3.000));
X->addTerm(new Bell("large", 10.000, 5.000, 3.000));
engine->addInputVariable(X);

OutputVariable* Ramps = new OutputVariable;
Ramps->setName("Ramps");
Ramps->setDescription("");
Ramps->setEnabled(true);
Ramps->setRange(0.000, 1.000);
Ramps->setLockValueInRange(false);
Ramps->setAggregation(fl::null);
Ramps->setDefuzzifier(new WeightedAverage("Automatic"));
Ramps->setDefaultValue(fl::nan);
Ramps->setLockPreviousValue(false);
Ramps->addTerm(new Ramp("b", 0.600, 0.400));
Ramps->addTerm(new Ramp("a", 0.000, 0.250));
Ramps->addTerm(new Ramp("c", 0.700, 1.000));
engine->addOutputVariable(Ramps);

OutputVariable* Sigmoids = new OutputVariable;
Sigmoids->setName("Sigmoids");
Sigmoids->setDescription("");
Sigmoids->setEnabled(true);
Sigmoids->setRange(0.020, 1.000);
Sigmoids->setLockValueInRange(false);
Sigmoids->setAggregation(fl::null);
Sigmoids->setDefuzzifier(new WeightedAverage("Automatic"));
Sigmoids->setDefaultValue(fl::nan);
Sigmoids->setLockPreviousValue(false);
Sigmoids->addTerm(new Sigmoid("b", 0.500, -30.000));
Sigmoids->addTerm(new Sigmoid("a", 0.130, 30.000));
Sigmoids->addTerm(new Sigmoid("c", 0.830, 30.000));
engine->addOutputVariable(Sigmoids);

OutputVariable* ZSShapes = new OutputVariable;
ZSShapes->setName("ZSShapes");
ZSShapes->setDescription("");
ZSShapes->setEnabled(true);
ZSShapes->setRange(0.000, 1.000);
ZSShapes->setLockValueInRange(false);
ZSShapes->setAggregation(fl::null);
ZSShapes->setDefuzzifier(new WeightedAverage("Automatic"));
ZSShapes->setDefaultValue(fl::nan);
ZSShapes->setLockPreviousValue(false);
ZSShapes->addTerm(new ZShape("b", 0.300, 0.600));
ZSShapes->addTerm(new SShape("a", 0.000, 0.250));
ZSShapes->addTerm(new SShape("c", 0.700, 1.000));
engine->addOutputVariable(ZSShapes);

OutputVariable* Concaves = new OutputVariable;
Concaves->setName("Concaves");
Concaves->setDescription("");
Concaves->setEnabled(true);
Concaves->setRange(0.000, 1.000);
Concaves->setLockValueInRange(false);
Concaves->setAggregation(fl::null);
Concaves->setDefuzzifier(new WeightedAverage("Automatic"));
Concaves->setDefaultValue(fl::nan);
Concaves->setLockPreviousValue(false);
Concaves->addTerm(new Concave("b", 0.500, 0.400));
Concaves->addTerm(new Concave("a", 0.240, 0.250));
Concaves->addTerm(new Concave("c", 0.900, 1.000));
engine->addOutputVariable(Concaves);

RuleBlock* ruleBlock = new RuleBlock;
ruleBlock->setName("");
ruleBlock->setDescription("");
ruleBlock->setEnabled(true);
ruleBlock->setConjunction(fl::null);
ruleBlock->setDisjunction(fl::null);
ruleBlock->setImplication(fl::null);
ruleBlock->setActivation(new General);
ruleBlock->addRule(Rule::parse("if X is small then Ramps is a and Sigmoids is a and ZSShapes is a and Concaves is a", engine));
ruleBlock->addRule(Rule::parse("if X is medium then Ramps is b and Sigmoids is b and ZSShapes is b and Concaves is b", engine));
ruleBlock->addRule(Rule::parse("if X is large then Ramps is c and Sigmoids is c and ZSShapes is c and Concaves is c", engine));
engine->addRuleBlock(ruleBlock);


}
开发者ID:fuzzylite,项目名称:jfuzzylite,代码行数:95,代码来源:tsukamoto.cpp

示例12: main

int main(int argc, char** argv) {
    using namespace fl;

    Engine* engine = new Engine;
    engine->setName("Cubic-Approximator");

    InputVariable* inputVariable = new InputVariable;
    inputVariable->setEnabled(true);
    inputVariable->setName("X");
    inputVariable->setRange(-5.000, 5.000);
    inputVariable->addTerm(new Triangle("AboutNegFive", -6.000, -5.000, -4.000));
    inputVariable->addTerm(new Triangle("AboutNegFour", -5.000, -4.000, -3.000));
    inputVariable->addTerm(new Triangle("AboutNegThree", -4.000, -3.000, -2.000));
    inputVariable->addTerm(new Triangle("AboutNegTwo", -3.000, -2.000, -1.000));
    inputVariable->addTerm(new Triangle("AboutNegOne", -2.000, -1.000, 0.000));
    inputVariable->addTerm(new Triangle("AboutZero", -1.000, 0.000, 1.000));
    inputVariable->addTerm(new Triangle("AboutOne", 0.000, 1.000, 2.000));
    inputVariable->addTerm(new Triangle("AboutTwo", 1.000, 2.000, 3.000));
    inputVariable->addTerm(new Triangle("AboutThree", 2.000, 3.000, 4.000));
    inputVariable->addTerm(new Triangle("AboutFour", 3.000, 4.000, 5.000));
    inputVariable->addTerm(new Triangle("AboutFive", 4.000, 5.000, 6.000));
    engine->addInputVariable(inputVariable);

    OutputVariable* outputVariable = new OutputVariable;
    outputVariable->setEnabled(true);
    outputVariable->setName("ApproxXCubed");
    outputVariable->setRange(-5.000, 5.000);
    outputVariable->fuzzyOutput()->setAccumulation(fl::null);
    outputVariable->setDefuzzifier(new WeightedAverage("TakagiSugeno"));
    outputVariable->setDefaultValue(fl::nan);
    outputVariable->setLockPreviousOutputValue(false);
    outputVariable->setLockOutputValueInRange(false);
    outputVariable->addTerm(Linear::create("TangentatNegFive", engine, 75.000, 250.000));
    outputVariable->addTerm(Linear::create("TangentatNegFour", engine, 48.000, 128.000));
    outputVariable->addTerm(Linear::create("TangentatNegThree", engine, 27.000, 54.000));
    outputVariable->addTerm(Linear::create("TangentatNegTwo", engine, 12.000, 16.000));
    outputVariable->addTerm(Linear::create("TangentatNegOne", engine, 3.000, 2.000));
    outputVariable->addTerm(Linear::create("TangentatZero", engine, 0.000, 0.000));
    outputVariable->addTerm(Linear::create("TangentatOne", engine, 3.000, -2.000));
    outputVariable->addTerm(Linear::create("TangentatTwo", engine, 12.000, -16.000));
    outputVariable->addTerm(Linear::create("TangentatThree", engine, 27.000, -54.000));
    outputVariable->addTerm(Linear::create("TangentatFour", engine, 48.000, -128.000));
    outputVariable->addTerm(Linear::create("TangentatFive", engine, 75.000, -250.000));
    engine->addOutputVariable(outputVariable);

    RuleBlock* ruleBlock = new RuleBlock;
    ruleBlock->setEnabled(true);
    ruleBlock->setName("");
    ruleBlock->setConjunction(fl::null);
    ruleBlock->setDisjunction(fl::null);
    ruleBlock->setActivation(fl::null);
    ruleBlock->addRule(fl::Rule::parse("if X is AboutNegFive then ApproxXCubed is TangentatNegFive", engine));
    ruleBlock->addRule(fl::Rule::parse("if X is AboutNegFour then ApproxXCubed is TangentatNegFour", engine));
    ruleBlock->addRule(fl::Rule::parse("if X is AboutNegThree then ApproxXCubed is TangentatNegThree", engine));
    ruleBlock->addRule(fl::Rule::parse("if X is AboutNegTwo then ApproxXCubed is TangentatNegTwo", engine));
    ruleBlock->addRule(fl::Rule::parse("if X is AboutNegOne then ApproxXCubed is TangentatNegOne", engine));
    ruleBlock->addRule(fl::Rule::parse("if X is AboutZero then ApproxXCubed is TangentatZero", engine));
    ruleBlock->addRule(fl::Rule::parse("if X is AboutOne then ApproxXCubed is TangentatOne", engine));
    ruleBlock->addRule(fl::Rule::parse("if X is AboutTwo then ApproxXCubed is TangentatTwo", engine));
    ruleBlock->addRule(fl::Rule::parse("if X is AboutThree then ApproxXCubed is TangentatThree", engine));
    ruleBlock->addRule(fl::Rule::parse("if X is AboutFour then ApproxXCubed is TangentatFour", engine));
    ruleBlock->addRule(fl::Rule::parse("if X is AboutFive then ApproxXCubed is TangentatFive", engine));
    engine->addRuleBlock(ruleBlock);


}
开发者ID:9468305,项目名称:fuzzylite,代码行数:66,代码来源:cubic_approximator.cpp

示例13: main

int main(int argc, char** argv){
using namespace fl;

Engine* engine = new Engine;
engine->setName("anfis");

InputVariable* inputVariable1 = new InputVariable;
inputVariable1->setEnabled(true);
inputVariable1->setName("in_n1");
inputVariable1->setRange(1.000, 31.000);
inputVariable1->setLockValueInRange(false);
inputVariable1->addTerm(new Bell("in1mf1", 1.152, 8.206, 0.874));
inputVariable1->addTerm(new Bell("in1mf2", 15.882, 7.078, 0.444));
inputVariable1->addTerm(new Bell("in1mf3", 30.575, 8.602, 0.818));
engine->addInputVariable(inputVariable1);

InputVariable* inputVariable2 = new InputVariable;
inputVariable2->setEnabled(true);
inputVariable2->setName("in_n2");
inputVariable2->setRange(1.000, 31.000);
inputVariable2->setLockValueInRange(false);
inputVariable2->addTerm(new Bell("in2mf1", 1.426, 8.602, 0.818));
inputVariable2->addTerm(new Bell("in2mf2", 16.118, 7.078, 0.445));
inputVariable2->addTerm(new Bell("in2mf3", 30.847, 8.206, 0.875));
engine->addInputVariable(inputVariable2);

OutputVariable* outputVariable = new OutputVariable;
outputVariable->setEnabled(true);
outputVariable->setName("out1");
outputVariable->setRange(-0.334, 1.000);
outputVariable->setLockValueInRange(false);
outputVariable->fuzzyOutput()->setAccumulation(fl::null);
outputVariable->setDefuzzifier(new WeightedAverage("TakagiSugeno"));
outputVariable->setDefaultValue(fl::nan);
outputVariable->setLockPreviousValue(false);
outputVariable->addTerm(Linear::create("out1mf1", engine, -0.035, 0.002, -0.352));
outputVariable->addTerm(Linear::create("out1mf2", engine, 0.044, 0.079, -0.028));
outputVariable->addTerm(Linear::create("out1mf3", engine, -0.024, 0.024, -1.599));
outputVariable->addTerm(Linear::create("out1mf4", engine, -0.067, 0.384, 0.007));
outputVariable->addTerm(Linear::create("out1mf5", engine, 0.351, -0.351, -3.663));
outputVariable->addTerm(Linear::create("out1mf6", engine, -0.079, -0.044, 3.909));
outputVariable->addTerm(Linear::create("out1mf7", engine, 0.012, -0.012, -0.600));
outputVariable->addTerm(Linear::create("out1mf8", engine, -0.384, 0.067, 10.158));
outputVariable->addTerm(Linear::create("out1mf9", engine, -0.002, 0.035, -1.402));
engine->addOutputVariable(outputVariable);

RuleBlock* ruleBlock = new RuleBlock;
ruleBlock->setEnabled(true);
ruleBlock->setName("");
ruleBlock->setConjunction(new AlgebraicProduct);
ruleBlock->setDisjunction(fl::null);
ruleBlock->setImplication(fl::null);
ruleBlock->addRule(fl::Rule::parse("if in_n1 is in1mf1 and in_n2 is in2mf1 then out1 is out1mf1", engine));
ruleBlock->addRule(fl::Rule::parse("if in_n1 is in1mf1 and in_n2 is in2mf2 then out1 is out1mf2", engine));
ruleBlock->addRule(fl::Rule::parse("if in_n1 is in1mf1 and in_n2 is in2mf3 then out1 is out1mf3", engine));
ruleBlock->addRule(fl::Rule::parse("if in_n1 is in1mf2 and in_n2 is in2mf1 then out1 is out1mf4", engine));
ruleBlock->addRule(fl::Rule::parse("if in_n1 is in1mf2 and in_n2 is in2mf2 then out1 is out1mf5", engine));
ruleBlock->addRule(fl::Rule::parse("if in_n1 is in1mf2 and in_n2 is in2mf3 then out1 is out1mf6", engine));
ruleBlock->addRule(fl::Rule::parse("if in_n1 is in1mf3 and in_n2 is in2mf1 then out1 is out1mf7", engine));
ruleBlock->addRule(fl::Rule::parse("if in_n1 is in1mf3 and in_n2 is in2mf2 then out1 is out1mf8", engine));
ruleBlock->addRule(fl::Rule::parse("if in_n1 is in1mf3 and in_n2 is in2mf3 then out1 is out1mf9", engine));
engine->addRuleBlock(ruleBlock);


}
开发者ID:ecksun,项目名称:fuzzylite,代码行数:65,代码来源:membrn2.cpp

示例14: main

int main(int argc, char** argv){
//C++ code generated with fuzzylite 6.0.

using namespace fl;

Engine* engine = new Engine;
engine->setName("slcpp1");

InputVariable* in1 = new InputVariable;
in1->setEnabled(true);
in1->setName("in1");
in1->setRange(-0.300, 0.300);
in1->setLockValueInRange(false);
engine->addInputVariable(in1);

InputVariable* in2 = new InputVariable;
in2->setEnabled(true);
in2->setName("in2");
in2->setRange(-1.000, 1.000);
in2->setLockValueInRange(false);
engine->addInputVariable(in2);

InputVariable* in3 = new InputVariable;
in3->setEnabled(true);
in3->setName("in3");
in3->setRange(-3.000, 3.000);
in3->setLockValueInRange(false);
engine->addInputVariable(in3);

InputVariable* in4 = new InputVariable;
in4->setEnabled(true);
in4->setName("in4");
in4->setRange(-3.000, 3.000);
in4->setLockValueInRange(false);
engine->addInputVariable(in4);

InputVariable* in5 = new InputVariable;
in5->setEnabled(true);
in5->setName("in5");
in5->setRange(-3.000, 3.000);
in5->setLockValueInRange(false);
engine->addInputVariable(in5);

InputVariable* in6 = new InputVariable;
in6->setEnabled(true);
in6->setName("in6");
in6->setRange(-3.000, 3.000);
in6->setLockValueInRange(false);
engine->addInputVariable(in6);

InputVariable* pole_length = new InputVariable;
pole_length->setEnabled(true);
pole_length->setName("pole_length");
pole_length->setRange(0.500, 1.500);
pole_length->setLockValueInRange(false);
pole_length->addTerm(new ZShape("mf1", 0.500, 0.600));
pole_length->addTerm(new PiShape("mf2", 0.500, 0.600, 0.600, 0.700));
pole_length->addTerm(new PiShape("mf3", 0.600, 0.700, 0.700, 0.800));
pole_length->addTerm(new PiShape("mf4", 0.700, 0.800, 0.800, 0.900));
pole_length->addTerm(new PiShape("mf5", 0.800, 0.900, 0.900, 1.000));
pole_length->addTerm(new PiShape("mf6", 0.900, 1.000, 1.000, 1.100));
pole_length->addTerm(new PiShape("mf7", 1.000, 1.100, 1.100, 1.200));
pole_length->addTerm(new PiShape("mf8", 1.100, 1.200, 1.200, 1.300));
pole_length->addTerm(new PiShape("mf9", 1.200, 1.300, 1.300, 1.400));
pole_length->addTerm(new PiShape("mf10", 1.300, 1.400, 1.400, 1.500));
pole_length->addTerm(new SShape("mf11", 1.400, 1.500));
engine->addInputVariable(pole_length);

OutputVariable* out = new OutputVariable;
out->setEnabled(true);
out->setName("out");
out->setRange(-10.000, 10.000);
out->setLockValueInRange(false);
out->fuzzyOutput()->setAggregation(fl::null);
out->setDefuzzifier(new WeightedAverage("TakagiSugeno"));
out->setDefaultValue(fl::nan);
out->setLockPreviousValue(false);
out->addTerm(Linear::create("outmf1", engine, 168.400, 31.000, -188.050, -49.250, -1.000, -2.700, 0.000, 0.000));
out->addTerm(Linear::create("outmf2", engine, 233.950, 47.190, -254.520, -66.580, -1.000, -2.740, 0.000, 0.000));
out->addTerm(Linear::create("outmf3", engine, 342.940, 74.730, -364.370, -95.230, -1.000, -2.780, 0.000, 0.000));
out->addTerm(Linear::create("outmf4", engine, 560.710, 130.670, -582.960, -152.240, -1.000, -2.810, 0.000, 0.000));
out->addTerm(Linear::create("outmf5", engine, 1213.880, 300.190, -1236.900, -322.800, -1.000, -2.840, 0.000, 0.000));
out->addTerm(Linear::create("outmf6", engine, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000));
out->addTerm(Linear::create("outmf7", engine, -1399.120, -382.950, 1374.630, 358.340, -1.000, -2.900, 0.000, 0.000));
out->addTerm(Linear::create("outmf8", engine, -746.070, -213.420, 720.900, 187.840, -1.000, -2.930, 0.000, 0.000));
out->addTerm(Linear::create("outmf9", engine, -528.520, -157.460, 502.680, 130.920, -1.000, -2.960, 0.000, 0.000));
out->addTerm(Linear::create("outmf10", engine, -419.870, -129.890, 393.380, 102.410, -1.000, -2.980, 0.000, 0.000));
out->addTerm(Linear::create("outmf11", engine, -354.770, -113.680, 327.650, 85.270, -1.000, -3.010, 0.000, 0.000));
engine->addOutputVariable(out);

RuleBlock* ruleBlock = new RuleBlock;
ruleBlock->setEnabled(true);
ruleBlock->setName("");
ruleBlock->setConjunction(fl::null);
ruleBlock->setDisjunction(fl::null);
ruleBlock->setImplication(fl::null);
ruleBlock->setActivation(new General);
ruleBlock->addRule(Rule::parse("if pole_length is mf1 then out is outmf1", engine));
ruleBlock->addRule(Rule::parse("if pole_length is mf2 then out is outmf2", engine));
ruleBlock->addRule(Rule::parse("if pole_length is mf3 then out is outmf3", engine));
//.........这里部分代码省略.........
开发者ID:NatalProductions,项目名称:fuzzylite,代码行数:101,代码来源:slcpp1.cpp

示例15: main

int main(int argc, char** argv){
using namespace fl;

Engine* engine = new Engine;
engine->setName("slcp1");

InputVariable* inputVariable1 = new InputVariable;
inputVariable1->setEnabled(true);
inputVariable1->setName("in1");
inputVariable1->setRange(-0.300, 0.300);
engine->addInputVariable(inputVariable1);

InputVariable* inputVariable2 = new InputVariable;
inputVariable2->setEnabled(true);
inputVariable2->setName("in2");
inputVariable2->setRange(-1.000, 1.000);
engine->addInputVariable(inputVariable2);

InputVariable* inputVariable3 = new InputVariable;
inputVariable3->setEnabled(true);
inputVariable3->setName("in3");
inputVariable3->setRange(-3.000, 3.000);
engine->addInputVariable(inputVariable3);

InputVariable* inputVariable4 = new InputVariable;
inputVariable4->setEnabled(true);
inputVariable4->setName("in4");
inputVariable4->setRange(-3.000, 3.000);
engine->addInputVariable(inputVariable4);

InputVariable* inputVariable5 = new InputVariable;
inputVariable5->setEnabled(true);
inputVariable5->setName("in5");
inputVariable5->setRange(0.500, 1.500);
inputVariable5->addTerm(new Gaussian("small", 0.500, 0.200));
inputVariable5->addTerm(new Gaussian("medium", 1.000, 0.200));
inputVariable5->addTerm(new Gaussian("large", 1.500, 0.200));
engine->addInputVariable(inputVariable5);

OutputVariable* outputVariable = new OutputVariable;
outputVariable->setEnabled(true);
outputVariable->setName("out");
outputVariable->setRange(-10.000, 10.000);
outputVariable->fuzzyOutput()->setAccumulation(fl::null);
outputVariable->setDefuzzifier(new WeightedAverage("TakagiSugeno"));
outputVariable->setDefaultValue(fl::nan);
outputVariable->setLockPreviousOutputValue(false);
outputVariable->setLockOutputValueInRange(false);
outputVariable->addTerm(Linear::create("outmf1", engine, 32.166, 5.835, 3.162, 3.757, 0.000, 0.000));
outputVariable->addTerm(Linear::create("outmf2", engine, 39.012, 9.947, 3.162, 4.269, 0.000, 0.000));
outputVariable->addTerm(Linear::create("outmf3", engine, 45.009, 13.985, 3.162, 4.666, 0.000, 0.000));
engine->addOutputVariable(outputVariable);

RuleBlock* ruleBlock = new RuleBlock;
ruleBlock->setEnabled(true);
ruleBlock->setName("");
ruleBlock->setConjunction(fl::null);
ruleBlock->setDisjunction(fl::null);
ruleBlock->setActivation(fl::null);
ruleBlock->addRule(fl::Rule::parse("if in5 is small then out is outmf1", engine));
ruleBlock->addRule(fl::Rule::parse("if in5 is medium then out is outmf2", engine));
ruleBlock->addRule(fl::Rule::parse("if in5 is large then out is outmf3", engine));
engine->addRuleBlock(ruleBlock);


}
开发者ID:9468305,项目名称:fuzzylite,代码行数:66,代码来源:slcp1.cpp


注:本文中的OutputVariable::setDefuzzifier方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。