feat: add WebAssembly support and fugue-evo-wasm bindings crate - #4
Merged
alexnodeland merged 11 commits intoDec 13, 2025
Merged
Conversation
alexnodeland
commented
Dec 13, 2025
Owner
- Add cargo feature flags: std, parallel, checkpoint (default all enabled)
- Feature-gate parallel/rayon functionality for WASM compatibility
- Make CheckpointError WASM-compatible with cfg-gated variants
- Add non-parallel impl blocks to SimpleGA for WASM target
- Feature-gate island model (requires parallel feature)
- Feature-gate checkpoint file I/O (requires checkpoint feature)
- Add to_json/from_json methods to InteractiveSession for WASM
- Create fugue-evo-wasm crate with JavaScript-friendly wrappers
- Add RealVectorOptimizer for browser-based optimization
- Support built-in fitness functions (Sphere, Rastrigin, Rosenbrock)
- Generate TypeScript definitions via wasm-pack build
- Add cargo feature flags: std, parallel, checkpoint (default all enabled) - Feature-gate parallel/rayon functionality for WASM compatibility - Make CheckpointError WASM-compatible with cfg-gated variants - Add non-parallel impl blocks to SimpleGA for WASM target - Feature-gate island model (requires parallel feature) - Feature-gate checkpoint file I/O (requires checkpoint feature) - Add to_json/from_json methods to InteractiveSession for WASM - Create fugue-evo-wasm crate with JavaScript-friendly wrappers - Add RealVectorOptimizer for browser-based optimization - Support built-in fitness functions (Sphere, Rastrigin, Rosenbrock) - Generate TypeScript definitions via wasm-pack build
- Add BitStringOptimizer for binary optimization with custom JS fitness - Add PermutationOptimizer for ordering problems (TSP, scheduling) - Add Nsga2Optimizer for multi-objective optimization with Pareto fronts - Add custom JS fitness function support to RealVectorOptimizer - Feature-gate Send+Sync trait bounds for WASM compatibility: - Fitness trait in fitness/traits.rs - CmaEsFitness trait in algorithms/cmaes.rs - MultiObjectiveFitness trait in algorithms/nsga2.rs - EvolutionStrategy build/run methods in algorithms/evolution_strategy.rs - Add new result types: BitStringResult, PermutationResult, MultiObjectiveResult - All optimizers support custom fitness functions via JS callbacks
- Add impl_optimizer_config! macro for shared optimizer config methods - Add impl_result_common! macro for shared result type methods - Replace separate fitness evaluators with GenericFitness<G, F> - Feature-gate file I/O in checkpoint/recovery.rs for WASM compatibility - Reduce WASM bindings code by ~200 lines while maintaining functionality
Add comprehensive WASM bindings for browser-based optimization: - InteractiveOptimizer: Human-in-the-loop optimization with Rating, Pairwise comparison, and BatchSelection evaluation modes - EvolutionStrategyOptimizer: (μ+λ)-ES and (μ,λ)-ES variants - SymbolicRegressionOptimizer: Tree-based genetic programming for evolving mathematical expressions The interactive evolution is particularly suited for browser use where users can provide subjective fitness evaluations in real-time. Note: SteadyStateGA not included due to Sync requirement incompatible with JS functions in WASM.
Add withExtendedConfig() for full control over interactive GA parameters: - elitism_count: preserve elite individuals - min_coverage: required evaluation coverage before next generation - crossover/mutation probability: control operator rates - custom bounds: specify search space per dimension
Add comprehensive README with API documentation and usage examples for npm package consumers. Include browser example HTML demo showing real vector optimization, CMA-ES, NSGA-II, and interactive evolution.
- Add WASM build job to CI workflow with wasm-pack build and test - Add comprehensive wasm-bindgen-test suite covering all optimizers - Add Node.js example demonstrating all optimizer types - Fix clippy warnings in interactive.rs and fitness.rs
- Add 6 new fitness functions: Ackley, Griewank, Schwefel, Levy, Dixon-Price, Styblinski-Tang - Add UMDA optimizer (Estimation of Distribution Algorithm) - Add ZDT1/ZDT2/ZDT3 multi-objective test problems for NSGA-II - Add LeadingOnes and Royal Road fitness functions for BitString - Add getFitnessInfo API for runtime fitness function metadata - Update browser example with new algorithms and fitness functions - Add comprehensive tests for all new functionality
- Enable wasm-opt with -Os flag for ~20-30% smaller bundle sizes - Add LTO and reference types for better performance - Create worker.js web worker script for non-blocking optimization - Create worker_example.html demo with UI responsiveness testing - Update README with web worker usage and bundle size documentation
alexnodeland
deleted the
claude/plan-wasm-packaging-01Y9i4UHPs7y3YSMrjK5ZJCD
branch
December 17, 2025 19:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.