{"id":22831016,"url":"https://github.com/olivervea/fluentfuzzy","last_synced_at":"2026-02-06T05:32:31.974Z","repository":{"id":192658332,"uuid":"679834041","full_name":"OliverVea/FluentFuzzy","owner":"OliverVea","description":"FluentFuzzy is a package for doing fuzzy logic in .NET with a natural fluent syntax.","archived":false,"fork":false,"pushed_at":"2024-12-09T06:34:37.000Z","size":366,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-06T19:05:32.492Z","etag":null,"topics":["fuzzy-logic","nuget","unity","winforms"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OliverVea.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-17T18:15:18.000Z","updated_at":"2024-08-22T05:39:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"6fb594a5-1d15-48bf-9d9f-17d57c1a1b7c","html_url":"https://github.com/OliverVea/FluentFuzzy","commit_stats":null,"previous_names":["olivervea/fluentfuzzy"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/OliverVea/FluentFuzzy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OliverVea%2FFluentFuzzy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OliverVea%2FFluentFuzzy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OliverVea%2FFluentFuzzy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OliverVea%2FFluentFuzzy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OliverVea","download_url":"https://codeload.github.com/OliverVea/FluentFuzzy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OliverVea%2FFluentFuzzy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29152426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T02:39:25.012Z","status":"ssl_error","status_checked_at":"2026-02-06T02:37:22.784Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fuzzy-logic","nuget","unity","winforms"],"created_at":"2024-12-12T20:16:26.669Z","updated_at":"2026-02-06T05:32:31.944Z","avatar_url":"https://github.com/OliverVea.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FluentFuzzy\n\nFluentFuzzy is a package for doing fuzzy logic in .NET with a natural fluent syntax.\n\n\u003e FluentFuzzy is very much WIP and should be expected to be updated with breaking changes.\n\n## Contents\n\n`FluentFuzzy` contains the core fuzzy logic functionality.\n\n`FluentFuzzy.Visualization` has visualization for some `FluentFuzzy` classes.\n\n## Using\n\nAfter importing the Nuget package, using FluentFuzzy is a 2-step process.\n\n### Setting up input and output\n\n`FuzzyInput`s and `FuzzyOutput`s can be set up in the following manner:\n\n```cs\n// test/FluentFuzzy.Test/Example.cs#L10-L12\n\nconst int healthValue = 35;\nvar health = new FuzzyInput(() =\u003e healthValue);\nvar flee = new FuzzyOutput();\n```\n\n`FuzzyInput` requires a `Func\u003cdouble\u003e` to get the current crisp value of the input.\n\n### Setting up member functions\n\nThe next step is adding member functions to each input:\n\n```cs\n// test/FluentFuzzy.Test/Example.cs#L14-L20\n\nconst int low = 0;\nconst int medium = 1;\nconst int high = 2;\n\nhealth.Set(low, new Trapezoid(0, 0, 25, 50));\nhealth.Set(medium, new Triangle(25, 50, 75));\nhealth.Set(high, new Trapezoid(50, 75, 100, 100));\n```\n\nCurrently, the following membership functions have been implemented:\n\n* `Triangle` defines a triangle.\n* `Trapezoid` defines a trapezoid.\n* `Line` defines a line.\n* `Value` defines a single value.\n* `AtLeast` defines a threshold value.\n\nCustom membership functions can be created by implementing the `IMembershipFunction` interface.\n\nAfter the input functions, membership functions can be added to the `FuzzyOutput`\n\n```cs\n// test/FluentFuzzy.Test/Example.cs#L22-L24\n\nflee.Set(low, new Triangle(-0.5, 0, 0.5));\nflee.Set(medium, new Triangle(0, 0.5, 1));\nflee.Set(high, new Triangle(0.5, 1, 1.5));\n```\n\nThe only currently supported defuzzification method is a version of the centroid method. As some of the membership functions, namely `Line`, `Value` and `AtLeast` do not have useful centroids, these cannot be used as output member functions.\n\nCustom output membership functions can be created by implementing the `IHasCentroid` interface.\n\n### Setting up fuzzy rules\n\nAfter setting up the fuzzy inputs and outputs, rules can be created to connect them.\n\nRules are created with a readable fluent syntax:\n\n```cs\n// test/FluentFuzzy.Test/Example.cs#L26-L28\n\nFuzzyRule.If(health.Is(high)).Then(flee.Is(low));\nFuzzyRule.If(health.Is(medium)).Then(flee.Is(medium));\nFuzzyRule.If(health.Is(low)).Then(flee.Is(high));\n```\n\n### Evaluating an output\n\nAfter creating the fuzzy ruleset, the output can be evaluated by calling the `Evaluate` method on the output:\n\n```cs\n// test/FluentFuzzy.Test/Example.cs#L30-L30\n\nConsole.WriteLine($\"flee(health: {health.Value}) = {flee.Evaluate()}\"); // flee(health: 35) = 0,8\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folivervea%2Ffluentfuzzy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folivervea%2Ffluentfuzzy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folivervea%2Ffluentfuzzy/lists"}