fugue_evo/interactive/mod.rs
1//! Interactive Genetic Algorithm (IGA) module
2//!
3//! This module provides support for human-in-the-loop evolutionary optimization,
4//! where fitness is derived from user preferences rather than an automated function.
5//!
6//! # Overview
7//!
8//! Interactive GAs are useful when:
9//! - The fitness function cannot be easily formalized
10//! - Human aesthetic judgment is needed (art, design, music generation)
11//! - User preferences are subjective and vary per individual
12//!
13//! # Evaluation Modes
14//!
15//! The module supports three interaction paradigms:
16//!
17//! - **Rating**: Users assign numeric scores to individual candidates
18//! - **Pairwise Comparison**: Users pick the better of two candidates
19//! - **Batch Selection**: Users select their favorites from a presented batch
20//!
21//! # Example
22//!
23//! ```rust,ignore
24//! use fugue_evo::interactive::prelude::*;
25//! use fugue_evo::prelude::*;
26//!
27//! let mut iga = InteractiveGABuilder::<RealVector>::new()
28//! .population_size(12)
29//! .evaluation_mode(EvaluationMode::BatchSelection)
30//! .batch_size(6)
31//! .bounds(bounds)
32//! .selection(TournamentSelection::new(2))
33//! .crossover(SbxCrossover::new(15.0))
34//! .mutation(PolynomialMutation::new(20.0))
35//! .build()?;
36//!
37//! loop {
38//! match iga.step(&mut rng) {
39//! StepResult::NeedsEvaluation(request) => {
40//! let response = present_to_user(&request);
41//! iga.provide_response(response);
42//! }
43//! StepResult::GenerationComplete { generation, .. } => {
44//! println!("Generation {} complete", generation);
45//! }
46//! StepResult::Complete(result) => break,
47//! }
48//! }
49//! ```
50
51pub mod aggregation;
52pub mod algorithm;
53pub mod bradley_terry;
54pub mod evaluator;
55pub mod selection_strategy;
56pub mod session;
57pub mod traits;
58pub mod uncertainty;
59
60/// Prelude for convenient imports
61pub mod prelude {
62 pub use super::aggregation::{AggregationModel, CandidateStats, FitnessAggregator};
63 pub use super::algorithm::{
64 InteractiveGA, InteractiveGABuilder, InteractiveGAConfig, InteractiveResult, StepResult,
65 };
66 pub use super::bradley_terry::{BradleyTerryModel, BradleyTerryOptimizer, BradleyTerryResult};
67 pub use super::evaluator::{
68 Candidate, CandidateId, EvaluationRequest, EvaluationResponse, RatingScale,
69 };
70 pub use super::selection_strategy::SelectionStrategy;
71 pub use super::session::{CoverageStats, InteractiveSession};
72 pub use super::traits::{EvaluationMode, InteractiveFitness};
73 pub use super::uncertainty::FitnessEstimate;
74}