internal void Evaluate_WithThreeGroupCompoundStatementAndHamacherFunctions_ReturnsExpectedResult() { // Arrange var tnorm = TriangularNormFactory.HamacherProduct(); var tconorm = TriangularConormFactory.HamacherSum(); var evaluator = new FuzzyEvaluator(tnorm, tconorm); var evaluations = new List <Evaluation> { // Statement group 1 new Evaluation(LogicOperators.If(), UnitInterval.Create(0.25)), new Evaluation(LogicOperators.And(), UnitInterval.Create(0.0)), new Evaluation(LogicOperators.And(), UnitInterval.Create(0.2)), // Statement group 2 new Evaluation(LogicOperators.Or(), UnitInterval.Create(1)), new Evaluation(LogicOperators.And(), UnitInterval.Create(0.9)), new Evaluation(LogicOperators.And(), UnitInterval.Create(0.8)), // Statement group 3 new Evaluation(LogicOperators.Or(), UnitInterval.Create(0.5)), new Evaluation(LogicOperators.And(), UnitInterval.Create(1)), new Evaluation(LogicOperators.And(), UnitInterval.Create(1)) }; // Act var result = evaluator.Evaluate(evaluations); // Assert Assert.Equal(0.790322580645162, Math.Round(result.Value, 15)); }
internal void Evaluate_WithVariousValidValues_ReturnsExpectedResult( double membershipA, double membershipB, double expected) { // Arrange var hamacherProduct = TriangularNormFactory.HamacherProduct(); // Act var result = hamacherProduct.Evaluate(UnitInterval.Create(membershipA), UnitInterval.Create(membershipB)); // Assert Assert.Equal(UnitInterval.Create(expected), result); }