A lightweight library for fuzzy arithmetic.
The MIT License (MIT)
The easiest way to create a fuzzy number is to use a FuzzyNumberFactory
service. The constructor takes two optional arguments. The first one is a number of aplha-cuts, which the fuzzy numbers are made of. The second one is an epsilon to deal with floating points rounding errors.
var factory = new FuzzyNumberFactory(6);
FuzzyNumber A = factory.createTriangular(2, 3, 5, 7);
FuzzyNumber B = factory.createTrapezoidal(5, 8, 9);
FuzzyNumber C = factory.createCrisp(7);
Operators +-*/
are overloaded, so you can use the fuzzy numbers created above as if they were double
s.
FuzzyNumber D = 2 * C - (2.5 + A / B);