# nguyenduc810/svh-psl architecture

> Architecture diagram of the GitHub repository nguyenduc810/svh-psl, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nguyenduc810/svh-psl
- Repository: https://github.com/nguyenduc810/svh-psl

## Overview

##### Project Type and Purpose
- This project implements algorithms from the paper “Improving Pareto Set Learning for Expensive Multi-objective Optimization via Stein Variational Hypernetworks”. It is primarily an experimental research codebase that orchestrates different optimization strategies, including Pareto Set Learning (PSL), Multi-Objective Bayesian Optimization (MOBO), and Stein Variational methods (SVH) to solve expensive multi-objective optimization problems.
- The project is organized into distinct modules or “pipelines” that are executed via different driver scripts (run_DA.py, run_psl_mobo.py, and run_svh.py).

##### Analyzing the File Structure
- The project consists of several main directories and modules:
- Ground_truth_approximate_PF: Stores numpy arrays (.npy files) representing approximate Pareto front data. This supports benchmarking or validation of the optimization techniques.
- SVGD: Contains the file moosvgd.py. This module likely implements the Stein Variational Gradient Descent approach used for hypernetwork adaptation.
- mobo: Contains modules for surrogate model acquisition, various MOBO algorithms, and an extensive subdirectory “gp_model” with files dealing with Gaussian process surrogate models (base_models, gaussian_process, math_utils, etc.) as well as a “surrogate_model” subdirectory. This forms the Bayesian Optimization part of the system.
- Additional files like lhs.py, metrics.py, partitioning.py, and problem.py suggest support modules for design of experiments, evaluation metrics, data partitioning, and problem formulation.
- run_*.py files serve as gateways to run the experiments.

