Metadata-Version: 2.4
Name: ddmtolab
Version: 1.0.5
Summary: Data-Driven Multitask Optimization Laboratory
Author-email: Jiangtao Shen <j.shen5@exeter.ac.uk>
License: MIT
Project-URL: Homepage, https://github.com/JiangtaoShen/DDMTOLab
Project-URL: Documentation, https://jiangtaoshen.github.io/DDMTOLab/
Project-URL: Bug Tracker, https://github.com/JiangtaoShen/DDMTOLab/issues
Keywords: optimization,multitask-optimization,evolutionary-algorithm,surrogate-model,bayesian-optimization,machine-learning
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=2.0.1
Requires-Dist: scipy>=1.15.3
Requires-Dist: pandas>=2.3.3
Requires-Dist: matplotlib>=3.10.6
Requires-Dist: scikit-learn>=1.7.2
Requires-Dist: tqdm>=4.67.1
Requires-Dist: openpyxl>=3.1.5
Requires-Dist: seaborn>=0.13.2
Requires-Dist: pyyaml>=6.0.2
Requires-Dist: bottleneck>=1.4.2
Requires-Dist: torch>=2.5.1
Requires-Dist: botorch>=0.16.0
Requires-Dist: gpytorch>=1.14.2
Requires-Dist: pyro-ppl>=1.9.1
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: sphinx>=7.4.7; extra == "dev"
Requires-Dist: sphinx-rtd-theme>=3.0.2; extra == "dev"
Requires-Dist: sphinx-autodoc-typehints>=2.3.0; extra == "dev"
Requires-Dist: myst-parser>=3.0.1; extra == "dev"
Provides-Extra: all
Requires-Dist: ddmtolab[dev]; extra == "all"
Dynamic: license-file

# Data-Driven Multitask Optimization Laboratory

<p align="center">
  <img src="docs/source/_static/logo.svg" alt="DDMTOLab Logo" width="530">
</p>

<p align="center">
  <a href="https://jiangtaoshen.github.io/DDMTOLab/">
    <img src="https://img.shields.io/badge/docs-latest-blue.svg" alt="Documentation">
  </a>
  <a href="https://pypi.org/project/ddmtolab/">
    <img src="https://img.shields.io/pypi/v/ddmtolab.svg" alt="PyPI version">
  </a>
  <a href="https://pypi.org/project/ddmtolab/">
    <img src="https://img.shields.io/pypi/dm/ddmtolab.svg" alt="Downloads">
  </a>
  <a href="https://github.com/JiangtaoShen/DDMTOLab/stargazers">
    <img src="https://img.shields.io/github/stars/JiangtaoShen/DDMTOLab?style=social" alt="GitHub Stars">
  </a>
  <a href="https://www.python.org/downloads/">
    <img src="https://img.shields.io/badge/Python-3.10+-blue.svg" alt="Python Version">
  </a>
  <a href="https://github.com/JiangtaoShen/DDMTOLab/blob/main/LICENSE">
    <img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License">
  </a>
</p>

---

## 📖 Overview

**DDMTOLab (Data-Driven Multitask Optimization Laboratory)** is a comprehensive Python platform for optimization research, featuring **60+ algorithms**, **180+ benchmark problems**, and powerful experiment tools for problem definition, algorithm development, and performance evaluation.

Whether you're working on expensive black-box optimization, multiobjective optimization, or complex multitask scenarios, DDMTOLab provides a flexible and extensible framework to accelerate your **research** and support real-world **applications**.

## ✨ Features

