mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-05-06 11:32:59 +00:00
31 lines
666 B
C#
31 lines
666 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace Esiur.Analysis.Fuzzy
|
|
{
|
|
public enum MamdaniDefuzzifierMethod
|
|
{
|
|
CenterOfGravity,
|
|
FirstMaxima,
|
|
LastMaxima,
|
|
Bisector,
|
|
MeanOfMaxima,
|
|
}
|
|
public class MamdaniDefuzzifier
|
|
{
|
|
|
|
public static double Evaluate(INumericalSet<double>[] sets, MamdaniDefuzzifierMethod method, double from, double to, double step)
|
|
{
|
|
|
|
var union = sets.FuzzyUnion();
|
|
var output = union.ToDiscrete(from, to, step);
|
|
var max = output.Maximas;
|
|
return max[0].Key;
|
|
|
|
}
|
|
|
|
}
|
|
}
|