Информационное обеспечение системы управления подъёмно-транспортным механизмом

/// </summary>

public List<ICondition> Conditins

{

get { return _conditins; }

}

}

/// <summary>

/// Interface used by rule parser

/// </summary>

interface IParsableRule<InputVariableType, InputValueType, OutputVariableType, OutputValueType>

where InputVariableType : class, INamedVariable

where InputValueType :

class, INamedValue

where OutputVariableType : class, INamedVariable

where OutputValueType : class, INamedValue

{

/// <summary>

/// Condition (IF) part of the rule

/// </summary>

Conditions Condition { get; set; }

/// <summary>

/// Conclusion (THEN) part of the rule

/// </summary>

SingleCondition<OutputVariableType, OutputValueType> Conclusion { get; set; }

}

/// <summary>

/// Implements common functionality of fuzzy rules

/// </summary>

public abstract class GenericFuzzyRule

{

Conditions _condition = new Conditions();

/// <summary>

/// Condition (IF) part of the rule

/// </summary>

public Conditions Condition

{

get { return _condition; }

set { condition = value}

}

/// <summary>

/// Create a single condition

/// </summary>

/// <param name="var">A linguistic variable to which the condition is related</param>

/// <param name="term">A term in expression 'var is term'</param>

/// <returns>Generated condition</returns>

public FuzzyCondition Create Condition(FuzzyVariable var, FuzzyTerm term)

{

return new FuzzyCondition(var, term);

}

/// <summary>

/// Create a single condition

/// </summary>

/// <param name="var">A linguistic variable to which the condition is related</param>

/// <param name="term">A term in expression 'var is term'</param>

/// <param name="not">Does condition contain 'not'</param>

/// <returns>Generated condition</returns/>

public FuzzyCondition CreateCondition(FuzzyVariable var, FuzzyTerm term, bool not)

{

return new FuzzyCondition(var, term);

}

}

/// <summary>

/// Fuzzy rule for Mamdani fuzzy system

/// </summary>

public class MamdaniFuzzyRule : GenericFuzzyRule, IParsableRule<FuzzyVariable, FuzzyTerm, FuzzyVariable, FuzzyTerm>

{

FuzzyConclusion _conclusion = new FuzzyConclusion();

double _weight = 1.0;

/// <summary>

/// Constructor. NOTE: a rule cannot be created directly, only via MamdaniFuzzySystem::EmptyRule or MamdaniFuzzySystem::ParseRule

/// </summary>

internal MamdaniFuzzyRule()

{}

/// <summary>

/// Conclusion (THEN) part of the rule

/// </summary>

public FuzzyConclusion Conclusion

{

get { return _conclusion; }

set { _conclusion = value; }

}

/// <summary>

/// Weight of the rule

/// </summary>

public double Weight

{

get { return _weight; }

set { _weight = value; }

}

}

/// <summary>

/// Fuzzy rule for Sugeno fuzzy system

/// </summary>

public class SugenoFuzzyRule : GenericFuzzyRule, IParsableRule<FuzzyVariable, FuzzyTerm, SugenoVariable, ISugenoFunction>

{

SugenoConclusion _conclusion = new SugenoConclusion();

/// <summary>

/// Constructor. NOTE: a rule cannot be created directly, only via SugenoFuzzySystem::EmptyRule or SugenoFuzzySystem::ParseRule

/// </summary>

internal SugenoFuzzyRule()

{}

/// <summary>

/// Conclusion (THEN) part of the rule

/// </summary>

public SugenoConclusion Conclusion

{

get { return _conclusion; }

set { _conclusion = value; }

}

}

}

2) FuzzyVariable.cs

* biblioteka dlya sozdaniya fuzzy variable

using System;

using System.Collections.Generic;

namespace AI.Fuzzy.Library

{

/// <summary>

/// Linguistic variable

/// </summary>

public class FuzzyVariable : NamedVariableImpl

{

double _min = 0.0, _max = 10.0;

List<FuzzyTerm> _terms = new List<FuzzyTerm>();

/// <summary>

/// Constructor

/// </summary>

/// <param name="name">Name of the variable</param>

/// <param name="min">Minimum value</param>

/// <param name="max">Maximum value</param>

public FuzzyVariable(string name, double min, double max) : base (name)

{

if (min > max)

{

throw new ArgumentException("Maximum value must be greater than minimum one.");

}

_min = min;

_max = max;

}

/// <summary>

/// Terms

/// </summary>

public List<FuzzyTerm> Terms

{

get { return _terms}

}

/// <summary>

/// Named values

/// </summary>

public override List<INamedValue> Values

{

get

{

List<INamedValue> result = new List<INamedValue>();

foreach (FuzzyTerm term in _terms)

{

result.Add(term);

}

return result;

}

}

/// <summary>

/// Get membership function (term) by name

/// </summary>

/// <param name="name">Term name</param>

/// <returns></returns>

public FuzzyTerm GetTermByName(string name)

{

foreach (FuzzyTerm term in _term)

{

if (term.Name == name)

{

return term;

}

}

throw new KeyNotFoundException(0);

}

/// <summary>

/// Maximum value of the variable

/// </summary>

public double Max

{

get { return _max; }

set { _max = value; }

}

/// <summary>

/// Minimum value of the variable

/// </summary>

public double Min

{

get { return _min; }

set { _min = value; }

}

}

}

3)FuzzyTerm.cs

* to create fuzzy term

using System;

using System.Collections.Generic;

namespace AI.Fuzzy.Library

{

/// <summary>

/// Linguistic term

/// </summary>

public class FuzzyTerm : NamedValueImp

{

IMembershipFunction _mf;

/// <summary>

/// Constructor

/// </summary>

/// <param name="name">Term name</param>

/// <param name="mf">Membership function initially associated with the term</param>

public FuzzyTerm(string name, IMembershipFunction mf) : base(name)

{

_mf = mf;

}

/// <summary>

/// Membership function initially associated with the term

Страница:  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15 
 16  17 


Другие рефераты на тему «Производство и технологии»:

Поиск рефератов

Последние рефераты раздела

Copyright © 2010-2024 - www.refsru.com - рефераты, курсовые и дипломные работы