##### Specific Elements
- Components:
- Interactions:

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Experiment Orchestrator Cluster
    subgraph "Experiment Orchestrator"
        E_DA["run_DA.py"]:::orchestrator
        E_PSL["run_psl_mobo.py"]:::orchestrator
        E_SVH["run_svh.py"]:::orchestrator
    end

    %% DA Module Cluster
    subgraph "DA Module"
        %% Evolution Subsystem
        subgraph "Evolution Subsystem"
            DA_Evo["DA_module/evolution"]:::da
            DA_Mate["mating_selection.py"]:::da
        end
        %% Learning Subsystem
        subgraph "Learning Subsystem"
            DA_Learn["DA_module/learning"]:::da
        end
        %% Supplementary Tools
        subgraph "Supplementary Tools"
            DA_GAN["GAN_model.py"]:::da
            DA_Gen["Generate.py"]:::da
            DA_Local["LocalPCA.py"]:::da
            DA_PM["PM_mutation.py"]:::da
            DA_SPEA2["spea2_env.py"]:::da
            DA_Prob["DA_module/problem.py"]:::da
        end
    end

    %% MOBO Module Cluster
    subgraph "MOBO Module"
        %% Core Algorithms
        subgraph "Core Algorithms"
            MOBO_Acq["acquisition.py"]:::mobo
            MOBO_Alg["algorithms.py"]:::mobo
            MOBO_Fac["factory.py"]:::mobo
            MOBO_Sel["selection.py"]:::mobo
            MOBO_Main["mobo.py"]:::mobo
        end
        %% Surrogate Modeling
        subgraph "Surrogate Modeling"
            MOBO_GP["mobo/gp_model"]:::mobo
            MOBO_Surr["mobo/surrogate_model"]:::mobo
        end
        %% Additional Utilities
        subgraph "Additional Utilities"
            MOBO_Trans["transformation.py"]:::mobo
            MOBO_Utils["utils.py"]:::mobo
            MOBO_SurrProb["surrogate_problem.py"]:::mobo
        end
    end

    %% SVGD Module Cluster
    subgraph "SVGD Module"
        SVGD_Main["SVGD/moosvgd.py"]:::svgd
    end

    %% Data & Auxiliary Cluster
    subgraph "Data & Utilities"
        GT_Data["Ground_truth_approximate_PF"]:::data
        AUX_Util["Auxiliary Tools: top-level problem.py, lhs.py, metrics.py, partitioning.py, model.py"]:::aux
        VIS_Note["plot_result.ipynb"]:::aux
    end

    %% Interactions from Experiment Orchestrator to Modules
    E_DA -->|"triggers"| DA_Evo
    E_PSL -->|"triggers"| MOBO_Acq
    E_SVH -->|"triggers"| SVGD_Main

    %% Interactions within DA Module
    DA_Evo -->|"supplies"| DA_Learn
    DA_Learn -->|"informs"| DA_Prob
    %% Supplementary Tools support Evolution and Learning
    DA_GAN --- DA_Evo
    DA_Gen --- DA_Evo
    DA_Local --- DA_Learn
    DA_PM --- DA_Evo
    DA_SPEA2 --- DA_Evo
    DA_Prob --- DA_Learn

    %% Interactions within MOBO Module
    MOBO_GP -->|"updates"| MOBO_Acq
    MOBO_Surr -->|"informs"| MOBO_Acq
    MOBO_Acq -->|"guides"| MOBO_Alg
    MOBO_Fac --> MOBO_Main

    %% Cross module interactions
    DA_Learn -->|"evaluates"| AUX_Util
    MOBO_Acq -->|"evaluates"| AUX_Util
    SVGD_Main -->|"adjusts"| AUX_Util

    %% Data flows to Visualization
    GT_Data -->|"feeds"| VIS_Note
    AUX_Util -->|"feeds"| VIS_Note

    %% Click Events for Experiment Orchestrator
    click E_DA "https://github.com/nguyenduc810/svh-psl/blob/main/run_DA.py"
    click E_PSL "https://github.com/nguyenduc810/svh-psl/blob/main/run_psl_mobo.py"
    click E_SVH "https://github.com/nguyenduc810/svh-psl/blob/main/run_svh.py"

    %% Click Events for DA Module – Evolution Subsystem
    click DA_Evo "https://github.com/nguyenduc810/svh-psl/tree/main/DA_module/evolution"
    click DA_Mate "https://github.com/nguyenduc810/svh-psl/blob/main/DA_module/mating_selection.py"

    %% Click Events for DA Module – Learning Subsystem
    click DA_Learn "https://github.com/nguyenduc810/svh-psl/tree/main/DA_module/learning"

    %% Click Events for DA Module – Supplementary Tools
    click DA_GAN "https://github.com/nguyenduc810/svh-psl/blob/main/DA_module/GAN_model.py"
    click DA_Gen "https://github.com/nguyenduc810/svh-psl/blob/main/DA_module/Generate.py"
    click DA_Local "https://github.com/nguyenduc810/svh-psl/blob/main/DA_module/LocalPCA.py"
    click DA_PM "https://github.com/nguyenduc810/svh-psl/blob/main/DA_module/PM_mutation.py"
    click DA_SPEA2 "https://github.com/nguyenduc810/svh-psl/blob/main/DA_module/spea2_env.py"
    click DA_Prob "https://github.com/nguyenduc810/svh-psl/blob/main/DA_module/problem.py"

    %% Click Events for MOBO Module – Core Algorithms
    click MOBO_Acq "https://github.com/nguyenduc810/svh-psl/blob/main/mobo/acquisition.py"
    click MOBO_Alg "https://github.com/nguyenduc810/svh-psl/blob/main/mobo/algorithms.py"
    click MOBO_Fac "https://github.com/nguyenduc810/svh-psl/blob/main/mobo/factory.py"
    click MOBO_Sel "https://github.com/nguyenduc810/svh-psl/blob/main/mobo/selection.py"
    click MOBO_Main "https://github.com/nguyenduc810/svh-psl/blob/main/mobo/mobo.py"

    %% Click Events for MOBO Module – Surrogate Modeling
    click MOBO_GP "https://github.com/nguyenduc810/svh-psl/tree/main/mobo/gp_model"
    click MOBO_Surr "https://github.com/nguyenduc810/svh-psl/tree/main/mobo/surrogate_model"

    %% Click Events for MOBO Module – Additional Utilities
    click MOBO_Trans "https://github.com/nguyenduc810/svh-psl/blob/main/mobo/transformation.py"
    click MOBO_Utils "https://github.com/nguyenduc810/svh-psl/blob/main/mobo/utils.py"
    click MOBO_SurrProb "https://github.com/nguyenduc810/svh-psl/blob/main/mobo/surrogate_problem.py"

    %% Click Event for SVGD Module
    click SVGD_Main "https://github.com/nguyenduc810/svh-psl/blob/main/SVGD/moosvgd.py"

    %% Click Event for Ground Truth Data Repository
    click GT_Data "https://github.com/nguyenduc810/svh-psl/tree/main/Ground_truth_approximate_PF"

    %% Click Event for Auxiliary Tools
    click AUX_Util "https://github.com/nguyenduc810/svh-psl/blob/main/problem.py"

    %% Click Event for Visualization/Analysis
    click VIS_Note "https://github.com/nguyenduc810/svh-psl/blob/main/plot_result.ipynb"

    %% Styles
    classDef orchestrator fill:#f9d5bb,stroke:#d88c75,stroke-width:2px;
    classDef da fill:#bbd1f9,stroke:#7192c2,stroke-width:2px;
    classDef mobo fill:#bbf9bd,stroke:#75c28c,stroke-width:2px;
    classDef svgd fill:#f9bbd1,stroke:#c27592,stroke-width:2px;
    classDef data fill:#f9f1bb,stroke:#c2b275,stroke-width:2px;
    classDef aux fill:#e6bbf9,stroke:#996ec2,stroke-width:2px;
```
