private static void Main() { var d = Domain.IntRange(0, 11); // {0,1,...,10} IFuzzySet set1 = new MutableFuzzySet(d) .Set(DomainElement.Of(0), 1.0) .Set(DomainElement.Of(1), 0.8) .Set(DomainElement.Of(2), 0.6) .Set(DomainElement.Of(3), 0.4) .Set(DomainElement.Of(4), 0.2); Console.WriteLine("Set 1:"); Console.WriteLine(set1); Console.WriteLine(); var d2 = Domain.IntRange(-5, 6); // {-5,-4,...,4,5} IFuzzySet set2 = new CalculatedFuzzySet( d2, StandardFuzzySets.LambdaFunction( d2.IndexOfElement(DomainElement.Of(-4)), d2.IndexOfElement(DomainElement.Of(0)), d2.IndexOfElement(DomainElement.Of(4)) ) ); Console.WriteLine("Set 2:"); Console.WriteLine(set2); Console.WriteLine(); Console.ReadKey(); }
static void Primjer12() { IDomain d = Domain.IntRange(0, 11); // {0,1,...,10} //Debug1.Print(d, "Elementi domene d1:"); IFuzzySet set1 = new MutableFuzzySet(d) .Set(DomainElement.Of(0), 1.0) .Set(DomainElement.Of(1), 0.8) .Set(DomainElement.Of(2), 0.6) .Set(DomainElement.Of(3), 0.4) .Set(DomainElement.Of(4), 0.2); Debug1.Print(set1, "Set1:"); IDomain d2 = Domain.IntRange(-5, 6); // {-5,-4,...,4,5} IFuzzySet set2 = new CalculatedFuzzySet( d2, StandardFuzzySets.LambdaFunction( d2.IndexOfElement(DomainElement.Of(-4)), d2.IndexOfElement(DomainElement.Of(0)), d2.IndexOfElement(DomainElement.Of(4)) ) ); Debug1.Print(set2, "Set2:"); }
public static void Test33() { double[] antecMembershipFunctions = new double[] { 0.8, 0.8, 0.7, 1, 0.7, 0.9 }; double minMembershipFunc = antecMembershipFunctions.Min(); IDomain u = Domain.IntRange(-5, 6); IFuzzySet _conseq = new CalculatedFuzzySet( u, StandardFuzzySets.LambdaFunction( u.IndexOfElement(DomainElement.Of(-5)), u.IndexOfElement(DomainElement.Of(-3)), u.IndexOfElement(DomainElement.Of(0)) ) ); Debug1.Print(_conseq, "Konsekv1:"); IFuzzySet antecedents = new CalculatedFuzzySet( //mjere pripadnosti su na minimumu mj.pripadnosti antecedenata _conseq.GetDomain(), StandardFuzzySets.UniversalFunction(minMembershipFunc) ); IFuzzySet conclusion = Operations.Operations.BinaryOperation(antecedents, _conseq, Operations.Operations.ZadehAnd()); Debug1.Print(conclusion, "Zakljucak1:"); }
public static void Test32() { IDomain u = Domain.IntRange(-5, 6); // {-5,-4,...,4,5} IDomain u2 = Domain.Combine(u, u); IFuzzySet set = new CalculatedFuzzySet( u2, StandardFuzzySets.LambdaFunction( u2.IndexOfElement(DomainElement.Of(-4, 2)), u2.IndexOfElement(DomainElement.Of(0, 0)), u2.IndexOfElement(DomainElement.Of(4, 2)) ) ); Debug1.Print(set, "Set cf:"); IFuzzySet notSet1 = Operations.Operations.UnaryOperation( set, Operations.Operations.ZadehNot()); Debug1.Print(notSet1, "notSet1:"); IFuzzySet union = Operations.Operations.BinaryOperation( set, notSet1, Operations.Operations.ZadehOr()); Debug1.Print(union, "Set1 union notSet1:"); }
public AkcelFuzzySystem(Defuzzifier defuzzifier) { this.defuzzifier = defuzzifier; IDomain acceleration = Domain.IntRange(-5, 6); IDomain direction = Domain.IntRange(0, 2); IDomain distance = Domain.IntRange(0, 1301); IDomain velocity = Domain.IntRange(0, 100); MutableFuzzySet Id = new MutableFuzzySet(distance); MutableFuzzySet Iv = new MutableFuzzySet(velocity); foreach (var element in distance) { Id.Set(element, 1); } foreach (var element in velocity) { Iv.Set(element, 1); } IFuzzySet Slow = new CalculatedFuzzySet(velocity, StandardFuzzySets.LFunction(0, 40)); IFuzzySet Medium = new CalculatedFuzzySet(velocity, StandardFuzzySets.LambdaFunction(37, 45, 55)); IFuzzySet Fast = new CalculatedFuzzySet(velocity, StandardFuzzySets.GammaFunction(48, 60)); IFuzzySet CriticalClose = new CalculatedFuzzySet(distance, StandardFuzzySets.LFunction(10, 30)); IFuzzySet Close = new CalculatedFuzzySet(distance, StandardFuzzySets.LFunction(25, 50)); IFuzzySet Far = new CalculatedFuzzySet(distance, StandardFuzzySets.GammaFunction(70, 100)); IFuzzySet Backward = new MutableFuzzySet(direction).Set(DomainElement.Of(0), 1); IFuzzySet Forward = new MutableFuzzySet(direction).Set(DomainElement.Of(1), 1); IFuzzySet SpeedUp = new MutableFuzzySet(acceleration) .Set(DomainElement.Of(5), 1) .Set(DomainElement.Of(4), 0.6) .Set(DomainElement.Of(3), 0.3); IFuzzySet Neutral = new MutableFuzzySet(acceleration).Set(DomainElement.Of(0), 1); IFuzzySet SlowDown = new MutableFuzzySet(acceleration) .Set(DomainElement.Of(-5), 1) .Set(DomainElement.Of(-4), 0.6) .Set(DomainElement.Of(-3), 0.3); // L, D, LK, RK, V, S rules = new List <Rule>(); rules.Add(new Rule(new[] { Id, Id, CriticalClose, Id, Iv, Forward }, Neutral, tNorm, implication)); rules.Add(new Rule(new[] { Id, Id, Id, CriticalClose, Iv, Forward }, Neutral, tNorm, implication)); rules.Add(new Rule(new[] { Id, Id, CriticalClose, Id, Iv, Backward }, Neutral, tNorm, implication)); rules.Add(new Rule(new[] { Id, Id, Id, CriticalClose, Iv, Backward }, Neutral, tNorm, implication)); rules.Add(new Rule(new[] { Id, Id, Id, Id, Fast, Forward }, SlowDown, tNorm, implication)); rules.Add(new Rule(new[] { Id, Id, Id, Id, Medium, Forward }, Neutral, tNorm, implication)); rules.Add(new Rule(new[] { Id, Id, Id, Id, Slow, Forward }, SpeedUp, tNorm, implication)); }
public static void Test31() { IDomain u = Domain.IntRange(-5, 6); // {-5,-4,...,4,5} IDomain u2 = Domain.Combine(u, u); IFuzzySet set = new CalculatedFuzzySet( u2, StandardFuzzySets.LambdaFunction( u2.IndexOfElement(DomainElement.Of(-4, 2)), u2.IndexOfElement(DomainElement.Of(0, 0)), u2.IndexOfElement(DomainElement.Of(4, 2)) ) ); Debug1.Print(set, "Set cf:"); }
private static void Main(string[] args) { SimpleDomain sd = new SimpleDomain(-4, 5); PrintDomain(sd, "sd: "); IDomain cd = IDomain.Combine(sd, sd); PrintDomain(cd, "cd: "); IDomain d = IDomain.IntRange(0, 11); IFuzzySet set1 = new MutableFuzzySet(d).Set(DomainElement.Of(0), 1.0); PrintFuzzySet(set1, "set1: "); IDomain d2 = IDomain.IntRange(-5, 6); IFuzzySet set2 = new CalculatedFuzzySet(d2, StandardFuzzySets.LambdaFunction(d2.IndexOfElement(DomainElement.Of(-4)), d2.IndexOfElement(DomainElement.Of(0)), d2.IndexOfElement(DomainElement.Of(4)))); PrintFuzzySet(set2, "set2: "); IDomain d7 = IDomain.IntRange(0, 11); IFuzzySet set3 = new MutableFuzzySet(d7).Set(DomainElement.Of(0), 1.0) .Set(DomainElement.Of(1), 0.8) .Set(DomainElement.Of(2), 0.6) .Set(DomainElement.Of(3), 0.4) .Set(DomainElement.Of(4), 0.2); PrintFuzzySet(set3, "set3: "); IFuzzySet notSet3 = Operations.UnaryOperation(set3, Operations.ZadehNot()); PrintFuzzySet(notSet3, "notSet3: "); IFuzzySet union = Operations.BinaryOperation(set3, notSet3, Operations.ZadehOr()); PrintFuzzySet(union, "Set3 U notSet3: "); IFuzzySet hinters = Operations.BinaryOperation(set3, notSet3, Operations.HamacherTNorm(1.0)); PrintFuzzySet(hinters, "Set3 Intersection with notSet3 using parameterised Hamacher T norm with parameter 1.0: "); }
private static void PrintExample2() { Console.WriteLine("EXAMPLE 2"); IDomain d = IDomain.IntRange(0, 11); IFuzzySet set1 = new MutableFuzzySet(d) .Set(DomainElement.Of(0), 1.0) .Set(DomainElement.Of(1), 0.8) .Set(DomainElement.Of(2), 0.6) .Set(DomainElement.Of(3), 0.4) .Set(DomainElement.Of(4), 0.2); PrintFuzzySet(set1, "Set1: "); IDomain d2 = IDomain.IntRange(-5, 6); IFuzzySet set2 = new CalculatedFuzzySet(d2, StandardFuzzySets.LambdaFunction(d2.IndexOfElement(DomainElement.Of(-4)), d2.IndexOfElement(DomainElement.Of(0)), d2.IndexOfElement(DomainElement.Of(4)))); PrintFuzzySet(set2, "Set2: "); Console.WriteLine("---------------------------------------"); Console.WriteLine(); }
public MediumVelocity(string name) { Name = name; FuzzySet = new CalculatedFuzzySet(IDomain.IntRange(0, 100), StandardFuzzySets.LambdaFunction(10, 40, 70)); }
public MiddleDistance(string name) { Name = name; FuzzySet = new CalculatedFuzzySet(IDomain.IntRange(0, 1301), StandardFuzzySets.LambdaFunction(30, 90, 150)); }
public KormiloFuzzySystem(Defuzzifier defuzzifier) { this.defuzzifier = defuzzifier; IDomain angle = Domain.IntRange(-90, 91); IDomain direction = Domain.IntRange(0, 2); IDomain distance = Domain.IntRange(0, 1301); IDomain velocity = Domain.IntRange(0, 100); MutableFuzzySet Id = new MutableFuzzySet(distance); MutableFuzzySet Iv = new MutableFuzzySet(velocity); foreach (var element in distance) { Id.Set(element, 1); } foreach (var element in velocity) { Iv.Set(element, 1); } //IFuzzySet CriticalClose = new CalculatedFuzzySet(distance, StandardFuzzySets.LFunction(20, 40)); IFuzzySet Close = new CalculatedFuzzySet(distance, StandardFuzzySets.LFunction(40, 90)); IFuzzySet Far = new CalculatedFuzzySet(distance, StandardFuzzySets.GammaFunction(100, 200)); IFuzzySet VeryFar = new CalculatedFuzzySet(distance, StandardFuzzySets.GammaFunction(300, 400)); //IFuzzySet NotFar = Operations.UnaryOperation(Far, Operations.ZadehNot()); IFuzzySet Backward = new MutableFuzzySet(direction).Set(DomainElement.Of(0), 1); IFuzzySet Forward = new MutableFuzzySet(direction).Set(DomainElement.Of(1), 1); IFuzzySet Left = new MutableFuzzySet(angle).Set(DomainElement.Of(90), 1); //IFuzzySet Left = new CalculatedFuzzySet(angle, StandardFuzzySets.LambdaFunction(0, 30, 50)); //IFuzzySet FullLeft = new CalculatedFuzzySet(angle, StandardFuzzySets.LambdaFunction(55, 70, 80)); IFuzzySet Neutral = new CalculatedFuzzySet(angle, StandardFuzzySets.LambdaFunction(-10, 0, 10)); //IFuzzySet Right = new CalculatedFuzzySet(angle, StandardFuzzySets.LambdaFunction(-50, -30, 0)); IFuzzySet Right = new MutableFuzzySet(angle).Set(DomainElement.Of(-90), 1); //IFuzzySet FullRight = new CalculatedFuzzySet(angle, StandardFuzzySets.LambdaFunction(-80, -70, -55)); // L, D, LK, RK, V, S rules = new List <Rule>(); rules.Add(new Rule(new[] { Id, Close, Id, Id, Iv, Forward }, Left, tNorm, implication)); rules.Add(new Rule(new[] { Close, Id, Id, Id, Iv, Forward }, Right, tNorm, implication)); rules.Add(new Rule(new[] { Id, Id, Id, Close, Iv, Forward }, Left, tNorm, implication)); rules.Add(new Rule(new[] { Id, Id, Close, Id, Iv, Forward }, Right, tNorm, implication)); rules.Add(new Rule(new[] { VeryFar, Id, Id, Id, Iv, Backward }, Left, tNorm, implication)); rules.Add(new Rule(new[] { Id, VeryFar, Id, Id, Iv, Backward }, Right, tNorm, implication)); //rules.Add(new Rule(new[] { Far, Close, Id, Id, Iv, Forward }, Left, tNorm, implication)); //rules.Add(new Rule(new[] { Id, Close, Id, CriticalClose, Iv, Forward }, FullLeft)); //rules.Add(new Rule(new[] { Far, Close, Id, Id, Iv, Backward }, Left, tNorm, implication)); //rules.Add(new Rule(new[] { Far, Far, Id, Id, Iv, Forward }, Neutral)); //rules.Add(new Rule(new[] { Close, Far, Id, Id, Iv, Forward }, Right, tNorm, implication)); //rules.Add(new Rule(new[] { Close, Id, CriticalClose, Id, Iv, Forward }, FullRight)); //rules.Add(new Rule(new[] { Close, Far, Id, Id, Iv, Backward }, Right, tNorm, implication)); //rules.Add(new Rule(new[] { Far, Id, Close, Close, Iv, Forward }, Left, tNorm, implication)); //rules.Add(new Rule(new[] { Id, Far, Close, Close, Iv, Forward }, Right, tNorm, implication)); //rules.Add(new Rule(new[] { VeryFar, VeryFar, Close, Close, Iv, Forward }, Right, tNorm, implication)); //rules.Add(new Rule(new[] { Far, Id, Close, Close, Iv, Backward }, Right, tNorm, implication)); ////rules.Add(new Rule(new[] { Id, Far, Close, Close, Iv, Backward }, Left, tNorm, implication)); //rules.Add(new Rule(new[] { Close, Close, Id, Close, Iv, Forward }, Left, tNorm, implication)); //rules.Add(new Rule(new[] { Close, Close, Close, Id, Iv, Forward }, Right, tNorm, implication)); //rules.Add(new Rule(new[] { Id, Id, Id, Id, Iv, Backward }, Right, tNorm, implication)); //rules.Add(new Rule(new[] { VeryFar, Id, Close, Close, Iv, Forward }, Right, tNorm, implication)); //rules.Add(new Rule(new[] { Id, VeryFar, Close, Close, Iv, Forward }, Left, tNorm, implication)); }
public NoHelmRotation(string name) { Name = name; FuzzySet = new CalculatedFuzzySet(IDomain.IntRange(-90, 91), StandardFuzzySets.LambdaFunction(-10, 0, 10)); }
private void KormiloRuleBook() { KormiloRules.Add( new Rule( Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(0)), Rule.UANTEC.IndexOfElement(DomainElement.Of(80))) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(0)), Rule.UANTEC.IndexOfElement(DomainElement.Of(80))) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LambdaFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(0)), Rule.UANTEC.IndexOfElement(DomainElement.Of(35)), Rule.UANTEC.IndexOfElement(DomainElement.Of(60))) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleConsequensKor(StandardFuzzySets.LambdaFunction( Rule.UKOR.IndexOfElement(DomainElement.Of(-60)), Rule.UKOR.IndexOfElement(DomainElement.Of(-45)), Rule.UKOR.IndexOfElement(DomainElement.Of(-30))) //umjeren udesno ) ) ); KormiloRules.Add( new Rule( Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(50)), Rule.UANTEC.IndexOfElement(DomainElement.Of(80))) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.GammaFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(70)), Rule.UANTEC.IndexOfElement(DomainElement.Of(90))) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LambdaFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(35)), Rule.UANTEC.IndexOfElement(DomainElement.Of(75)), Rule.UANTEC.IndexOfElement(DomainElement.Of(135))) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleConsequensKor(StandardFuzzySets.LambdaFunction( Rule.UKOR.IndexOfElement(DomainElement.Of(-90)), Rule.UKOR.IndexOfElement(DomainElement.Of(-80)), Rule.UKOR.IndexOfElement(DomainElement.Of(-55))) //ostro udesno ) ) ); KormiloRules.Add( new Rule( Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(0)), Rule.UANTEC.IndexOfElement(DomainElement.Of(80))) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(0)), Rule.UANTEC.IndexOfElement(DomainElement.Of(80))) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LambdaFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(0)), Rule.UANTEC.IndexOfElement(DomainElement.Of(35)), Rule.UANTEC.IndexOfElement(DomainElement.Of(60))) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleConsequensKor(StandardFuzzySets.LambdaFunction( Rule.UKOR.IndexOfElement(DomainElement.Of(30)), Rule.UKOR.IndexOfElement(DomainElement.Of(45)), Rule.UKOR.IndexOfElement(DomainElement.Of(60))) //umjeren ulijevo ) ) ); KormiloRules.Add( new Rule( Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.GammaFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(70)), Rule.UANTEC.IndexOfElement(DomainElement.Of(90))) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(50)), Rule.UANTEC.IndexOfElement(DomainElement.Of(80))) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LambdaFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(35)), Rule.UANTEC.IndexOfElement(DomainElement.Of(75)), Rule.UANTEC.IndexOfElement(DomainElement.Of(135))) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleConsequensKor(StandardFuzzySets.LambdaFunction( Rule.UKOR.IndexOfElement(DomainElement.Of(55)), Rule.UKOR.IndexOfElement(DomainElement.Of(80)), Rule.UKOR.IndexOfElement(DomainElement.Of(90))) //ostro ulijevo ) ) ); KormiloRules.Add( new Rule( Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(30)), Rule.UANTEC.IndexOfElement(DomainElement.Of(50))) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(30)), Rule.UANTEC.IndexOfElement(DomainElement.Of(60))) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleConsequensKor(StandardFuzzySets.LFunction( Rule.UKOR.IndexOfElement(DomainElement.Of(-80)), Rule.UKOR.IndexOfElement(DomainElement.Of(-25))) //ostro udesno vrlo blizu lijevo neovisno o brzini ) ) ); KormiloRules.Add( new Rule( Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(30)), Rule.UANTEC.IndexOfElement(DomainElement.Of(50))) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(30)), Rule.UANTEC.IndexOfElement(DomainElement.Of(60))) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleConsequensKor(StandardFuzzySets.GammaFunction( Rule.UKOR.IndexOfElement(DomainElement.Of(25)), Rule.UKOR.IndexOfElement(DomainElement.Of(80))) //ostro ulijevo vrlo blizu desno neovisno o brzini ) ) ); KormiloRules.Add( new Rule( Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LambdaFunction( Rule.UKOR.IndexOfElement(DomainElement.Of(-2)), Rule.UKOR.IndexOfElement(DomainElement.Of(0)), Rule.UKOR.IndexOfElement(DomainElement.Of(1))) ), Rule.MakeFuzzyRuleConsequensAcc(StandardFuzzySets.LambdaFunction( Rule.UKOR.IndexOfElement(DomainElement.Of(-90)), Rule.UKOR.IndexOfElement(DomainElement.Of(-85)), Rule.UKOR.IndexOfElement(DomainElement.Of(-80))) ) //rotiraj ) ); }
public ZeroAcceleration(string name) { Name = name; FuzzySet = new CalculatedFuzzySet(IDomain.IntRange(-50, 51), StandardFuzzySets.LambdaFunction(-15, 0, 15)); }
private void AkcelRuleBook() { AkcelRules.Add( new Rule( Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(50)), Rule.UANTEC.IndexOfElement(DomainElement.Of(75))) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleConsequensAcc(StandardFuzzySets.LambdaFunction( Rule.UACC.IndexOfElement(DomainElement.Of(0)), Rule.UACC.IndexOfElement(DomainElement.Of(10)), Rule.UACC.IndexOfElement(DomainElement.Of(20))) ) //ubrzaj do 75 ) ); AkcelRules.Add( new Rule( Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(0)), Rule.UANTEC.IndexOfElement(DomainElement.Of(80))) ), //vrlo blizu obali lijevo Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), //nebitno desno Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(0)), Rule.UANTEC.IndexOfElement(DomainElement.Of(80))) ), //vrlo blizu LK Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.GammaFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(80)), Rule.UANTEC.IndexOfElement(DomainElement.Of(200))) ), //umjereno blizu LK Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LambdaFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(35)), Rule.UANTEC.IndexOfElement(DomainElement.Of(65)), Rule.UANTEC.IndexOfElement(DomainElement.Of(135))) //do cca 90 px/s ), //velika brzina Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), //nebitno S?? //TODO mozda popraviti domenu od S Rule.MakeFuzzyRuleConsequensAcc(StandardFuzzySets.LambdaFunction( Rule.UACC.IndexOfElement(DomainElement.Of(-30)), Rule.UACC.IndexOfElement(DomainElement.Of(-22)), Rule.UACC.IndexOfElement(DomainElement.Of(0))) ) //zavoj ) ); AkcelRules.Add( new Rule( Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), //nebitno lijevo Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(0)), Rule.UANTEC.IndexOfElement(DomainElement.Of(80))) ), //umjereno blizu desno Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.GammaFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(80)), Rule.UANTEC.IndexOfElement(DomainElement.Of(200))) ), //umjereno blizu LK Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(0)), Rule.UANTEC.IndexOfElement(DomainElement.Of(80))) ), //umjereno blizu DK Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LambdaFunction( Rule.UANTEC.IndexOfElement(DomainElement.Of(35)), Rule.UANTEC.IndexOfElement(DomainElement.Of(65)), Rule.UANTEC.IndexOfElement(DomainElement.Of(135))) //do cca 90 px/s ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), //nebitno S?? //TODO mozda popraviti domenu od S Rule.MakeFuzzyRuleConsequensAcc(StandardFuzzySets.LambdaFunction( Rule.UACC.IndexOfElement(DomainElement.Of(-30)), Rule.UACC.IndexOfElement(DomainElement.Of(-22)), Rule.UACC.IndexOfElement(DomainElement.Of(0))) ) //zavoj ) ); AkcelRules.Add( new Rule( Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.UniversalFunction( 1) ), Rule.MakeFuzzyRuleAntecedent(StandardFuzzySets.LambdaFunction( Rule.UKOR.IndexOfElement(DomainElement.Of(-1)), Rule.UKOR.IndexOfElement(DomainElement.Of(0)), Rule.UKOR.IndexOfElement(DomainElement.Of(1))) ), Rule.MakeFuzzyRuleConsequensAcc(StandardFuzzySets.LambdaFunction( Rule.UACC.IndexOfElement(DomainElement.Of(-30)), Rule.UACC.IndexOfElement(DomainElement.Of(-22)), Rule.UACC.IndexOfElement(DomainElement.Of(0))) ) //rotiraj ) ); }