I am using fuzzy logic to calculate the desirability of certain strategic spots in a game.
I have 4 vars:
//in Actionscript 3.0
all these vars are ofcourse from 0 to 1.
and I want to calculate the desirability:
I want to use mDesirable in other fuzzy logic expressions.
So i don’t want to defuzzify it. it has to be a number between 0 and 1.
How do i do this? I can’t take the avarage of the four strategic vars, because, obviously a high mNotStrategic should cause mDesirable to be low. but if i took tha avarage, then it being VERY not strategic, would also make it very desirable.
I also want to be able to change the weight of those vars. so that the difference between mStrategic and mVeryStrategic, matters less, than the difference between mNotStrategic and mStrategic.
I hope i’ve made sense.
Thanks in advance.
these are the calculations. i dont know if you need them to answer my question. I’ll just post them to make sure.
var mWeak:Number = fuzzyReverseGrade (nrShips, 1, 2);
var mStable:Number = fuzzyTriangle (nrShips, 1, 3, 5);
var mStrong:Number = fuzzyTriangle (nrShips, 4, 6, 9);
var mVeryStrong:Number = fuzzyGrade (nrShips, 7, 10);
//above calculates the value of the amount of ships.
var mClose:Number = fuzzyReverseGrade (dist, , );
var mNearby:Number = fuzzyTrapezoid (dist, , , , );
var mFar:Number = fuzzyTrapezoid (dist, , , , );
var mVeryFar:Number = fuzzyGrade (dist, , );
//the above calculates the value of the distance from the player (i haven’t filled in the constants yet.)
var mNotStrategic:Number = OR(AND(mWeak,mClose), AND(mWeak,mNearby), AND(mVeryFar, OR(mWeak,mStable,notVery(mStrong))) );
//above means that a place is not strategic if it is weak and close or weak and nearby or very far and (weak,stable or kind of strong)
var mStrategic:Number = OR(AND(mStable,mNearby), AND(mWeak,mFar), AND(mStrong,mFar), AND(very(mVeryStrong),mVeryFar) );
//meaning the place is strategic if it’s stable and nearby or weak and far or strong and far or verystrong and very far
var mVeryStrategic:Number = OR(AND(mStrong, OR(notVery(mClose), mNearby)), AND(mVeryStrong, OR(notVery(mNearby),vFar) );
var mUnbeatable:Number = OR(AND(mVeryStrong,OR(mClose,very(mNearby))), AND(very(mVeryStrong), mNearby) );
Someone told me, that i might not need fuzzy logic. I wouldn’t know how i would have to do something like this without fuzzy logic. But I’m open to suggestions.