# mthogeon0731/formulation-bo architecture

> Architecture diagram of the GitHub repository mthogeon0731/formulation-bo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mthogeon0731/formulation-bo
- Repository: https://github.com/mthogeon0731/formulation-bo

## Overview

formulation-bo is a Python Bayesian-optimization library for choosing the next continuous formulation experiment from prior measurements. Users record outcomes with tell(), then ask() fits objective and optional mediator surrogates, scalarizes competing objectives with ParEGO, and selects a candidate by empirical Expected Improvement. Physics-informed priors and domain checks support the workflow. The graph follows the README and excerpted core modules; unsampled results, visualization, and other documentation capabilities are not mapped as runtime components.

Main entry points: [`formulation_bo/optimizer.py`](https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/optimizer.py) (Formulation optimizer), [`formulation_bo/models.py`](https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/models.py) (Mediator GP), [`formulation_bo/acquisition.py`](https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/acquisition.py) (ParEGO scalarization), [`formulation_bo/physics.py`](https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/physics.py) (Domain checks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Experiment workflow"]
  node_optimizer["Formulation optimizer<br/>[optimizer.py]"]
  node_observations[("Observation history<br/>[optimizer.py]")]
end

subgraph group_models["Surrogate models"]
  node_mediator_model["Mediator GP<br/>[models.py]"]
  node_objective_model["Residual objective GP<br/>[models.py]"]
end

subgraph group_search["Acquisition search"]
  node_scalarization["ParEGO scalarization<br/>[acquisition.py]"]
  node_ei["Empirical EI<br/>[acquisition.py]"]
end

subgraph group_physics["Physics support"]
  node_physics_checks["Domain checks<br/>[physics.py]"]
  node_priors["Physics priors<br/>[physics.py]"]
end

node_user(("Lab user"))

node_user -->|"records observations"| node_optimizer
node_optimizer -->|"stores outcomes"| node_observations
node_optimizer -->|"validates domain"| node_physics_checks
node_optimizer -->|"fits and predicts"| node_mediator_model
node_optimizer -->|"fits and predicts"| node_objective_model
node_optimizer -->|"evaluates priors"| node_priors
node_optimizer -->|"scalarizes samples"| node_scalarization
node_optimizer -->|"scores candidates"| node_ei
node_optimizer -->|"returns recommendation"| node_user

click node_optimizer "https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/optimizer.py"
click node_observations "https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/optimizer.py"
click node_mediator_model "https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/models.py"
click node_objective_model "https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/models.py"
click node_scalarization "https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/acquisition.py"
click node_ei "https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/acquisition.py"
click node_physics_checks "https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/physics.py"
click node_priors "https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/physics.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_optimizer,node_observations,node_user toneBlue
class node_mediator_model,node_objective_model toneAmber
class node_scalarization,node_ei toneMint
class node_physics_checks,node_priors toneRose
```

## Components

### Experiment workflow

- [Formulation optimizer](https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/optimizer.py): `formulation_bo/optimizer.py`
- [Observation history](https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/optimizer.py): `formulation_bo/optimizer.py`

### Surrogate models

- [Mediator GP](https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/models.py): `formulation_bo/models.py`
- [Residual objective GP](https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/models.py): `formulation_bo/models.py`

### Acquisition search

- [ParEGO scalarization](https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/acquisition.py): `formulation_bo/acquisition.py`
- [Empirical EI](https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/acquisition.py): `formulation_bo/acquisition.py`

### Physics support

- [Domain checks](https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/physics.py): `formulation_bo/physics.py`
- [Physics priors](https://github.com/mthogeon0731/formulation-bo/blob/master/formulation_bo/physics.py): `formulation_bo/physics.py`

### Other components

- **Lab user**

## Connections

- Lab user → Formulation optimizer: records observations (evidence: `README.md`)
- Formulation optimizer → Observation history: stores outcomes (evidence: `formulation_bo/optimizer.py`)
- Formulation optimizer → Domain checks: validates domain (evidence: `formulation_bo/optimizer.py`)
- Formulation optimizer → Mediator GP: fits and predicts (evidence: `formulation_bo/optimizer.py`)
- Formulation optimizer → Residual objective GP: fits and predicts (evidence: `formulation_bo/optimizer.py`)
- Formulation optimizer → Physics priors: evaluates priors (evidence: `formulation_bo/optimizer.py`)
- Formulation optimizer → ParEGO scalarization: scalarizes samples (evidence: `formulation_bo/optimizer.py`)
- Formulation optimizer → Empirical EI: scores candidates (evidence: `formulation_bo/optimizer.py`)
- Formulation optimizer → Lab user: returns recommendation (evidence: `README.md`)
