"""Budgeted multi-objective optimization for molecular design.

This module provides a framework for comparing optimization methods
(Bayesian Optimization, MoltenFlow) under fixed oracle budgets.

Key components:
- PropertyOracle: Budget-tracked property evaluation
- BudgetedOptimizer: Main optimization loop
- Proposers: BO and MoltenFlow candidate generators
- Diversity utilities for seed selection
- Logging and visualization utilities
"""

from .diversity import (
    compute_diversity_weighted_probs,
    compute_fingerprint,
    compute_max_similarity_to_recent,
    compute_tanimoto_similarity,
    select_with_diversity,
)
from .initialization import (
    InitializedDataset,
    initialize_dataset,
    initialize_near_pareto,
    initialize_random,
)
from .logger import OptimizationLogger, load_experiment_logs, load_optimization_log
from .oracle import OracleResult, PropertyOracle
from .plotting import (
    plot_all_figures,
    plot_example_runs,
    plot_gamma_dual_axis,
    plot_gamma_heatmap,
    plot_gamma_metrics_grid,
    plot_gamma_sweep_curve,
    plot_hpo_contour,
    plot_hpo_history,
    plot_hpo_importance,
    plot_hpo_parallel_coordinate,
    plot_hv_convergence,
    plot_molecule_gallery,
    plot_pareto_comparison,
    plot_pareto_density,
    plot_runtime_comparison,
)
from .proposers import BaseProposer, MoltenFlowProposer, ObservedData, ProposalResult
from .runner import BudgetedOptimizer, OptimizationResult, OptimizationState
from .summary import (
    BootstrapCI,
    MethodSummary,
    aggregate_by_method,
    bootstrap_ci,
    compute_method_summary,
    compute_pairwise_tests,
    format_hpo_table,
    format_summary_table,
    generate_hpo_summary,
    generate_summary_table,
    get_top_n_trials,
    load_runtime_data,
)

# Conditionally import BO proposers
try:
    from .proposers import MOGPProposer, TwoGPProposer, has_botorch
except ImportError:
    TwoGPProposer = None
    MOGPProposer = None

    def has_botorch():
        return False


__all__ = [
    # Oracle
    "PropertyOracle",
    "OracleResult",
    # Initialization
    "InitializedDataset",
    "initialize_dataset",
    "initialize_random",
    "initialize_near_pareto",
    # Diversity
    "compute_fingerprint",
    "compute_tanimoto_similarity",
    "compute_max_similarity_to_recent",
    "compute_diversity_weighted_probs",
    "select_with_diversity",
    # Proposers
    "BaseProposer",
    "ObservedData",
    "ProposalResult",
    "MoltenFlowProposer",
    "TwoGPProposer",
    "MOGPProposer",
    "has_botorch",
    # Runner
    "BudgetedOptimizer",
    "OptimizationState",
    "OptimizationResult",
    # Logging
    "OptimizationLogger",
    "load_optimization_log",
    "load_experiment_logs",
    # Summary
    "BootstrapCI",
    "MethodSummary",
    "bootstrap_ci",
    "aggregate_by_method",
    "compute_method_summary",
    "generate_summary_table",
    "format_summary_table",
    "compute_pairwise_tests",
    "load_runtime_data",
    # HPO Summary
    "generate_hpo_summary",
    "format_hpo_table",
    "get_top_n_trials",
    # Plotting
    "plot_hv_convergence",
    "plot_pareto_comparison",
    "plot_molecule_gallery",
    "plot_pareto_density",
    "plot_example_runs",
    "plot_runtime_comparison",
    "plot_all_figures",
    # HPO Plotting
    "plot_hpo_history",
    "plot_hpo_importance",
    "plot_hpo_parallel_coordinate",
    "plot_hpo_contour",
    # Gamma Sweep Plotting
    "plot_gamma_sweep_curve",
    "plot_gamma_dual_axis",
    "plot_gamma_heatmap",
    "plot_gamma_metrics_grid",
]
