gemla/
lib.rs

1//! # Gemla
2//!
3//! **Gemla** is a Rust library for simulating and evolving populations using genetic algorithms. It provides a flexible framework for evolutionary computation, supporting custom node types, tournament bracket simulations, and persistent state management.
4//!
5//! ## Features
6//! - Tournament-style genetic algorithm simulation evaluating populations via nodes
7//! - Asynchronous and concurrent simulation using Tokio
8//! - Customizable node logic via the [`GeneticNode`] trait
9//! - Persistent, file-backed simulation state with the `file_linked` crate
10//! - Utilities for binary tree management
11//!
12//! ## Modules
13//! - [`tree`]: Defines an unbalanced binary tree structure and macros for tree construction.
14//! - [`core`]: Contains the main simulation logic, including the [`Gemla`] struct, configuration, and node management.
15//! - [`error`]: Provides unified error types and logging utilities for the crate.
16//!
17//! ## Example
18//! ```rust,ignore
19//! # use gemla::core::{Gemla, GemlaConfig};
20//! # use gemla::core::genetic_node::{GeneticNode, GeneticNodeContext};
21//! # use file_linked::constants::data_format::DataFormat;
22//! # use std::path::PathBuf;
23//!
24//! #[derive(Clone, Debug)]
25//! struct MyNode { /* ... */ }
26//! // Implement GeneticNode for MyNode...
27//!
28//! #[tokio::main]
29//! async fn main() {
30//!     let mut gemla = Gemla::<MyNode>::new(
31//!         &PathBuf::from("state.json"),
32//!         GemlaConfig { overwrite: true },
33//!         DataFormat::Json,
34//!     ).await.unwrap();
35//!     // Grows simulation tree by 5 levels
36//!     gemla.simulate(5).await.unwrap();
37//! }
38//! ```
39//!
40//! ## Crate Organization
41//! - All core simulation logic is in [`core`].
42//! - Tree structures and macros are in [`tree`].
43//! - Error types and helpers are in [`error`].
44//!
45//! ## Getting Started
46//! 1. Define your node type and implement the [`GeneticNode`] trait.
47//! 2. Create a [`Gemla`] instance and run simulations.
48//! 3. Use the provided error handling and tree utilities as needed.
49//!
50//! [`Gemla`]: crate::core::Gemla
51//! [`GeneticNode`]: crate::core::genetic_node::GeneticNode
52//! [`tree`]: crate::tree
53//! [`core`]: crate::core
54//! [`error`]: crate::error
55
56#![warn(missing_docs)]
57
58#[macro_use]
59pub mod tree;
60pub mod core;
61pub mod error;