Click here to Skip to main content
15,886,362 members
Articles / Programming Languages / C#

Fuzzy Framework

Rate me:
Please Sign up or sign in to vote.
4.93/5 (107 votes)
27 Jan 2011CPOL26 min read 139.4K   12.5K   185  
In the following article, we briefly introduce Fuzzy Framework library which supports calculations based on fuzzy logic in .NET.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FuzzyFramework.Dimensions;

namespace FuzzyFramework.Sets
{
    /// <summary>
    /// Represents symetric, bell-shaped fuzzy number
    /// </summary>
    public class BellSet : QuadraticSet
    {

        private System.Decimal _peakValue;
        private System.Decimal _distanceToCrossover;
        private System.Decimal _distanceToSupportBound;
        
        
        /// <summary>
        /// Peak value - a single point where the membership degree is 1
        /// </summary>
        public System.Decimal PeakValue
        {
            get { return _peakValue; }
        }

        /// <summary>
        /// Distance from peak value p to crossover point β. Bandwidth = 2*distanceToCrossover. Bandwidth is defined as the segment (α-cut) at level α = 1/2.
        /// </summary>
        public System.Decimal DistanceToCrossover
        {
            get { return _distanceToCrossover;}
        }

        /// <summary>
        /// Distance from peak value p to the boundary of support a.
        /// </summary>
        public System.Decimal DistanceToSupportBound
        {
            get { return _distanceToSupportBound; }
        }


        public BellSet(IContinuousDimension dimension, string caption, System.Decimal peakValue, System.Decimal distanceToCrossover, System.Decimal distanceToSupportBound)
            : base(dimension, caption, peakValue, peakValue, peakValue - distanceToSupportBound, peakValue + distanceToSupportBound, peakValue - distanceToCrossover, peakValue + distanceToCrossover)
        {
            if (distanceToCrossover <= 0) throw new ArgumentOutOfRangeException("distanceToCrossover", "Positive number expected to define a distance.");
            if (distanceToSupportBound <= 0) throw new ArgumentOutOfRangeException("distanceToSupportBound", "Positive number expected to define a distance.");
            if (distanceToSupportBound <= distanceToCrossover) throw new ArgumentOutOfRangeException("distanceToSupportBound", "distanceToSupportBound must be higher than distanceToCrossover.");

            _distanceToCrossover = distanceToCrossover;
            _distanceToSupportBound = distanceToSupportBound;
            _peakValue = peakValue;
        }
        

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Student
Czech Republic Czech Republic
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions