public void OrTest() { var x = Fuzzy.Create(0.9); var y = Fuzzy.Create(0.7); var xOrY = x || y; Assert.Equal(x, xOrY); }
public void XorTest() { var x = Fuzzy.Create(0.9); var y = Fuzzy.Create(0.3); var xXorY = x ^ y; Assert.Equal(Fuzzy.Create(0.7), xXorY); }
public void AndTest() { var x = Fuzzy.Create(0.9); var y = Fuzzy.Create(0.7); var xAndY = x && y; Assert.Equal(y, xAndY); }
public void OrTest1() { Func <Context, Fuzzy> first = context => Fuzzy.Create(context.Value); Fuzzy second(Context context) => Fuzzy.Create(context.Value).Not(); var context = new Context() { Value = 0.7 }; var firstFunc = STMNT.Is(first.Or(second)); var secondFunc = STMNT.Is(first).Or(second); var resultFirst = firstFunc(context); var resultSecond = secondFunc(context); Assert.Equal(resultFirst.Value, resultSecond.Value); }
public void CreateTest() { Assert.Equal(0.5, Fuzzy.Create(0.5).Value, MathConstants.Precision); Assert.Equal(0.0, Fuzzy.Create(-1.0).Value, MathConstants.Precision); Assert.Equal(1.0, Fuzzy.Create(2.0).Value, MathConstants.Precision); }
public void CreateMaxTest() { Assert.Equal(0.1, Fuzzy.Create(10, 100).Value, MathConstants.Precision); Assert.Equal(0.0, Fuzzy.Create(-1.0, 100).Value, MathConstants.Precision); Assert.Equal(1.0, Fuzzy.Create(200.0, 100).Value, MathConstants.Precision); }
public static Fuzzy ToFuzzy(this double value) => Fuzzy.Create(value);
public static Fuzzy ToFuzzy(this bool value) => Fuzzy.Create(value);