- 🚀 **Comprehensive Algorithms** - 60+ algorithms for expensive/inexpensive, single/multitask, single/multiobjective, unconstrained/constrained optimization
- 📊 **Rich Problem Suite** - 180+ benchmark problems and real-world applications
- 🤖 **Data-Driven Optimization** - Surrogate modelling for expensive optimization
- 🔧 **Flexible Framework** - Simple API and intuitive workflow for rapid prototyping
- 🔌 **Fully Extensible** - Easy to add custom algorithms and problems
- ⚡ **Parallel Computing** - Multi-core support for batch experiments
- 📈 **Powerful Analysis Tools** - Built-in visualization and statistical analysis
- 📝 **Complete Documentation** - Comprehensive [documentation](https://jiangtaoshen.github.io/DDMTOLab/) and API reference

## 🚀 Quick Start

### Installation

```bash
pip install ddmtolab
```

**Requirements:**
- Python 3.10+
- PyTorch 2.5+ (supports CPU, GPU optional for acceleration)
- NumPy 2.0+, SciPy 1.15+, scikit-learn 1.7+
- Matplotlib 3.10+, Pandas 2.3+

For detailed installation instructions, see [Installation Guide](https://jiangtaoshen.github.io/DDMTOLab/installation.html).

### Basic Usage

```python
import numpy as np
from ddmtolab.Methods.mtop import MTOP
from ddmtolab.Algorithms.MTSO.MTBO import MTBO

# Step 1: Define objective function
def forrester(x):
    """Forrester function: (6x-2)^2 * sin(12x-4)"""
    return (6 * x - 2) ** 2 * np.sin(12 * x - 4)

# Step 2: Create optimization problem
problem = MTOP()
problem.add_task(forrester, dim=1)

# Step 3: Run optimization
results = MTBO(problem).optimize()

# Step 4: Display results
print(f"Best solution: {results.best_decs}")
print(f"Best objective: {results.best_objs}")

# Step 5: Analyze and visualize
from ddmtolab.Methods.test_data_analysis import TestDataAnalyzer
TestDataAnalyzer().run()
```

### Batch Experiment

```python
from ddmtolab.Methods.batch_experiment import BatchExperiment
from ddmtolab.Methods.data_analysis import DataAnalyzer
from ddmtolab.Algorithms.STSO.BO import BO
from ddmtolab.Algorithms.MTSO.MTBO import MTBO
from ddmtolab.Problems.MTSO.cec17_mtso_10d import CEC17MTSO_10D

if __name__ == '__main__':
    # Step 1: Create batch experiment manager
    batch_exp = BatchExperiment(
        base_path='./Data',      # Data save path
        clear_folder=True        # Clear existing data
    )

    # Step 2: Add test problems
    prob = CEC17MTSO_10D()
    batch_exp.add_problem(prob.P1, 'P1')
    batch_exp.add_problem(prob.P2, 'P2')

    # Step 3: Add algorithms with parameters
    batch_exp.add_algorithm(BO, 'BO', n_initial=20, max_nfes=100)
    batch_exp.add_algorithm(MTBO, 'MTBO', n_initial=20, max_nfes=100)

    # Step 4: Run batch experiments
    batch_exp.run(n_runs=20, verbose=True, max_workers=8)

    # Step 5: Run data analysis
    analyzer = DataAnalyzer()
    results = analyzer.run()
```

### Optimization Process Visualization

DDMTOLab provides built-in animation tools to visualize the optimization process:

```python
from ddmtolab.Problems.MTSO.cec17_mtso_10d import CEC17MTSO_10D
from ddmtolab.Algorithms.STSO.BO import BO
from ddmtolab.Algorithms.MTSO.MTBO import MTBO
from ddmtolab.Methods.animation_generator import create_optimization_animation

# Define problem
problem = CEC17MTSO_10D().P1()

# Run algorithms
BO(problem, n_initial=20, max_nfes=100, name='BO').optimize()
MTBO(problem, n_initial=20, max_nfes=100, name='MTBO').optimize()

# Generate animation
animation = create_optimization_animation(max_nfes=100, merge=2, title='BO vs MTBO')
```

<p align="center">
  <img src="docs/source/_static/animation.gif"
       alt="BO and MTBO on CEC17-MTSO-10D-P1 Animation"
       width="100%">
</p>

## 🎯 Key Components

### Algorithms (60+)

| Category | Description                  | Algorithms |
|----------|------------------------------|------------|
| **STSO** | Single-task single-objective | GA, DE, PSO, SL_PSO, KL_PSO, CSO, CMA_ES, IPOP_CMA_ES, sep_CMA_ES, MA_ES, xNES, OpenAI_ES, AO, GWO, EO, BO, EEI_BO, ESAO, SHPSO, SA_COSO, TLRBF, GL_SADE |
| **STMO** | Single-task multiobjective   | NSGA_II, NSGA_III, NSGA_II_SDR, SPEA2, MOEA_D, MOEA_DD, MOEA_D_FRRMAB, MOEA_D_STM, RVEA, IBEA, TwoArch2, MSEA, C_TAEA, CCMO, MCEA_D, CPS_MOEA, ParEGO, K_RVEA, DSAEA_PS, KTA2, REMO |
| **MTSO** | Multitask single-objective   | MFEA, MFEA_II, EMEA, EBS, G_MFEA, MTEA_AD, MKTDE, MTEA_SaO, SREMTO, LCB_EMT, MTBO, RAMTEA, SELF, EEI_BO_plus, MUMBO, BO_LCB_CKT, BO_LCB_BCKT |
| **MTMO** | Multitask multiobjective     | MO_MFEA, MO_MFEA_II, MO_EMEA, MO_MTEA_SaO, MTDE_MKTA, MTEA_D_DN, EMT_ET, EMT_PD, ParEGO_KT |

### Problems (180+)

| Category | Problem Suites |
|----------|----------------|
| **STSO** | CLASSICALSO (8 functions), CEC10_CSO (20 functions) |
| **STMO** | ZDT (6), DTLZ (9), WFG (9), UF (10), CF (10), MW (14) |
| **MTSO** | CEC17_MTSO (9), CEC17_MTSO_10D (9), CEC19_MaTSO (many-task), CMT (9), STOP (12) |
| **MTMO** | CEC17_MTMO (9), CEC19_MTMO (10), CEC19_MaTMO (many-task), CEC21_MTMO (10), MTMO_DTLZ |
| **Real-World** | PEPVM, PINN_HPO (12), SOPM, SCP, MO_SCP, PKACP |

### Methods

- **MTOP Class**: Flexible problem definition supporting single/multitask and single/multiobjective
- **Batch Experiments**: Parallel execution framework for large-scale experiments
- **Data Analysis**: Statistical analysis (mean, std, ranking) and visualization tools
- **Performance Metrics**: IGD, GD, IGD+, HV, DeltaP, Spacing, Spread, FR, CV
- **Animation Generator**: Optimization process visualization
- **Algorithm Utilities**: Reusable components (initialization, selection, operators)

## 📚 Documentation

- [Installation Guide](https://jiangtaoshen.github.io/DDMTOLab/installation.html)
- [Algorithms Reference](https://jiangtaoshen.github.io/DDMTOLab/algorithms.html)
- [Problems Reference](https://jiangtaoshen.github.io/DDMTOLab/problems.html)
- [Methods Guide](https://jiangtaoshen.github.io/DDMTOLab/methods.html)
- [Demo Scripts](https://jiangtaoshen.github.io/DDMTOLab/demos.html)
- [API Reference](https://jiangtaoshen.github.io/DDMTOLab/api.html)

## 📄 Citation

If you use DDMTOLab in your research, please cite:

```bibtex
@software{ddmtolab2025,
  author = {Jiangtao Shen},
  title = {DDMTOLab: A Python Platform for Data-Driven Multitask Optimization},
  year = {2025},
  url = {https://github.com/JiangtaoShen/DDMTOLab}
}
```

## 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

## 📧 Contact

- **Author**: Jiangtao Shen
- **Email**: j.shen5@exeter.ac.uk
- **Documentation**: [https://jiangtaoshen.github.io/DDMTOLab/](https://jiangtaoshen.github.io/DDMTOLab/)
- **Issues**: [GitHub Issues](https://github.com/JiangtaoShen/DDMTOLab/issues)

## 📜 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

<p align="center">
  Made with ❤️ by <a href="https://github.com/JiangtaoShen">Jiangtao Shen</a>
</p>
