Esempio n. 1
0
    private void FuzzyCalculations()
    {
        _fBehaviour.SetConceptValue("Truck_Distancia", distancia);
        _fBehaviour.SetConceptValue("Truck_Velocidade", velocidade);


        Concept __concept = _fBehaviour.GetConcept("Truck_Risco");

        _fBehaviour.ExecuteConditions();
        print("Risco 1: " + __concept.GetFunction(0).Fuzzy);
        print("Risco 2: " + __concept.GetFunction(1).Fuzzy);
        print("Risco 3: " + __concept.GetFunction(2).Fuzzy);

        print("Defuzzy: " + __concept.Defuzzyfication(0.001f));
        Debug.Break();
    }
Esempio n. 2
0
    private void DisplayConceptAndFunctions()
    {
        if (displayer.DisplayConcepts = EditorGUILayout.Foldout(displayer.DisplayConcepts, "Concept List"))
        {
            for (int index = 0; index < target.ConceptList.Count; index++)
            {
                GUILayout.BeginVertical();
                {
                    GUILayout.BeginHorizontal();
                    {
                        displayer.SetDisplayFunctionOfConceptState(
                            EditorGUILayout.Foldout(displayer.DisplayFunctionsOfConcept(index), displayer.GetConceptName(index)),
                            index);

                        EditorGUILayout.ObjectField(target.ConceptList[index], typeof(Concept), false);

                        //Editable box with the concept value
                        if (target.SetConceptValue(index, EditorGUILayout.FloatField(target.ConceptList[index].Value, GUILayout.Width(50))))
                        {
                            EditorUtility.SetDirty(target.GetConcept(index));
                        }
                    }
                    GUILayout.EndHorizontal();


                    if (displayer.DisplayFunctionsOfConcept(index))
                    {
                        foreach (Function func in target.ConceptList[index].Functions)
                        {
                            EditorCommons.FuzzyFuncName(func);
                            EditorCommons.FuzzyFuncBody(func);
                            EditorCommons.FuzzyBeginCoord(func);
                            EditorCommons.FuzzyEndCoord(func);

                            GUILayout.Space(EditorCommons._defaultSpacing);
                        }
                    }
                }
                GUILayout.EndVertical();
            }
            GUILayout.Space(EditorCommons._defaultSpacing);
        }
    }