# derekflippo/constoptbench architecture

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

- Interactive diagram: https://gitdiagram.com/derekflippo/constoptbench
- Repository: https://github.com/derekflippo/constoptbench

## Overview

This repository is an LLM benchmark for constrained optimization. Its principal workflow generates solver-labeled problems across five optimization types and eight difficulty levels, exports them as JSON, evaluates model answers, and optionally judges errors in evaluation results. Generation dispatch and problem formatting are visible in sampled source; evaluation and judging are included as documented product capabilities, but their implementation was not inspected. Relationships to model services are therefore documented rather than inferred from unsampled code.

Main entry points: [`mathematics_dataset/modules/modules.py`](https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/modules/modules.py) (Type registry), [`mathematics_dataset/example.py`](https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/example.py) (Problem formatter), [`mathematics_dataset/evaluate.py`](https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/evaluate.py) (Model evaluator), [`mathematics_dataset/judge_errors.py`](https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/judge_errors.py) (LLM judge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_generation["Problem generation"]
  node_generator["Generator<br/>[generate.py]"]
  node_settings["Length limits"]
  node_dispatcher["Type registry<br/>[modules.py]"]
  node_json_export["JSON exporter"]
  node_problem_format["Problem formatter<br/>[example.py]"]
end

subgraph group_problem_types["Optimization types"]
  node_gp["Geometric programming<br/>[geometric.py]"]
  node_lp["Linear programming"]
  node_qcqp["Quadratic constraints"]
  node_qp["Quadratic programming"]
  node_sdp["Semidefinite programming"]
end

subgraph group_evaluation["Model evaluation"]
  node_evaluator["Model evaluator<br/>[evaluate.py]"]
end

subgraph group_judging["Answer judging"]
  node_judge["LLM judge<br/>[judge_errors.py]"]
end

node_researcher(("Benchmark user"))
node_benchmark_json["Problem JSON"]
node_model_services{{"Model APIs"}}
node_results_json["Evaluation results"]
node_judged_json["Judged results"]

node_researcher -.->|"requests generation"| node_json_export
node_json_export -->|"uses generation"| node_generator
node_generator -->|"checks limits"| node_settings
node_generator -->|"loads generators"| node_dispatcher
node_dispatcher -->|"registers type"| node_gp
node_dispatcher -->|"registers type"| node_lp
node_dispatcher -->|"registers type"| node_qcqp
node_dispatcher -->|"registers type"| node_qp
node_dispatcher -->|"registers type"| node_sdp
node_gp -->|"formats question"| node_problem_format
node_lp -->|"formats question"| node_problem_format
node_qcqp -->|"formats question"| node_problem_format
node_qp -->|"formats question"| node_problem_format
node_sdp -->|"formats question"| node_problem_format
node_json_export -->|"writes problems"| node_benchmark_json
node_researcher -->|"starts evaluation"| node_evaluator
node_benchmark_json -->|"provides inputs"| node_evaluator
node_evaluator -.->|"queries models"| node_model_services
node_evaluator -->|"writes results"| node_results_json
node_researcher -->|"starts judging"| node_judge
node_results_json -->|"provides results"| node_judge
node_judge -.->|"requests judgments"| node_model_services
node_judge -->|"writes judgments"| node_judged_json

click node_generator "https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/generate.py"
click node_settings "https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/generate_settings.py"
click node_dispatcher "https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/modules/modules.py"
click node_json_export "https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/generate_to_json.py"
click node_problem_format "https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/example.py"
click node_gp "https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/modules/geometric.py"
click node_lp "https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/modules/linear_programming.py"
click node_qcqp "https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/modules/quadratic_constrained_quadratic_programming.py"
click node_qp "https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/modules/quadratic_programming.py"
click node_sdp "https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/modules/semidefinite_programming.py"
click node_evaluator "https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/evaluate.py"
click node_judge "https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/judge_errors.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_generator,node_settings,node_dispatcher,node_json_export,node_problem_format,node_researcher toneBlue
class node_gp,node_lp,node_qcqp,node_qp,node_sdp toneAmber
class node_evaluator,node_model_services toneMint
class node_judge toneRose
class node_benchmark_json,node_results_json,node_judged_json toneIndigo
```

## Components

### Problem generation

- [Generator](https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/generate.py): `mathematics_dataset/generate.py`
- [Length limits](https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/generate_settings.py): `mathematics_dataset/generate_settings.py`
- [Type registry](https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/modules/modules.py): `mathematics_dataset/modules/modules.py`
- [JSON exporter](https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/generate_to_json.py): `mathematics_dataset/generate_to_json.py`
- [Problem formatter](https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/example.py): `mathematics_dataset/example.py`

### Optimization types

- [Geometric programming](https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/modules/geometric.py): `mathematics_dataset/modules/geometric.py`
- [Linear programming](https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/modules/linear_programming.py): `mathematics_dataset/modules/linear_programming.py`
- [Quadratic constraints](https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/modules/quadratic_constrained_quadratic_programming.py): `mathematics_dataset/modules/quadratic_constrained_quadratic_programming.py`
- [Quadratic programming](https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/modules/quadratic_programming.py): `mathematics_dataset/modules/quadratic_programming.py`
- [Semidefinite programming](https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/modules/semidefinite_programming.py): `mathematics_dataset/modules/semidefinite_programming.py`

### Model evaluation

- [Model evaluator](https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/evaluate.py): `mathematics_dataset/evaluate.py`

### Answer judging

- [LLM judge](https://github.com/derekflippo/constoptbench/blob/main/mathematics_dataset/judge_errors.py): `mathematics_dataset/judge_errors.py`

### Other components

- **Benchmark user**
- **Problem JSON**
- **Model APIs**
- **Evaluation results**
- **Judged results**

## Connections

- Benchmark user → JSON exporter: requests generation (evidence: `README.md`)
- JSON exporter → Generator: uses generation (evidence: `mathematics_dataset/generate_to_json.py`)
- Generator → Length limits: checks limits (evidence: `mathematics_dataset/generate.py`)
- Generator → Type registry: loads generators (evidence: `mathematics_dataset/generate.py`)
- Type registry → Geometric programming: registers type (evidence: `mathematics_dataset/modules/modules.py`)
- Type registry → Linear programming: registers type (evidence: `mathematics_dataset/modules/modules.py`)
- Type registry → Quadratic constraints: registers type (evidence: `mathematics_dataset/modules/modules.py`)
- Type registry → Quadratic programming: registers type (evidence: `mathematics_dataset/modules/modules.py`)
- Type registry → Semidefinite programming: registers type (evidence: `mathematics_dataset/modules/modules.py`)
- Geometric programming → Problem formatter: formats question (evidence: `mathematics_dataset/modules/geometric.py`)
- Linear programming → Problem formatter: formats question (evidence: `mathematics_dataset/modules/linear_programming.py`)
- Quadratic constraints → Problem formatter: formats question (evidence: `mathematics_dataset/modules/quadratic_constrained_quadratic_programming.py`)
- Quadratic programming → Problem formatter: formats question (evidence: `mathematics_dataset/modules/quadratic_programming.py`)
- Semidefinite programming → Problem formatter: formats question (evidence: `mathematics_dataset/modules/semidefinite_programming.py`)
- JSON exporter → Problem JSON: writes problems (evidence: `README.md`)
- Benchmark user → Model evaluator: starts evaluation (evidence: `README.md`)
- Problem JSON → Model evaluator: provides inputs (evidence: `README.md`)
- Model evaluator → Model APIs: queries models (evidence: `README.md`)
- Model evaluator → Evaluation results: writes results (evidence: `README.md`)
- Benchmark user → LLM judge: starts judging (evidence: `README.md`)
- Evaluation results → LLM judge: provides results (evidence: `README.md`)
- LLM judge → Model APIs: requests judgments (evidence: `README.md`)
- LLM judge → Judged results: writes judgments (evidence: `README.md`)
