سلام دوستان وقتتون بخير!
من زياد با منطق فازي آشنا نيستم يك قطعه كد در سي شارپ هست كه من دقيقا نميدونم اون چه كاري انجام ميده ؛ ميتونين يه راهنمايي كنين بگين اين 4 تا عددي كه در قسمت MembershipFunction نوشتن چيه؟ و اعدادي كه مثلا در قسمت Cold هست با اعدادي كه در قسمت Tepid هست چه ربطي به هم دارن.
ممنون ميشم يه توضيحاتي در اين باره بدين
كد:
LinguisticVariable water = new LinguisticVariable(“Water”);
water.MembershipFunctionCollection.Add(new MembershipFunction(“Cold”, 0, 0, 20, 40));
water.MembershipFunctionCollection.Add(new MembershipFunction(“Tepid”, 30, 50, 50, 70));
water.MembershipFunctionCollection.Add(new MembershipFunction(“Hot”, 50, 80, 100, 100));
LinguisticVariable power = new LinguisticVariable(“Power”);
power.MembershipFunctionCollection.Add(new MembershipFunction(“Low”, 0, 25, 25, 50));
power.MembershipFunctionCollection.Add(new MembershipFunction(“High”, 25, 50, 50, 75));
FuzzyEngine fuzzyEngine = new FuzzyEngine();
fuzzyEngine.LinguisticVariableCollection.Add(water);
fuzzyEngine.LinguisticVariableCollection.Add(power);
fuzzyEngine.Consequent = “Power”;
fuzzyEngine.FuzzyRuleCollection.Add(new FuzzyRule(“IF (Water IS Cold) OR (Water IS Tepid) THEN Power IS High”));
fuzzyEngine.FuzzyRuleCollection.Add(new FuzzyRule(“IF (Water IS Hot) THEN Power IS Low”));
water.InputValue = 60;
try
{
MessageBox.Show(fuzzyEngine.Defuzzify().ToString());
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}