Ejemplo n.º 1
0
                         fl.Triangle("right", 0.333000000, 0.666000000,
                                     1.000000000)
                     ])
]
engine.output_variables = [
    fl.OutputVariable(name="steer",
                      description="direction to steer the vehicle to",
                      enabled=True,
                      minimum=0.000000000,
                      maximum=1.000000000,
                      lock_range=False,
                      aggregation=fl.Maximum(),
                      defuzzifier=fl.Centroid(100),
                      lock_previous=False,
                      terms=[
                          fl.Gaussian("left", 0.333000000, 0.143534483),
                          fl.Gaussian("right", 0.666500000, 0.143750000)
                      ])
]
engine.rule_blocks = [
    fl.RuleBlock(name="steer_away",
                 description="steer away from obstacles",
                 enabled=True,
                 conjunction=None,
                 disjunction=None,
                 implication=fl.Minimum(),
                 activation=fl.General(),
                 rules=[
                     fl.Rule.create("if obstacle is left then steer is right",
                                    engine),
                     fl.Rule.create("if obstacle is right then steer is left",
                         fl.Trapezoid("Bad", 0.000, 1.000, 3.000, 7.000),
                         fl.Trapezoid("Good", 3.000, 7.000, 10.000, 11.000)
                     ])
]
engine.output_variables = [
    fl.OutputVariable(name="Tip",
                      description="",
                      enabled=True,
                      minimum=0.000,
                      maximum=30.000,
                      lock_range=False,
                      aggregation=fl.AlgebraicSum(),
                      defuzzifier=fl.Centroid(200),
                      lock_previous=False,
                      terms=[
                          fl.Gaussian("AboutTenPercent", 10.000, 2.000),
                          fl.Gaussian("AboutFifteenPercent", 15.000, 2.000),
                          fl.Gaussian("AboutTwentyPercent", 20.000, 2.000)
                      ]),
    fl.OutputVariable(name="CheckPlusTip",
                      description="",
                      enabled=True,
                      minimum=1.000,
                      maximum=1.300,
                      lock_range=False,
                      aggregation=fl.AlgebraicSum(),
                      defuzzifier=fl.Centroid(200),
                      lock_previous=False,
                      terms=[
                          fl.Gaussian("PlusAboutTenPercent", 1.100, 0.020),
                          fl.Gaussian("PlusAboutFifteenPercent", 1.150, 0.020),
Ejemplo n.º 3
0
                     minimum=0.000,
                     maximum=6.500,
                     lock_range=False,
                     terms=[
                         fl.Sigmoid("A", 0.500, -20.000),
                         fl.ZShape("B", 0.000, 1.000),
                         fl.Ramp("C", 1.000, 0.000),
                         fl.Triangle("D", 0.500, 1.000, 1.500),
                         fl.Trapezoid("E", 1.000, 1.250, 1.750, 2.000),
                         fl.Concave("F", 0.850, 0.250),
                         fl.Rectangle("G", 1.750, 2.250),
                         fl.Discrete("H", [
                             2.000, 0.000, 2.250, 1.000, 2.500, 0.500, 2.750,
                             1.000, 3.000, 0.000
                         ]),
                         fl.Gaussian("I", 3.000, 0.200),
                         fl.Cosine("J", 3.250, 0.650),
                         fl.GaussianProduct("K", 3.500, 0.100, 3.300, 0.300),
                         fl.Spike("L", 3.640, 1.040),
                         fl.Bell("M", 4.000, 0.250, 3.000),
                         fl.PiShape("N", 4.000, 4.500, 4.500, 5.000),
                         fl.Concave("O", 5.650, 6.250),
                         fl.SigmoidDifference("P", 4.750, 10.000, 30.000,
                                              5.250),
                         fl.SigmoidProduct("Q", 5.250, 20.000, -10.000, 5.750),
                         fl.Ramp("R", 5.500, 6.500),
                         fl.SShape("S", 5.500, 6.500),
                         fl.Sigmoid("T", 6.000, 20.000)
                     ])
]
engine.output_variables = [
Ejemplo n.º 4
0
import fuzzylite as fl

engine = fl.Engine(name="sugeno1", description="")
engine.input_variables = [
    fl.InputVariable(name="input",
                     description="",
                     enabled=True,
                     minimum=-5.000,
                     maximum=5.000,
                     lock_range=False,
                     terms=[
                         fl.Gaussian("low", -5.000, 4.000),
                         fl.Gaussian("high", 5.000, 4.000)
                     ])
]
engine.output_variables = [
    fl.OutputVariable(name="output",
                      description="",
                      enabled=True,
                      minimum=0.000,
                      maximum=1.000,
                      lock_range=False,
                      aggregation=None,
                      defuzzifier=fl.WeightedAverage("TakagiSugeno"),
                      lock_previous=False,
                      terms=[
                          fl.Linear("line1", [-1.000, -1.000], engine),
                          fl.Linear("line2", [1.000, -1.000], engine)
                      ])
]
engine.rule_blocks = [
Ejemplo n.º 5
0
import fuzzylite as fl

engine = fl.Engine(name="tanksg", description="")
engine.input_variables = [
    fl.InputVariable(name="level",
                     description="",
                     enabled=True,
                     minimum=-1.000,
                     maximum=1.000,
                     lock_range=False,
                     terms=[
                         fl.Gaussian("high", -1.000, 0.300),
                         fl.Gaussian("okay", 0.004, 0.300),
                         fl.Gaussian("low", 1.000, 0.300)
                     ]),
    fl.InputVariable(name="rate",
                     description="",
                     enabled=True,
                     minimum=-0.100,
                     maximum=0.100,
                     lock_range=False,
                     terms=[
                         fl.Gaussian("negative", -0.100, 0.030),
                         fl.Gaussian("none", 0.000, 0.030),
                         fl.Gaussian("positive", 0.100, 0.030)
                     ])
]
engine.output_variables = [
    fl.OutputVariable(name="valve",
                      description="",
                      enabled=True,
Ejemplo n.º 6
0
import fuzzylite as fl

engine = fl.Engine(name="tipper1", description="")
engine.input_variables = [
    fl.InputVariable(name="service",
                     description="",
                     enabled=True,
                     minimum=0.000,
                     maximum=10.000,
                     lock_range=False,
                     terms=[
                         fl.Gaussian("poor", 0.000, 1.500),
                         fl.Gaussian("good", 5.000, 1.500),
                         fl.Gaussian("excellent", 10.000, 1.500)
                     ])
]
engine.output_variables = [
    fl.OutputVariable(name="tip",
                      description="",
                      enabled=True,
                      minimum=0.000,
                      maximum=30.000,
                      lock_range=False,
                      aggregation=fl.Maximum(),
                      defuzzifier=fl.Centroid(200),
                      lock_previous=False,
                      terms=[
                          fl.Triangle("cheap", 0.000, 5.000, 10.000),
                          fl.Triangle("average", 10.000, 15.000, 20.000),
                          fl.Triangle("generous", 20.000, 25.000, 30.000)
                      ])
Ejemplo n.º 7
0
import fuzzylite as fl

engine = fl.Engine(name="tippersg", description="")
engine.input_variables = [
    fl.InputVariable(name="service",
                     description="",
                     enabled=True,
                     minimum=0.000,
                     maximum=10.000,
                     lock_range=False,
                     terms=[
                         fl.Gaussian("poor", 0.000, 1.500),
                         fl.Gaussian("average", 5.000, 1.500),
                         fl.Gaussian("good", 10.000, 1.500)
                     ]),
    fl.InputVariable(name="food",
                     description="",
                     enabled=True,
                     minimum=0.000,
                     maximum=10.000,
                     lock_range=False,
                     terms=[
                         fl.Trapezoid("rancid", -5.000, 0.000, 1.000, 3.000),
                         fl.Trapezoid("delicious", 7.000, 9.000, 10.000,
                                      15.000)
                     ])
]
engine.output_variables = [
    fl.OutputVariable(name="tip",
                      description="",
                      enabled=True,
Ejemplo n.º 8
0
                         fl.ZShape("Low", 2.000, 8.000),
                         fl.SShape("High", 2.000, 8.000)
                     ])
]
engine.output_variables = [
    fl.OutputVariable(name="PercentageInStocks",
                      description="",
                      enabled=True,
                      minimum=0.000,
                      maximum=100.000,
                      lock_range=False,
                      aggregation=fl.EinsteinSum(),
                      defuzzifier=fl.Centroid(200),
                      lock_previous=False,
                      terms=[
                          fl.Gaussian("AboutFifteen", 15.000, 10.000),
                          fl.Gaussian("AboutFifty", 50.000, 10.000),
                          fl.Gaussian("AboutEightyFive", 85.000, 10.000)
                      ])
]
engine.rule_blocks = [
    fl.RuleBlock(
        name="",
        description="",
        enabled=True,
        conjunction=fl.EinsteinProduct(),
        disjunction=fl.EinsteinSum(),
        implication=fl.EinsteinProduct(),
        activation=fl.General(),
        rules=[
            fl.Rule.create(
Ejemplo n.º 9
0
                     maximum=3.000,
                     lock_range=False),
    fl.InputVariable(name="in4",
                     description="",
                     enabled=True,
                     minimum=-3.000,
                     maximum=3.000,
                     lock_range=False),
    fl.InputVariable(name="in5",
                     description="",
                     enabled=True,
                     minimum=0.500,
                     maximum=1.500,
                     lock_range=False,
                     terms=[
                         fl.Gaussian("small", 0.500, 0.200),
                         fl.Gaussian("medium", 1.000, 0.200),
                         fl.Gaussian("large", 1.500, 0.200)
                     ])
]
engine.output_variables = [
    fl.OutputVariable(
        name="out",
        description="",
        enabled=True,
        minimum=-10.000,
        maximum=10.000,
        lock_range=False,
        aggregation=None,
        defuzzifier=fl.WeightedAverage("TakagiSugeno"),
        lock_previous=False,