Skip to content

πŸš€ Integrated differentiable trajectory optimization and economic analysis platform for LEO-Moon missions. Combines PyKEP orbital mechanics with economic modeling for mission planning.

License

Notifications You must be signed in to change notification settings

ethene/lunar-horizon-optimizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

61 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŒ™ Lunar Horizon Optimizer

Python 3.12 Tests Coverage License Code Style Pipeline

PyKEP PyGMO JAX Diffrax SciPy Plotly Kaleido

NumPy Pandas Astropy SpiceyPy

Click Pydantic Pytest Ruff MyPy

No Mocking JAX Compatible Orbital Mechanics Multi Objective

An integrated differentiable trajectory optimization and economic analysis platform for LEO-Moon missions.

πŸš€ Overview

The Lunar Horizon Optimizer is a comprehensive platform that enables real-world lunar mission design and analysis. From basic Earth-Moon transfers to complex economic modeling of lunar resource utilization, this tool supports the full spectrum of space mission engineering challenges.

Core Technologies:

  • High-fidelity orbital mechanics using PyKEP 2.6
  • Global optimization with PyGMO 2.19.6 (NSGA-II)
  • Differentiable programming with JAX 0.5.3 + Diffrax 0.7.0
  • Economic analysis with ISRU modeling and sensitivity analysis
  • Interactive visualization with Plotly 6.1.1+ dashboards and enhanced 3D landing trajectories
  • Static image export with Kaleido 0.2.1+ for PDFs and high-resolution images
  • Extensible plugin architecture for custom components

Applications: Mission architecture trade studies, lunar mining business cases, real-time trajectory optimization, constellation design, investment analysis, and policy planning.

πŸ“ˆ Project Status

Tasks Completed: 10/10

πŸŽ‰ Project is FEATURE-COMPLETE! All core tasks have been successfully implemented.

πŸ§ͺ Test Status

  • Production Tests: 243/243 passing (100% success rate)
  • Core Modules: 161/161 tests passing across 11 key modules
  • CLI Tests: All 10 scenarios tested and working
  • No Mocking Policy: 100% real implementations (PyKEP, PyGMO, JAX)
  • Pipeline Status: Clean with only 2 acceptable complexity warnings

✨ Key Features

  • πŸ”„ Differentiable Optimization: JAX-based gradient optimization
  • πŸ’° Economic Analysis: NPV, IRR, ROI calculations with ISRU benefits
  • ⚑ Global Optimization: Multi-objective optimization with Pareto front analysis
  • πŸ“ˆ Interactive Visualization: Enhanced 3D landing trajectories with rocket exhaust visualization
  • πŸ“Š Cost Modeling: Wright's law learning curves and environmental costs
  • πŸ›Έ Trajectory Generation: Lambert solvers, N-body integration, transfer window analysis, powered descent modeling
  • 🎯 3D Landing Visualization: Advanced powered descent visualization with optimized camera positioning

πŸ†• Recent Updates

Powered Descent & Test Suite Excellence (Latest)

  • βœ… Powered Descent Module: JAX/Diffrax-based lunar landing trajectory modeling
  • βœ… Continuous Thrust: Moon-centered inertial frame with optimal braking control
  • βœ… Gradient-Compatible: Full JAX integration for differentiable optimization
  • βœ… 100% Test Success: 243/243 production tests passing with real implementations
  • βœ… No Mocking Policy: All tests use real PyKEP/PyGMO/JAX/Diffrax implementations
  • βœ… Modern CLI Complete: Comprehensive Click-based interface with rich progress tracking
  • βœ… Production Ready: Clean pipeline with comprehensive error handling

Core Implementation Complete

  • βœ… Differentiable Optimization: JAX-based gradient optimization with real calculations
  • βœ… Economic Analysis: NPV, IRR, ROI with ISRU modeling and sensitivity analysis
  • βœ… Global Optimization: Multi-objective PyGMO NSGA-II with Pareto front analysis
  • βœ… Wright's Law Integration: Launch cost learning curves and environmental costs
  • βœ… Interactive Visualization: 3D trajectory plots and economic dashboards
  • βœ… Extensible Architecture: Plugin system for custom components and extensions

πŸ—οΈ Project Structure

Codebase Scale: 150 Python files, 326 classes, 340 functions

