【问题标题】:classify numbers using fuzzy logic in C#在 C# 中使用模糊逻辑对数字进行分类
【发布时间】:2014-05-28 14:00:19
【问题描述】:

我想使用模糊逻辑框架在 c# 中编写一个小代码,其中用户将输入 0 到 10 之间的数字,并且数字需要分类为低、中和高。 Low 是 0 到 3,Moderate 是 3 到 7,High 是介于 6 到 10 之间。使用三角隶属函数。任何猜测如何做到这一点我阅读了一些关于模糊框架的教程,但无法让我的问题适合那些。以下是我写的代码,

 class Program
    {
        static void Main(string[] args)
        { 
            ContinuousDimension score = new ContinuousDimension("score", "score of word", "unit", 0, 10);    

            //Definition of basic fuzzy sets with which we will work
            //  input sets:

 ContinuousSet low = new RightQuadraticSet(score, "Low Score", 0, 3, 4);
            ContinuousSet high = new LeftQuadraticSet(score, "High Score", 6, 7, 10);
            ContinuousSet mod = new BellSet(score, "Moderate Score", 5, 1, 2);

....
}

我现在应该如何继续。我已经手动为意见词分配了一些分数,范围为 0 到 10,我想使用三角函数将此意见词的强度分类为低、中或高。

【问题讨论】:

  • 发布您迄今为止编写的代码,并根据您正在处理的确切问题制定一个问题。如果您已经编写了一个工作版本,并且没有特定的错误和异常,请将其发布到代码审查中。
  • 我编辑了问题,请重新开始...

标签: c# fuzzy-logic


【解决方案1】:

模糊逻辑可以有效地处理情况。考虑一下您不想在加热和冷却之间来回切换的温度控制,因为那样会非常消耗能源。

在你的例子中,你会有这样的东西:

Very low = low limit of moderate => below 2.5 => time to turn on the heater

Very high = high limit of moderate => above 7.5 => time to turn on the AC

在您对“非常低”事件(打开加热器)采取行动后,下一个行动是当值高于下限 (3.5) 时,即关闭加热器。

Very Low = 0 - 2.5
Moderate Low = 2.5 - 3.5
Moderate = 3.5-6.5
Moderate High = 6.5 - 7.5
Very High = 7.5-10

【讨论】:

  • 感谢您的帮助,但我已经详细解决了我的问题,现在我不想采取一些行动,只需要根据模糊逻辑进行分类,以便对模糊的意见进行适当的分类......
猜你喜欢
  • 2015-06-19
  • 1970-01-01
  • 2016-10-05
  • 2014-07-23
  • 2012-05-13
  • 2010-12-19
  • 2017-09-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多