Beispiel #1
0
        public void T6Implicate()
        {
            double axis = 0;

            LinguisticVariable =
                LinguisticVariable.fromJson(JsonLingVar);
            LinguisticVariable.RangeCalibration(1, 0.01);
            ExternalLVSetUp();
            string LogMsg = "[Implicate Test Result]\n==================================\n";
            string TmpLog;

            LinguisticVariable.ApplyRule(LingVars);
            LinguisticVariable.Implicate(1);
            foreach (LinguisticRule rule in LinguisticVariable.linguisticRules)
            {
                TmpLog  = "Linguistic : " + rule.membershipValue.linguistic + "\n";
                TmpLog += "Implication Method : " + FuzzyImplication.nameOf(rule.implicationM) + "\n";
                TmpLog += "Axis\t| Implication\n";
                axis    = rule.implData.StartAxis;
                foreach (double implRes in rule.implData.data)
                {
                    TmpLog += axis + "\t| " + implRes + "\n";
                    axis   += rule.implData.spacing;
                }
                LogMsg += TmpLog + "==================================\n";
                TmpLog  = "";
            }
            Debug.Log(LogMsg);
        }
Beispiel #2
0
        /*
         * public JSONObject encodeCompleteJson()
         * {
         *  JSONObject encoded = this.encodeLinguisticJson();
         *  encoded.AddField("Rule", Eval.double2Float(this.fuzzyValue));
         *  return encoded;
         * }
         */
        public JSONObject encodeLinguisticJson()
        {
            JSONObject encoded = new JSONObject(JSONObject.Type.OBJECT);

            encoded.AddField("Value", this.membershipValue.linguistic);
            encoded.AddField("Operator", FuzzyOperator.nameOf(this.fOperator));
            encoded.AddField("Implication",
                             FuzzyImplication.nameOf(this.implicationM));
            encoded.AddField("Rule", this.rule);
            return(encoded);
        }
Beispiel #3
0
        public void setup()
        {
            TestJsonRule =
                @"
{
    ""Value"" : """ + testRuleValue + @""",
    ""Operator"" : """ + FuzzyOperator.nameOf(TestOperator) + @""",
    ""Implication"" : """ + FuzzyImplication.nameOf(TestImplication) + @""",
    ""Rule"" : """ + testActualRule + @"""
}
";
        }