public ThinkGoal(ConsciousGameEntity entity) : base(entity)
        {
            fuzzyModule = new FuzzyModule();

            FuzzyVariable hunger   = fuzzyModule.CreateFLV("Hunger");
            FzSet         starving = hunger.AddLeftShoulder("Starving", 0.0, 0.1, 0.3);
            FzSet         content  = hunger.AddTriangle("Content", 0.1, 0.5, 0.8);
            FzSet         full     = hunger.AddRightShoulder("Full", 0.5, 0.8, 1.0);

            FuzzyVariable sleep  = fuzzyModule.CreateFLV("Sleep");
            FzSet         tired  = sleep.AddLeftShoulder("Tired", 0.0, 0.1, 0.3);
            FzSet         sleepy = sleep.AddTriangle("Sleepy", 0.1, 0.3, 0.5);
            FzSet         awake  = sleep.AddRightShoulder("Awake", 0.3, 0.5, 1.0);

            FuzzyVariable desirability  = fuzzyModule.CreateFLV("Desirability");
            FzSet         undesirable   = desirability.AddLeftShoulder("Undesirable", 0, 0.25, 0.5);
            FzSet         desirable     = desirability.AddTriangle("Desirable", 0.25, 0.5, 0.75);
            FzSet         veryDesirable = desirability.AddRightShoulder("VeryDesirable", 0.5, 0.75, 1.0);

            fuzzyModule.AddRule(new FzOR(starving, tired), undesirable);
            fuzzyModule.AddRule(new FzAND(content, sleepy), undesirable);
            fuzzyModule.AddRule(new FzAND(full, sleepy), desirable);
            fuzzyModule.AddRule(new FzAND(content, awake), desirable);
            fuzzyModule.AddRule(new FzAND(full, awake), veryDesirable);
        }
예제 #2
0
        public MakeDecisionGoal(AwareEntity me) : base(me)
        {
            fuzzyModule = new FuzzyModule();

            FuzzyVariable hunger  = fuzzyModule.CreateFLV("Hunger");
            FzSet         hungry  = hunger.AddLeftShoulder("Hungry", 0.0, 0.1, 0.3);
            FzSet         content = hunger.AddTriangle("Content", 0.1, 0.5, 0.8);
            FzSet         full    = hunger.AddRightShoulder("Full", 0.5, 0.8, 1.0);

            FuzzyVariable fatique = fuzzyModule.CreateFLV("Fatique");
            FzSet         sleepy  = fatique.AddLeftShoulder("Sleepy", 0.0, 0.1, 0.3);
            FzSet         awake   = fatique.AddTriangle("Awake", 0.1, 0.3, 0.5);
            FzSet         alert   = fatique.AddRightShoulder("Alert", 0.3, 0.5, 1.0);

            FuzzyVariable desirability  = fuzzyModule.CreateFLV("Desirability");
            FzSet         unDesirable   = desirability.AddLeftShoulder("Undesirable", 0, 0.25, 0.5);
            FzSet         desirable     = desirability.AddTriangle("Desirable", 0.25, 0.5, 0.75);
            FzSet         veryDesirable = desirability.AddRightShoulder("VeryDesirable", 0.5, 0.75, 1.0);

            fuzzyModule.AddRule(new FzAND(hungry, sleepy), unDesirable);
            fuzzyModule.AddRule(new FzAND(hungry, awake), desirable);
            fuzzyModule.AddRule(new FzAND(hungry, alert), veryDesirable);
            fuzzyModule.AddRule(new FzAND(content, sleepy), unDesirable);
            fuzzyModule.AddRule(new FzAND(content, awake), desirable);
            fuzzyModule.AddRule(new FzAND(content, alert), veryDesirable);
            fuzzyModule.AddRule(new FzAND(full, sleepy), unDesirable);
            fuzzyModule.AddRule(new FzAND(full, awake), desirable);
            fuzzyModule.AddRule(new FzAND(full, alert), veryDesirable);
        }