home Forums # Technical Support Number of Conditions in a rule

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #2133
    Unknown
    Member

    Hi!

    How many conditions can be put in a rule?

    I’ve this code:

    ruleBlock.addRule(Rule.parse(“if valor1 is fiv1 and valor2 is fiv2 and valor3 is fiv3 and valor4 is fiv4 and valor5 is fiv5 and valor6 is fiv6 and valor7 is fiv7 and valor8 is fiv8 then salida is fiy”, engine));

    ..and the console said:
    “syntax error] expected variable or logical operator, but found <valor5>”

    I don’t know, if the next expression is ok:
    engine.configure(“AlgebraicProduct”, “AlgebraicSum”, “AlgebraicProduct”, “AlgebraicSum”, “Centroid”);

    I don’t understand it well. I’ve to change it with the same result.

    Thanks!.

    #2134

    Hi,

    thank you for your post.

    There is no limited number on the conditions in the antecedent.

    I think that your problem is that you have named a variable different than what you are referring to in the antecedent of a rule. Make sure you have correctly named variable . Else, check it out with QtFuzzyLite.

    Cheers.

    #2135
    Unknown
    Member

    Yes, it was that.

    I continue with many problems in my java’s program. I have to read a file with many datas and to make the inputs, outputs and rules while I read it.

    After many problems, I have this engine:

    InputVariable: valor1
      enabled: true
      range: -50,000 400,000
      term: fv1_1 Triangle 1,110 1,120 1,130
      term: fv1_2 Triangle 2,110 2,120 2,130
      term: fv1_3 Triangle 3,110 3,120 3,130
    InputVariable: valor2
      enabled: true
      range: -50,000 400,000
      term: fv2_1 Triangle 1,210 1,220 1,230
      term: fv2_2 Triangle 2,210 2,220 2,230
      term: fv2_3 Triangle 3,210 3,220 3,230
    InputVariable: valor3
      enabled: true
      range: -50,000 400,000
      term: fv3_1 Triangle 1,310 1,320 1,330
      term: fv3_2 Triangle 2,310 2,320 2,330
      term: fv3_3 Triangle 3,310 3,320 3,330
    InputVariable: valor4
      enabled: true
      range: -50,000 400,000
      term: fv4_1 Triangle 1,410 1,420 1,430
      term: fv4_2 Triangle 2,410 2,420 2,430
      term: fv4_3 Triangle 3,410 3,420 3,430
    InputVariable: valor5
      enabled: true
      range: -50,000 400,000
      term: fv5_1 Triangle 1,510 1,520 1,530
      term: fv5_2 Triangle 2,510 2,520 2,530
      term: fv5_3 Triangle 3,510 3,520 3,530
    InputVariable: valor6
      enabled: true
      range: -50,000 400,000
      term: fv6_1 Triangle 1,610 1,620 1,630
      term: fv6_2 Triangle 2,610 2,620 2,630
      term: fv6_3 Triangle 3,610 3,620 3,630
    InputVariable: valor7
      enabled: true
      range: -50,000 400,000
      term: fv7_1 Triangle 1,710 1,720 1,730
      term: fv7_2 Triangle 2,710 2,720 2,730
      term: fv7_3 Triangle 3,710 3,720 3,730
    InputVariable: valor8
      enabled: true
      range: -50,000 400,000
      term: fv8_1 Triangle 1,810 1,820 1,830
      term: fv8_2 Triangle 2,810 2,820 2,830
      term: fv8_3 Triangle 3,810 3,820 3,830
    OutputVariable: salida
      enabled: true
      range: -50,000 400,000
      accumulation: Maximum
      defuzzifier: Centroid 200
      default: nan
      lock-previous: false
      lock-range: false
      term: fy_1 Triangle 1,910 1,920 1,930
      term: fy_2 Triangle 2,910 2,920 2,930
      term: fy_3 Triangle 3,910 3,920 3,930
    RuleBlock: 
      enabled: true
      conjunction: AlgebraicProduct
      disjunction: none
      activation: Minimum
      rule: if valor1 is fv1_1 and valor2 is fv2_1 and valor3 is fv3_1 and valor4 is fv4_1 and valor5 is fv5_1 and valor6 is fv6_1 and valor7 is fv7_1 and valor8 is fv8_1 then salida is fy_1
      rule: if valor1 is fv1_2 and valor2 is fv2_2 and valor3 is fv3_2 and valor4 is fv4_2 and valor5 is fv5_2 and valor6 is fv6_2 and valor7 is fv7_2 and valor8 is fv8_2 then salida is fy_2
      rule: if valor1 is fv1_3 and valor2 is fv2_3 and valor3 is fv3_3 and valor4 is fv4_3 and valor5 is fv5_3 and valor6 is fv6_3 and valor7 is fv7_3 and valor8 is fv8_3 then salida is fy_3

    Well, when I try these inputs va1 = 1.11; va2 = 1.21; va3 = 1.31; va4 = 1.41; va5 = 1.51; va6 = 1.61; va7 = 1.71; va8 = 1.81;
    the output always is the default nan.

    I have configured engine with “engine.configure(“AlgebraicProduct”, “”, “Minimum”, “Maximum”, “Centroid”);” and I don’t know if that is correct.

    Thanks, and excuse me for my english.

    #2136

    Hi,

    thank you for your post.

    The best way to find out what is wrong with your engine is using QtFuzzyLite. I strongly suggest you check it out, either version 5 or 4.

    Briefly looking at your rules, maybe none of the rules are activating, and hence you obtain NaN.

    Cheers.

    #2137
    Unknown
    Member

    Thanks!

    I’m using QFuzzyLite 4, and I have to delete this var “lock-previous: false” to make work it.

    The console give me back this many times:

    if valor1 is fv1_1 and valor2 is fv2_1 and valor3 is fv3_1 and valor4 is fv4_1 and valor5 is fv5_1 and valor6 is fv6_1 and valor7 is fv7_1 and valor8 is fv8_1 then salida is ?
    #[variable error] term <?> not found in variable <salida> {\src\variable\Variable.cpp::fl::Variable::getTerm() [line:167]}
    # Total rules: 6561. Good Rules: 0. Bad Rules: 6561.

    I don’t know what means. Gracias!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.