flScalar CompoundTerm::membership(flScalar crisp) const {
     flScalar max = flScalar(0);
     for (size_t i = 0; i < _terms.size(); ++i) {
         max = fuzzyOperator().aggregation().execute(max, _terms[i]->membership(crisp));
     }
     return fuzzyOperator().modulation().execute(modulation(), max);
 }
flScalar TrapezoidalTerm::membership(flScalar crisp) const {
    if (crisp < minimum() || crisp > maximum()) {
        return flScalar(0);
    }
    if (crisp < b()) {
        return fuzzyOperator().modulation().execute(modulation(),
                FuzzyOperation::Scale(a(), b(), crisp, 0, 1));
    }
    if (crisp < c()) {
        return fuzzyOperator().modulation().execute(modulation(), flScalar(1.0));
    }
    if (crisp < d()) {
        return fuzzyOperator().modulation().execute(modulation(),
                FuzzyOperation::Scale(c(), d(), crisp, 1, 0));
    }
    return flScalar(0.0);
}
Exemplo n.º 3
0
 flScalar TriangularTerm::membership(flScalar crisp) const {
     if (crisp > maximum() || crisp < minimum()) {
         return flScalar(0.0);
     }
     flScalar result = crisp < b() ? FuzzyOperation::Scale(a(), b(), crisp, 0, 1)
             : FuzzyOperation::Scale(b(), c(), crisp, 1, 0);
     return fuzzyOperator().modulation().execute(result, modulation());
 }
 void LinguisticTerm::centroid(flScalar& x, flScalar& y) const {
     fuzzyOperator().centroid(this, x, y);
 }
 flScalar LinguisticTerm::area() const {
     return fuzzyOperator().area(this);
 }
 flScalar LinguisticTerm::defuzzify() const {
     return fuzzyOperator().defuzzify(this);
 }
 flScalar LinguisticTerm::areaAndCentroid(flScalar& x, flScalar& y) const {
     return fuzzyOperator().areaAndCentroid(this, x, y);
 }
Exemplo n.º 8
0
 flScalar SingletonTerm::membership(flScalar crisp) const {
     return fuzzyOperator().modulation().execute(modulation(), FuzzyOperation::IsEq(crisp, value())
             ? flScalar(1.0) : flScalar(0.0));
 }
 FuzzyRule::FuzzyRule() : _antecedent(NULL) {
     setFuzzyOperator(fuzzyOperator().DefaultFuzzyOperator());
 }
Exemplo n.º 10
0
 flScalar RectangularTerm::membership(flScalar crisp) const {
     if (crisp > maximum() || crisp < minimum()) {
         return flScalar(0.0);
     }
     return fuzzyOperator().modulation().execute(1.0, modulation());
 }