Пример #1
0
                      terms=[
                          fl.Triangle("LOW", 0.000, 0.250, 0.500),
                          fl.Triangle("MEDIUM", 0.250, 0.500, 0.750),
                          fl.Triangle("HIGH", 0.500, 0.750, 1.000)
                      ]),
    fl.OutputVariable(name="InversePower",
                      description="",
                      enabled=True,
                      minimum=0.000,
                      maximum=1.000,
                      lock_range=False,
                      aggregation=fl.Maximum(),
                      defuzzifier=fl.Centroid(500),
                      lock_previous=False,
                      terms=[
                          fl.Cosine("LOW", 0.200, 0.500),
                          fl.Cosine("MEDIUM", 0.500, 0.500),
                          fl.Cosine("HIGH", 0.800, 0.500)
                      ])
]
engine.rule_blocks = [
    fl.RuleBlock(
        name="",
        description="",
        enabled=True,
        conjunction=None,
        disjunction=None,
        implication=fl.Minimum(),
        activation=fl.General(),
        rules=[
            fl.Rule.create("if Ambient is DARK then Power is HIGH", engine),
Пример #2
0
                     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 = [
    fl.OutputVariable(name="AllOutputTerms",
Пример #3
0
        fl.Triangle("left", 0.000000000, 0.333000000, 0.666000000),
        fl.Triangle("right", 0.333000000, 0.666000000, 1.000000000)
    ])
engine.input_variables = [obstacle]

steer = 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.Cosine("left", 0.333000000, 0.666000000),
                              fl.Cosine("right", 0.666500000, 0.667000000)
                          ])
engine.output_variables = [steer]

steer_away = 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.parse("if obstacle is left then steer is right"),
        fl.Rule.parse("if obstacle is right then steer is left")