πŸ“ Lunar Horizon Optimizer/
β”œβ”€β”€ πŸ“ src/                    # Source code (main implementation)
β”‚   β”œβ”€β”€ config/                # Mission configuration management
β”‚   β”œβ”€β”€ trajectory/            # Orbital mechanics & PyKEP integration
β”‚   β”œβ”€β”€ optimization/          # PyGMO global optimization & JAX differentiable
β”‚   β”œβ”€β”€ economics/             # Economic analysis & ISRU modeling
β”‚   β”œβ”€β”€ visualization/         # Interactive dashboards & plotting
β”‚   β”œβ”€β”€ extensibility/         # Plugin system & extension framework
β”‚   └── utils/                 # Utility functions & performance optimizations
β”œβ”€β”€ πŸ“ docs/                   # Complete documentation suite
β”‚   β”œβ”€β”€ USER_GUIDE.md         # Getting started guide
β”‚   β”œβ”€β”€ INDEX.md              # Documentation index
β”‚   β”œβ”€β”€ PROJECT_STATUS.md     # Implementation status
β”‚   └── archive/              # Historical documentation
β”œβ”€β”€ πŸ“ tests/                  # Comprehensive test suite (415 tests)
β”œβ”€β”€ πŸ“ scenarios/              # Mission configuration examples
β”œβ”€β”€ πŸ“ examples/               # Usage examples and demos
β”œβ”€β”€ πŸ“ scripts/                # Development and utility scripts
β”‚   └── utilities/            # Maintenance scripts
β”œβ”€β”€ πŸ“ results/                # Analysis outputs (gitignored)
└── πŸ“ archive/                # Historical project files

πŸš€ Quick Start

Prerequisites

# Create conda environment
conda create -n py312 python=3.12 -y
conda activate py312

# Install dependencies
conda install -c conda-forge pykep pygmo astropy spiceypy -y
pip install -r requirements.txt

Modern CLI Usage (Recommended)

# Make CLI executable
chmod +x lunar_opt.py

# Validate environment
./lunar_opt.py validate

# List available scenarios
./lunar_opt.py run list

# Run basic lunar cargo mission
./lunar_opt.py run scenario 01_basic_transfer

# Run comprehensive ISRU economics analysis
./lunar_opt.py run scenario 06_isru_economics --risk --export-pdf

# Run powered descent with 3D visualization
./lunar_opt.py run scenario 13_powered_descent_quick --include-descent --3d-viz

# Get detailed help
./lunar_opt.py --help
./lunar_opt.py run scenario --help

Legacy Usage

# Run production test suite
make test

# Run optimization with learning curves
python src/cli.py analyze --config examples/config_after_upgrade.json \
  --learning-rate 0.88 --carbon-price 75.0

# Run cost comparison demo
python examples/cost_comparison_demo.py

⚑ Quick Start - Reproduce the Analysis

Option 1: Use the Examples Script

# Quick 30-second test
python run_analysis_examples.py quick

# Production 3-4 minute analysis  
python run_analysis_examples.py production

# See all options
python run_analysis_examples.py

Option 2: Manual Commands

# Environment setup
conda activate py312

# Quick test (30 seconds)
python src/cli.py analyze --config scenarios/01_basic_transfer.json \
  --output quick_test --population-size 8 --generations 5 --no-sensitivity

# Production analysis (3-4 minutes) 
python src/cli.py analyze --config scenarios/01_basic_transfer.json \
  --output production_test --population-size 52 --generations 30

# Expected results: Delta-V ~22,446 m/s, NPV ~$374M

πŸ“š Documentation

πŸš€ CLI Documentation (NEW)

πŸš€ Getting Started

πŸ“– Technical Reference

πŸ“‹ Implementation Status

πŸ› οΈ Development

Available Commands

make help          # Show all available commands
make pipeline      # Run complete development pipeline
make test          # Run production test suite (243 tests, 100% pass rate)
make coverage      # Generate coverage report
make lint          # Run code quality checks

Code Quality Standards

  • βœ… NO MOCKING RULE: All tests use real PyKEP, PyGMO, JAX implementations
  • βœ… 100% Test Pass Rate: 243/243 production tests passing (415 total tests)
  • βœ… Clean Pipeline: 0 linting errors, formatted code
  • βœ… Type Safety: Comprehensive type hints and MyPy validation

🀝 Contributing

  1. Follow the development guide
  2. Review documentation index for project overview
  3. Ensure all tests pass with make test
  4. Run quality checks with make pipeline
  5. Commit with descriptive messages

πŸ“ Documentation Index

See docs/INDEX.md for complete documentation navigation including:

  • User guides and getting started
  • API reference and technical documentation
  • Task implementation details
  • Testing guidelines and status

πŸ“„ License

This project is part of the Lunar Horizon Optimizer development.


Last updated: 2025-07-13

About

πŸš€ Integrated differentiable trajectory optimization and economic analysis platform for LEO-Moon missions. Combines PyKEP orbital mechanics with economic modeling for mission planning.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages