|
| 1 | +# rust-fuzzylogic |
| 2 | + |
| 3 | +A work-in-progress Rust crate that provides building blocks for authoring fuzzy inference systems. |
| 4 | +The project aims to make it easy to describe linguistic variables, membership functions, and rule |
| 5 | +bases while keeping room for experimentation with multiple aggregation operators and inference |
| 6 | +strategies. |
| 7 | + |
| 8 | +## Project status |
| 9 | + |
| 10 | +The repository currently focuses on laying down the module structure of the crate. Several source |
| 11 | +files exist as stubs and will be fleshed out in future iterations. Even though the public API is not |
| 12 | +ready for consumption yet, the layout already highlights the intended responsibilities of each |
| 13 | +module: |
| 14 | + |
| 15 | +- `membership`: utilities for defining membership functions (triangular, trapezoidal, gaussian, …). |
| 16 | +- `variable`: strongly-typed linguistic variables composed of terms and membership functions. |
| 17 | +- `term`: basic linguistic terms that bind membership functions to human-readable labels. |
| 18 | +- `rulespace`: abstractions for authoring rule bases and connecting antecedents to consequents. |
| 19 | +- `antecedent`: helpers to compose fuzzy predicates out of linguistic terms. |
| 20 | +- `aggregate`: algorithms to combine the contribution of multiple rules. |
| 21 | +- `defuzz`: defuzzification routines that convert fuzzy outputs into crisp values. |
| 22 | +- `mamdani`: reference implementation of a Mamdani-style inference engine. |
| 23 | +- `ops`: configurable T-norm/T-conorm operators (minimum, product, Łukasiewicz, …). |
| 24 | +- `sampler`: sampling utilities for visualisation or numerical integration tasks. |
| 25 | +- `builder`: high-level ergonomics for constructing complete systems. |
| 26 | +- `error`: error types returned by the crate. |
| 27 | +- `prelude`: convenient re-exports for end users. |
| 28 | + |
| 29 | +## Getting started |
| 30 | + |
| 31 | +Because the implementation is still under construction the crate is not published on crates.io. |
| 32 | +Once the API stabilises you will be able to add it as a Git dependency in your `Cargo.toml`: |
| 33 | + |
| 34 | +```toml |
| 35 | +[dependencies] |
| 36 | +rust-fuzzylogic = { git = "https://github.com/your-org/rust-fuzzylogic" } |
| 37 | +``` |
| 38 | + |
| 39 | +After the crate reaches its first release the dependency line will become: |
| 40 | + |
| 41 | +```toml |
| 42 | +[dependencies] |
| 43 | +rust-fuzzylogic = "0.1" |
| 44 | +``` |
| 45 | + |
| 46 | +## Development |
| 47 | + |
| 48 | +If you would like to contribute, clone the repository and open it with your favourite editor: |
| 49 | + |
| 50 | +```bash |
| 51 | +git clone https://github.com/your-org/rust-fuzzylogic.git |
| 52 | +cd rust-fuzzylogic |
| 53 | +``` |
| 54 | + |
| 55 | +The crate targets Rust 1.76+ (edition 2024). Standard Cargo commands apply: |
| 56 | + |
| 57 | +- `cargo check` — make sure the crate compiles. |
| 58 | +- `cargo fmt` — format the codebase. |
| 59 | +- `cargo test` — run the test suite (currently empty). |
| 60 | + |
| 61 | +### Feature flags |
| 62 | + |
| 63 | +The crate is organised around a set of feature flags to enable or disable components at compile |
| 64 | +time: |
| 65 | + |
| 66 | +- `f32` / `f64` — choose the floating-point precision used throughout the inference engine. |
| 67 | +- `serde` — derive serialisation support for configuration data structures. |
| 68 | +- `parallel` — enable rayon-powered parallel execution for suitable workloads. |
| 69 | +- `ops-minmax`, `ops-product`, `ops-lukasiewicz` — opt into specific operator families. |
| 70 | +- `ops-dyn` — use dynamic dispatch for selecting operators at runtime. |
| 71 | +- `inference-mamdani` — compile the Mamdani inference engine implementation. |
| 72 | + |
| 73 | +## Examples |
| 74 | + |
| 75 | +Example binaries will live under the `examples/` directory. They are not yet implemented, but the |
| 76 | +plan is to showcase tasks such as temperature control, batch processing, fuzzy C-means clustering, |
| 77 | +and gradient-descent tuning of membership functions. You will be able to run them with Cargo once |
| 78 | +they are published: |
| 79 | + |
| 80 | +```bash |
| 81 | +cargo run --example temperature |
| 82 | +``` |
| 83 | + |
| 84 | +## Roadmap |
| 85 | + |
| 86 | +- [ ] Flesh out membership functions and sampling utilities. |
| 87 | +- [ ] Implement the Mamdani inference pipeline end-to-end. |
| 88 | +- [ ] Document the builder APIs and provide a quick start guide. |
| 89 | +- [ ] Publish the crate and examples for real-world testing. |
| 90 | + |
| 91 | +--- |
| 92 | + |
| 93 | +This README will evolve alongside the code. Contributions, bug reports, and ideas are warmly |
| 94 | +welcome! |
0 commit comments