lp2graph 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lp2graph-0.3.0/.gitignore +19 -0
- lp2graph-0.3.0/CHANGELOG.md +137 -0
- lp2graph-0.3.0/CITATION.cff +33 -0
- lp2graph-0.3.0/LICENSE +205 -0
- lp2graph-0.3.0/PKG-INFO +206 -0
- lp2graph-0.3.0/README.md +142 -0
- lp2graph-0.3.0/corpus/validation/README.md +88 -0
- lp2graph-0.3.0/corpus/validation/codec_pipeline/README.md +52 -0
- lp2graph-0.3.0/docs/STACK.md +95 -0
- lp2graph-0.3.0/docs/add-a-formulation.md +57 -0
- lp2graph-0.3.0/docs/adr/0001-build-tool.md +43 -0
- lp2graph-0.3.0/docs/adr/0002-internal-graph.md +49 -0
- lp2graph-0.3.0/docs/adr/0003-license.md +45 -0
- lp2graph-0.3.0/docs/adr/0004-schema-versioning.md +57 -0
- lp2graph-0.3.0/docs/adr/0005-viewer-hosting.md +41 -0
- lp2graph-0.3.0/docs/adr/0006-determinism.md +64 -0
- lp2graph-0.3.0/docs/adr/0007-optional-deps-lazy-import.md +66 -0
- lp2graph-0.3.0/docs/catalog.md +44 -0
- lp2graph-0.3.0/docs/data-model.md +159 -0
- lp2graph-0.3.0/docs/demo/configurator.html +567 -0
- lp2graph-0.3.0/docs/demo/explore.html +350 -0
- lp2graph-0.3.0/docs/demo/index.html +127 -0
- lp2graph-0.3.0/docs/design-context.md +193 -0
- lp2graph-0.3.0/docs/extraction-report.md +187 -0
- lp2graph-0.3.0/docs/index.md +3 -0
- lp2graph-0.3.0/docs/metrics.md +48 -0
- lp2graph-0.3.0/docs/mining.md +85 -0
- lp2graph-0.3.0/docs/text-graph-interface.md +176 -0
- lp2graph-0.3.0/docs/v1-acceptance.md +66 -0
- lp2graph-0.3.0/docs/views.md +80 -0
- lp2graph-0.3.0/examples/01-load-and-validate.py +27 -0
- lp2graph-0.3.0/examples/02-derive-three-views.py +27 -0
- lp2graph-0.3.0/examples/03-compute-metrics.py +35 -0
- lp2graph-0.3.0/examples/04-export-to-pyg.py +37 -0
- lp2graph-0.3.0/examples/05-add-a-new-formulation.md +103 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/ModelOrTools.java +74 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/README.md +218 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/build_pdf.py +204 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/data.json +14 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/model.lp +32 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/model.mps +118 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/model_ampl.mod +37 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/model_cvxpy.py +42 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/model_docplex.py +43 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/model_gams.gms +36 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/model_glpk.mod +37 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/model_gurobi.py +41 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/model_jump.jl +31 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/model_matlab.m +61 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/model_minizinc.mzn +29 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/model_ompr.R +34 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/model_opl.mod +31 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/model_ortools.cpp +80 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/model_ortools.py +45 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/model_pulp.py +49 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/model_pyomo.py +43 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/model_python_mip.py +40 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/model_zimpl.zpl +25 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/problem.tex +102 -0
- lp2graph-0.3.0/examples/railway-bigm-milp/railway_bigm_milp.pdf +544 -0
- lp2graph-0.3.0/formulations/constraints/assignment.json +56 -0
- lp2graph-0.3.0/formulations/constraints/lp_1_1_fixed_sequence.json +63 -0
- lp2graph-0.3.0/formulations/constraints/lp_1_5_soft_regularity.json +47 -0
- lp2graph-0.3.0/formulations/constraints/mip_2_1_big_m.json +64 -0
- lp2graph-0.3.0/formulations/constraints/mip_2_4_time_indexed.json +54 -0
- lp2graph-0.3.0/formulations/constraints/mip_2_8_pesp.json +67 -0
- lp2graph-0.3.0/formulations/constraints/pesp_solvable.json +69 -0
- lp2graph-0.3.0/formulations/objectives/multi_obj_lateness_energy.json +43 -0
- lp2graph-0.3.0/formulations/objectives/objective_abs_deviation.json +23 -0
- lp2graph-0.3.0/formulations/objectives/objective_lex_priority.json +23 -0
- lp2graph-0.3.0/legacy/README.md +13 -0
- lp2graph-0.3.0/pyproject.toml +145 -0
- lp2graph-0.3.0/schema/canonical.schema.json +340 -0
- lp2graph-0.3.0/src/lp2graph/__init__.py +54 -0
- lp2graph-0.3.0/src/lp2graph/cli.py +238 -0
- lp2graph-0.3.0/src/lp2graph/codec/__init__.py +41 -0
- lp2graph-0.3.0/src/lp2graph/codec/latex.py +884 -0
- lp2graph-0.3.0/src/lp2graph/codec/normalize.py +82 -0
- lp2graph-0.3.0/src/lp2graph/core/__init__.py +35 -0
- lp2graph-0.3.0/src/lp2graph/core/graph.py +183 -0
- lp2graph-0.3.0/src/lp2graph/core/loader.py +63 -0
- lp2graph-0.3.0/src/lp2graph/core/model.py +437 -0
- lp2graph-0.3.0/src/lp2graph/core/validate.py +237 -0
- lp2graph-0.3.0/src/lp2graph/export/__init__.py +13 -0
- lp2graph-0.3.0/src/lp2graph/export/dgl.py +51 -0
- lp2graph-0.3.0/src/lp2graph/export/latex.py +126 -0
- lp2graph-0.3.0/src/lp2graph/export/networkx_adapter.py +50 -0
- lp2graph-0.3.0/src/lp2graph/export/pyg.py +79 -0
- lp2graph-0.3.0/src/lp2graph/export/pyomo_stub.py +81 -0
- lp2graph-0.3.0/src/lp2graph/metrics/__init__.py +58 -0
- lp2graph-0.3.0/src/lp2graph/metrics/classification.py +113 -0
- lp2graph-0.3.0/src/lp2graph/metrics/flags.py +122 -0
- lp2graph-0.3.0/src/lp2graph/metrics/result.py +26 -0
- lp2graph-0.3.0/src/lp2graph/metrics/structural.py +236 -0
- lp2graph-0.3.0/src/lp2graph/mining/__init__.py +47 -0
- lp2graph-0.3.0/src/lp2graph/mining/cluster/__init__.py +65 -0
- lp2graph-0.3.0/src/lp2graph/mining/cluster/agglomerative.py +82 -0
- lp2graph-0.3.0/src/lp2graph/mining/cluster/distance.py +65 -0
- lp2graph-0.3.0/src/lp2graph/mining/cluster/operator.py +218 -0
- lp2graph-0.3.0/src/lp2graph/mining/cluster/silhouette.py +88 -0
- lp2graph-0.3.0/src/lp2graph/mining/cluster/stability.py +178 -0
- lp2graph-0.3.0/src/lp2graph/mining/cluster/taxonomy.py +268 -0
- lp2graph-0.3.0/src/lp2graph/mining/corpusmgr/__init__.py +70 -0
- lp2graph-0.3.0/src/lp2graph/mining/corpusmgr/dedup.py +183 -0
- lp2graph-0.3.0/src/lp2graph/mining/corpusmgr/manager.py +79 -0
- lp2graph-0.3.0/src/lp2graph/mining/corpusmgr/manifest.py +82 -0
- lp2graph-0.3.0/src/lp2graph/mining/corpusmgr/record.py +101 -0
- lp2graph-0.3.0/src/lp2graph/mining/corpusmgr/select.py +128 -0
- lp2graph-0.3.0/src/lp2graph/mining/homologize/__init__.py +82 -0
- lp2graph-0.3.0/src/lp2graph/mining/homologize/concept.py +134 -0
- lp2graph-0.3.0/src/lp2graph/mining/homologize/entity.py +217 -0
- lp2graph-0.3.0/src/lp2graph/mining/homologize/lemmatize.py +80 -0
- lp2graph-0.3.0/src/lp2graph/mining/homologize/signature.py +166 -0
- lp2graph-0.3.0/src/lp2graph/mining/homologize/thesaurus.py +70 -0
- lp2graph-0.3.0/src/lp2graph/mining/homologize/tokenize.py +255 -0
- lp2graph-0.3.0/src/lp2graph/mining/homologize/vectorize.py +141 -0
- lp2graph-0.3.0/src/lp2graph/mining/ingest/__init__.py +59 -0
- lp2graph-0.3.0/src/lp2graph/mining/ingest/code_importers.py +104 -0
- lp2graph-0.3.0/src/lp2graph/mining/ingest/dispatch.py +148 -0
- lp2graph-0.3.0/src/lp2graph/mining/ingest/latex_normalizer.py +243 -0
- lp2graph-0.3.0/src/lp2graph/mining/ingest/pyomo_importer.py +297 -0
- lp2graph-0.3.0/src/lp2graph/mining/ingest/result.py +124 -0
- lp2graph-0.3.0/src/lp2graph/mining/isomorphism/__init__.py +26 -0
- lp2graph-0.3.0/src/lp2graph/mining/isomorphism/report.py +178 -0
- lp2graph-0.3.0/src/lp2graph/mining/label/__init__.py +70 -0
- lp2graph-0.3.0/src/lp2graph/mining/label/classifier.py +161 -0
- lp2graph-0.3.0/src/lp2graph/mining/label/features.py +35 -0
- lp2graph-0.3.0/src/lp2graph/mining/label/guardrails.py +176 -0
- lp2graph-0.3.0/src/lp2graph/mining/label/loop.py +314 -0
- lp2graph-0.3.0/src/lp2graph/mining/label/rules.py +92 -0
- lp2graph-0.3.0/src/lp2graph/mining/label/store.py +164 -0
- lp2graph-0.3.0/src/lp2graph/mining/label/vocab.py +64 -0
- lp2graph-0.3.0/src/lp2graph/mining/provenance.py +90 -0
- lp2graph-0.3.0/src/lp2graph/mining/versions.py +51 -0
- lp2graph-0.3.0/src/lp2graph/nl/__init__.py +15 -0
- lp2graph-0.3.0/src/lp2graph/nl/describe.py +301 -0
- lp2graph-0.3.0/src/lp2graph/render/__init__.py +11 -0
- lp2graph-0.3.0/src/lp2graph/render/palette.py +80 -0
- lp2graph-0.3.0/src/lp2graph/render/svg.py +220 -0
- lp2graph-0.3.0/src/lp2graph/solve/__init__.py +50 -0
- lp2graph-0.3.0/src/lp2graph/solve/grounder.py +405 -0
- lp2graph-0.3.0/src/lp2graph/solve/instance.py +76 -0
- lp2graph-0.3.0/src/lp2graph/transform/__init__.py +30 -0
- lp2graph-0.3.0/src/lp2graph/transform/bigm.py +173 -0
- lp2graph-0.3.0/src/lp2graph/views/__init__.py +17 -0
- lp2graph-0.3.0/src/lp2graph/views/ground.py +477 -0
- lp2graph-0.3.0/src/lp2graph/views/hybrid.py +202 -0
- lp2graph-0.3.0/src/lp2graph/views/schema.py +208 -0
- lp2graph-0.3.0/tests/conftest.py +34 -0
- lp2graph-0.3.0/tests/mining/test_cluster.py +223 -0
- lp2graph-0.3.0/tests/mining/test_corpus_manager.py +265 -0
- lp2graph-0.3.0/tests/mining/test_homologize.py +195 -0
- lp2graph-0.3.0/tests/mining/test_ingest.py +230 -0
- lp2graph-0.3.0/tests/mining/test_isomorphism.py +109 -0
- lp2graph-0.3.0/tests/mining/test_label.py +190 -0
- lp2graph-0.3.0/tests/test_bigm.py +90 -0
- lp2graph-0.3.0/tests/test_codec.py +65 -0
- lp2graph-0.3.0/tests/test_describe.py +60 -0
- lp2graph-0.3.0/tests/test_export.py +47 -0
- lp2graph-0.3.0/tests/test_metrics.py +140 -0
- lp2graph-0.3.0/tests/test_render.py +63 -0
- lp2graph-0.3.0/tests/test_schema.py +202 -0
- lp2graph-0.3.0/tests/test_solve.py +68 -0
- lp2graph-0.3.0/tests/test_views.py +209 -0
- lp2graph-0.3.0/ui/README.md +133 -0
- lp2graph-0.3.0/viewer/index.html +386 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **`metrics.model_completeness`** — the second model-level well-formedness
|
|
12
|
+
indicator described in *LP Mining with LP2Graph* (objective declared together
|
|
13
|
+
with ≥1 variable and ≥1 constraint), companion to `model_coherence`. Now
|
|
14
|
+
computed and wired into the Level-M structural feature document
|
|
15
|
+
(`mining.cluster.taxonomy.model_feature_document`) as a `complete:{0,1}`
|
|
16
|
+
feature, closing a paper↔code gap where the paper named both indicators but
|
|
17
|
+
only coherence was implemented.
|
|
18
|
+
- **LP mining extensions** (`lp2graph.mining`, issues #38–#43) — six
|
|
19
|
+
deterministic modules implementing the *LP Mining with LP2Graph* method on
|
|
20
|
+
top of the core library. Every frozen resource is versioned in
|
|
21
|
+
`lp2graph.mining.versions` and stamped into emitted records.
|
|
22
|
+
- **M1 `mining.ingest`** — heterogeneous ingestion front-end: a Pyomo
|
|
23
|
+
importer (`from_pyomo`), a versioned non-canonical LaTeX normalizer with
|
|
24
|
+
source-span provenance (`normalize_latex` / `ingest_latex`), and an
|
|
25
|
+
extension dispatcher (`ingest`) that reports failures as structured
|
|
26
|
+
`IngestionResult`s rather than dropping them.
|
|
27
|
+
- **M2 `mining.homologize`** — lexical homologizer (tokenize / lemmatize /
|
|
28
|
+
versioned stop-list / frozen domain thesaurus + optional WordNet) and a
|
|
29
|
+
TF-IDF `ConceptVectorizer` over a sorted, diffable `Vocabulary`, plus the
|
|
30
|
+
type signature `τ(s)` and the `Entity` model for levels V/C/M.
|
|
31
|
+
- **M3 `mining.cluster`** — the cluster-and-name operator `CN` (deterministic
|
|
32
|
+
average-linkage default, `fixed_k`+silhouette, optional HDBSCAN), the
|
|
33
|
+
bottom-up Level V→C→M taxonomy `induce`, and `stability_report`
|
|
34
|
+
(silhouette + bootstrap ARI + sensitivity).
|
|
35
|
+
- **M4 `mining.label`** — two-stage labeling service: rule layer + calibrated
|
|
36
|
+
one-vs-rest `LinearSVM`, a confidence-gated closed loop with a versioned,
|
|
37
|
+
replayable `LabelStore`, rule promotion, retraining, and gold-set
|
|
38
|
+
guardrails (drift, per-class P/R, Cohen's κ, rollback flag).
|
|
39
|
+
- **M5 `mining.corpusmgr`** — provenance records, a regeneration `CorpusManifest`
|
|
40
|
+
(frozen search date + queries), deterministic dedup (schema-graph hash or
|
|
41
|
+
bibliographic key), and reproducible representative selection.
|
|
42
|
+
- **M6 `mining.isomorphism`** — per-cluster schema-graph isomorphism rate via
|
|
43
|
+
the NetworkX export (`isomorphism_report`).
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- **CI now gates formatting:** added a `ruff format --check src tests` step to
|
|
48
|
+
`ci.yml` (previously only `ruff check` ran, so format drift could land
|
|
49
|
+
undetected). Bumped the `ruff-pre-commit` pin v0.4.10 → v0.15.12 and the
|
|
50
|
+
`dev` extra to `ruff>=0.15.12,<0.16` so local, pre-commit, and CI agree;
|
|
51
|
+
reformatted 21 pre-existing files to the current ruff style.
|
|
52
|
+
|
|
53
|
+
### Docs
|
|
54
|
+
|
|
55
|
+
- Added `docs/STACK.md` (software-stack reference) and ADR-0006 (determinism as
|
|
56
|
+
a hard requirement) and ADR-0007 (optional dependencies are lazily imported),
|
|
57
|
+
wired into the MkDocs nav.
|
|
58
|
+
|
|
59
|
+
## [0.3.0] - 2026-06-01
|
|
60
|
+
|
|
61
|
+
### Added
|
|
62
|
+
|
|
63
|
+
- **Deterministic LaTeX ⇄ graph codec** (`lp2graph.codec`): paper-style
|
|
64
|
+
LaTeX (`\mathcal` index sets, `\sum`, `\forall`, big-M) round-trips with
|
|
65
|
+
the canonical model with no LLM in the loop.
|
|
66
|
+
`to_canonical_latex` / `from_canonical_latex`, plus
|
|
67
|
+
`canonical_normal_form` for round-trip comparison. The LaTeX
|
|
68
|
+
serialization is a tested fixed point (`to(from(to(f))) == to(f)`); the
|
|
69
|
+
solvable content round-trips exactly.
|
|
70
|
+
- **Real grounding solver back-end** (`lp2graph.solve`): replaces the v0.1
|
|
71
|
+
Pyomo stub. Grounds a formulation with an `Instance` (cardinalities +
|
|
72
|
+
parameter values) into a concrete `pulp.LpProblem` and solves it
|
|
73
|
+
(CBC / HiGHS / Gurobi). Covers the linear core including big-M and PESP
|
|
74
|
+
modulo; boundary-degenerate constraint instances are correctly omitted.
|
|
75
|
+
- **Deterministic graph → natural-language describer** (`lp2graph.nl`):
|
|
76
|
+
generates a Markdown problem description (sets, data, decisions,
|
|
77
|
+
per-constraint sentences, objective) with parameter **data tables** when
|
|
78
|
+
an instance is supplied.
|
|
79
|
+
- **End-to-end validation suite** (`corpus/validation/codec_pipeline/`):
|
|
80
|
+
runs the full JSON→LaTeX→parse→ground→solve loop and checks codec
|
|
81
|
+
round-trip, pipeline-vs-direct equality, cross-solver agreement, and
|
|
82
|
+
match to independently established optima (assignment 13, big-M ordering
|
|
83
|
+
30, fixed-sequence 18, PESP 1, time-indexed 4). Records paper anchors
|
|
84
|
+
(timtab1 = 764772, marcotallone = 3913.47).
|
|
85
|
+
- New formulations: `assignment.json`, `pesp_solvable.json`.
|
|
86
|
+
- CLI: `lp2graph latex | parse | describe | solve`.
|
|
87
|
+
- New tests: `test_codec.py`, `test_solve.py`, `test_describe.py`.
|
|
88
|
+
- Optional `solver` extra (`pulp`, `highspy`).
|
|
89
|
+
|
|
90
|
+
## [0.2.0] - 2026-05-20
|
|
91
|
+
|
|
92
|
+
### Changed
|
|
93
|
+
|
|
94
|
+
- **BREAKING:** the import package is renamed `optgraph` → `lp2graph`, so it
|
|
95
|
+
now matches the distribution name. Update imports
|
|
96
|
+
(`from optgraph import …` → `from lp2graph import …`) and the console
|
|
97
|
+
script (`optgraph …` → `lp2graph …`). No behaviour changed; this is a
|
|
98
|
+
pure rename. The canonical `schema_version` is unaffected (still `0.1.0`).
|
|
99
|
+
|
|
100
|
+
## [0.1.0] - 2026-05-03
|
|
101
|
+
|
|
102
|
+
### Added
|
|
103
|
+
|
|
104
|
+
- Canonical JSON schema (`schema/canonical.schema.json`) with index
|
|
105
|
+
families, parameters, variable templates, constraint templates,
|
|
106
|
+
first-class objectives, and term-level refs/bindings/role/sign
|
|
107
|
+
semantics.
|
|
108
|
+
- Pydantic v2 model (`lp2graph.core.model`) mirroring the schema.
|
|
109
|
+
- Two-phase validator (JSON Schema + semantic invariants).
|
|
110
|
+
- Three view derivations: `lp2graph.views.schema`, `.hybrid`, `.ground`.
|
|
111
|
+
- Internal typed graph (`lp2graph.core.graph`) — library-agnostic.
|
|
112
|
+
- Structural metrics: `node_counts_by_class`, `edge_density`,
|
|
113
|
+
`constraint_variable_ratio`, `minimal_size`, `model_coherence`,
|
|
114
|
+
`graph_diameter`.
|
|
115
|
+
- Presence flags: `has_big_m`, `has_integer_vars`,
|
|
116
|
+
`has_modulo_offset`, `has_soft_slack`,
|
|
117
|
+
`has_aggregation_operator`.
|
|
118
|
+
- Constraint classification (heuristic, regex-based; ported from the
|
|
119
|
+
source repo with attribution).
|
|
120
|
+
- SVG renderer with the design-context palette and typography.
|
|
121
|
+
- Static interactive viewer (`viewer/index.html`).
|
|
122
|
+
- Export adapters: NetworkX (full), PyG (HeteroData), DGL, LaTeX,
|
|
123
|
+
Pyomo (skeleton; bodies are stubs in v0.1).
|
|
124
|
+
- CLI: `lp2graph validate | view | render | metrics | export`.
|
|
125
|
+
- Initial catalog: 5 constraint-focused and 3 objective-focused
|
|
126
|
+
formulations across LP and MILP families.
|
|
127
|
+
- 36 tests covering schema validation, view derivations, metrics,
|
|
128
|
+
rendering, and exports.
|
|
129
|
+
- CI for Linux + macOS, Python 3.11/3.12/3.13.
|
|
130
|
+
- Docs: data-model, views, metrics, add-a-formulation, design context,
|
|
131
|
+
extraction report; ADRs 0001-0005.
|
|
132
|
+
|
|
133
|
+
### Origin
|
|
134
|
+
|
|
135
|
+
Bootstrapped from
|
|
136
|
+
[`joernmht/raiLPminerExperimentation`](https://github.com/joernmht/raiLPminerExperimentation)
|
|
137
|
+
(MIT). See `docs/extraction-report.md` for the manifest.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
title: lp2graph
|
|
3
|
+
message: "If you use this software, please cite it as below."
|
|
4
|
+
type: software
|
|
5
|
+
authors:
|
|
6
|
+
- name: "lp2graph contributors"
|
|
7
|
+
url: "https://github.com/joernmht/lp2graph"
|
|
8
|
+
repository-code: "https://github.com/joernmht/lp2graph"
|
|
9
|
+
license: Apache-2.0
|
|
10
|
+
version: 0.1.0
|
|
11
|
+
date-released: "2026-05-03"
|
|
12
|
+
abstract: >-
|
|
13
|
+
Typed-graph representation of LP, MIP, and MILP formulations. Provides
|
|
14
|
+
schema-validated canonical models, three view derivations (schema /
|
|
15
|
+
hybrid / ground), structural metrics, SVG rendering, and export
|
|
16
|
+
adapters to PyG, DGL, NetworkX, LaTeX, and Pyomo.
|
|
17
|
+
keywords:
|
|
18
|
+
- optimization
|
|
19
|
+
- linear programming
|
|
20
|
+
- mixed-integer programming
|
|
21
|
+
- graph neural networks
|
|
22
|
+
- typed graphs
|
|
23
|
+
references:
|
|
24
|
+
- type: software
|
|
25
|
+
title: raiLPminerExperimentation
|
|
26
|
+
authors:
|
|
27
|
+
- name: "Joern Methner"
|
|
28
|
+
url: "https://github.com/joernmht/raiLPminerExperimentation"
|
|
29
|
+
license: MIT
|
|
30
|
+
notes: >-
|
|
31
|
+
Source repository for the structural metric algorithms and
|
|
32
|
+
constraint-classification keyword tables; see
|
|
33
|
+
docs/extraction-report.md for the attribution manifest.
|
lp2graph-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not restrict the use of the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Support. While redistributing the Work or
|
|
166
|
+
Derivative Works thereof, You may choose to offer, and charge a
|
|
167
|
+
fee for, acceptance of support, warranty, indemnity, or other
|
|
168
|
+
liability obligations and/or rights consistent with this License.
|
|
169
|
+
However, in accepting such obligations, You may act only on Your
|
|
170
|
+
own behalf and on Your sole responsibility, not on behalf of any
|
|
171
|
+
other Contributor, and only if You agree to indemnify, defend,
|
|
172
|
+
and hold each Contributor harmless for any liability incurred by,
|
|
173
|
+
or claims asserted against, such Contributor by reason of your
|
|
174
|
+
accepting any such warranty or support.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 lp2graph contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
200
|
+
implied. See the License for the specific language governing
|
|
201
|
+
permissions and limitations under the License.
|
|
202
|
+
|
|
203
|
+
This work is partially derived from joernmht/raiLPminerExperimentation
|
|
204
|
+
(MIT License); see docs/extraction-report.md for the attribution
|
|
205
|
+
manifest.
|
lp2graph-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lp2graph
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Typed-graph representation of LP, MIP, and MILP formulations.
|
|
5
|
+
Project-URL: Homepage, https://github.com/joernmht/lp2graph
|
|
6
|
+
Project-URL: Documentation, https://github.com/joernmht/lp2graph#readme
|
|
7
|
+
Project-URL: Issues, https://github.com/joernmht/lp2graph/issues
|
|
8
|
+
Project-URL: Source, https://github.com/joernmht/lp2graph
|
|
9
|
+
Author: lp2graph contributors
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: gnn,graph,linear-programming,milp,optimization
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Requires-Dist: jsonschema>=4.0
|
|
24
|
+
Requires-Dist: pydantic>=2.0
|
|
25
|
+
Provides-Extra: all
|
|
26
|
+
Requires-Dist: hdbscan>=0.8; extra == 'all'
|
|
27
|
+
Requires-Dist: highspy>=1.7; extra == 'all'
|
|
28
|
+
Requires-Dist: networkx>=3.0; extra == 'all'
|
|
29
|
+
Requires-Dist: nltk>=3.8; extra == 'all'
|
|
30
|
+
Requires-Dist: pulp>=2.8; extra == 'all'
|
|
31
|
+
Requires-Dist: pyomo>=6.7; extra == 'all'
|
|
32
|
+
Requires-Dist: torch-geometric>=2.4; extra == 'all'
|
|
33
|
+
Requires-Dist: torch>=2.0; extra == 'all'
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: jsonschema>=4.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
37
|
+
Requires-Dist: networkx>=3.0; extra == 'dev'
|
|
38
|
+
Requires-Dist: pre-commit>=3.6; extra == 'dev'
|
|
39
|
+
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
|
|
40
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
41
|
+
Requires-Dist: ruff<0.16,>=0.15.12; extra == 'dev'
|
|
42
|
+
Provides-Extra: dgl
|
|
43
|
+
Requires-Dist: dgl>=2.0; extra == 'dgl'
|
|
44
|
+
Requires-Dist: torch>=2.0; extra == 'dgl'
|
|
45
|
+
Provides-Extra: docs
|
|
46
|
+
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
|
|
47
|
+
Requires-Dist: mkdocstrings[python]>=0.25; extra == 'docs'
|
|
48
|
+
Provides-Extra: mining
|
|
49
|
+
Requires-Dist: hdbscan>=0.8; extra == 'mining'
|
|
50
|
+
Requires-Dist: networkx>=3.0; extra == 'mining'
|
|
51
|
+
Requires-Dist: nltk>=3.8; extra == 'mining'
|
|
52
|
+
Requires-Dist: pyomo>=6.7; extra == 'mining'
|
|
53
|
+
Provides-Extra: networkx
|
|
54
|
+
Requires-Dist: networkx>=3.0; extra == 'networkx'
|
|
55
|
+
Provides-Extra: pyg
|
|
56
|
+
Requires-Dist: torch-geometric>=2.4; extra == 'pyg'
|
|
57
|
+
Requires-Dist: torch>=2.0; extra == 'pyg'
|
|
58
|
+
Provides-Extra: pyomo
|
|
59
|
+
Requires-Dist: pyomo>=6.7; extra == 'pyomo'
|
|
60
|
+
Provides-Extra: solver
|
|
61
|
+
Requires-Dist: highspy>=1.7; extra == 'solver'
|
|
62
|
+
Requires-Dist: pulp>=2.8; extra == 'solver'
|
|
63
|
+
Description-Content-Type: text/markdown
|
|
64
|
+
|
|
65
|
+
# lp2graph
|
|
66
|
+
|
|
67
|
+
[](https://github.com/joernmht/lp2graph/actions/workflows/ci.yml)
|
|
68
|
+
[](https://github.com/joernmht/lp2graph/actions/workflows/docs.yml)
|
|
69
|
+
[](https://pypi.org/project/lp2graph/)
|
|
70
|
+
[](LICENSE)
|
|
71
|
+
|
|
72
|
+
**Typed-graph representation of LP, MIP, and MILP formulations.**
|
|
73
|
+
|
|
74
|
+
`lp2graph` is a focused library for representing optimization problems as
|
|
75
|
+
typed graphs and deriving multiple views of them — schema, hybrid, and
|
|
76
|
+
ground — from a single canonical data model. It ships:
|
|
77
|
+
|
|
78
|
+
- A version-stable JSON schema for formulations.
|
|
79
|
+
- Three view derivations that turn a formulation into a typed graph.
|
|
80
|
+
- Structural metrics computed deterministically over the model and views.
|
|
81
|
+
- SVG renderers and a static interactive viewer.
|
|
82
|
+
- Export adapters to PyG, DGL, NetworkX, LaTeX, and Pyomo.
|
|
83
|
+
|
|
84
|
+
The core has no solver dependency. Pyomo, JuMP, and friends are optional
|
|
85
|
+
extras.
|
|
86
|
+
|
|
87
|
+
## Install
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pip install lp2graph # core only
|
|
91
|
+
pip install "lp2graph[networkx]" # NetworkX export
|
|
92
|
+
pip install "lp2graph[pyg]" # PyG export
|
|
93
|
+
pip install "lp2graph[all]" # everything
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## 60-second tour
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
from lp2graph import load
|
|
100
|
+
from lp2graph.views import schema, hybrid, ground
|
|
101
|
+
from lp2graph.metrics.structural import structural_summary
|
|
102
|
+
from lp2graph.metrics.flags import presence_flags
|
|
103
|
+
from lp2graph.render.svg import render_svg
|
|
104
|
+
|
|
105
|
+
f = load("formulations/constraints/mip_2_1_big_m.json")
|
|
106
|
+
|
|
107
|
+
# Three views from one canonical model.
|
|
108
|
+
g_schema = schema(f) # templates and indices
|
|
109
|
+
g_hybrid = hybrid(f) # + offset-labeled edges
|
|
110
|
+
g_ground = ground(f, {"I": 4}) # + degeneracy filters
|
|
111
|
+
|
|
112
|
+
# Metrics, deterministic.
|
|
113
|
+
print(structural_summary(g_schema)["graph_diameter"].value)
|
|
114
|
+
print(presence_flags(f)["has_big_m"].value)
|
|
115
|
+
|
|
116
|
+
# Render with the deliberate visual identity.
|
|
117
|
+
open("graph.svg", "w").write(render_svg(g_hybrid, title=f.name))
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Or from the command line:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
lp2graph validate formulations/constraints/lp_1_1_fixed_sequence.json
|
|
124
|
+
lp2graph render formulations/constraints/mip_2_1_big_m.json --view hybrid --output mip_2_1.svg
|
|
125
|
+
lp2graph metrics formulations/constraints/mip_2_4_time_indexed.json
|
|
126
|
+
lp2graph export formulations/constraints/mip_2_8_pesp.json --format latex
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Text ⇄ graph, and solving (deterministic, no LLM)
|
|
130
|
+
|
|
131
|
+
Beyond the views, lp2graph offers a **bidirectional, deterministic**
|
|
132
|
+
interface between a formulation's *text* and its *graph*, plus a real
|
|
133
|
+
solver back-end:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# graph -> paper-style LaTeX (\mathcal sets, \sum, \forall, big-M) and back
|
|
137
|
+
lp2graph latex formulations/constraints/pesp_solvable.json --output pesp.tex
|
|
138
|
+
lp2graph parse pesp.tex # LaTeX -> canonical JSON
|
|
139
|
+
|
|
140
|
+
# ground with instance data and solve the MILP (CBC / HiGHS / Gurobi)
|
|
141
|
+
lp2graph solve formulations/constraints/assignment.json \
|
|
142
|
+
--instance corpus/validation/codec_pipeline/instances/assignment_4x4.json
|
|
143
|
+
|
|
144
|
+
# graph -> natural-language problem description (+ data tables)
|
|
145
|
+
lp2graph describe formulations/constraints/pesp_solvable.json --instance ...
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
from lp2graph import load, to_canonical_latex, from_canonical_latex, describe
|
|
150
|
+
from lp2graph.solve import Instance, solve
|
|
151
|
+
|
|
152
|
+
f = load("formulations/constraints/assignment.json")
|
|
153
|
+
g = from_canonical_latex(to_canonical_latex(f)) # text round-trips the graph
|
|
154
|
+
print(solve(g, Instance(cardinalities={"W": 4, "J": 4},
|
|
155
|
+
parameters={"c": [[9, 2, 7, 8], ...]})).objective)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The codec is a tested fixed point and the solvable content round-trips
|
|
159
|
+
exactly; an [end-to-end suite](corpus/validation/codec_pipeline/) confirms
|
|
160
|
+
the JSON→LaTeX→parse→ground→solve loop reproduces independently-known
|
|
161
|
+
optima across CBC/HiGHS/Gurobi. See
|
|
162
|
+
[`docs/text-graph-interface.md`](docs/text-graph-interface.md).
|
|
163
|
+
|
|
164
|
+
## What goes in, what comes out
|
|
165
|
+
|
|
166
|
+
A **formulation** is a JSON document validated against
|
|
167
|
+
[`schema/canonical.schema.json`](schema/canonical.schema.json). It declares
|
|
168
|
+
*index families* (e.g. `I`, `T`), *parameters*, *variable templates*,
|
|
169
|
+
*constraint templates* with quantifiers and bindings, and an optional
|
|
170
|
+
*objective* with first-class terms.
|
|
171
|
+
|
|
172
|
+
The **schema view** exposes templates and indices — the topology of the
|
|
173
|
+
problem. The **hybrid view** adds per-term offset, sign, and modulo
|
|
174
|
+
labels. The **ground view** materializes every instance at given index
|
|
175
|
+
cardinalities and applies degeneracy filters.
|
|
176
|
+
|
|
177
|
+
See [`docs/data-model.md`](docs/data-model.md) and
|
|
178
|
+
[`docs/views.md`](docs/views.md) for the long form.
|
|
179
|
+
|
|
180
|
+
## Status
|
|
181
|
+
|
|
182
|
+
v0.1 is an alpha. The schema and the canonical model are stable for a
|
|
183
|
+
representative cross-section of formulations; the catalog is in active
|
|
184
|
+
expansion. Tracked open questions live as `open-question` issues so they
|
|
185
|
+
are visible.
|
|
186
|
+
|
|
187
|
+
## Documentation
|
|
188
|
+
|
|
189
|
+
- [Data model](docs/data-model.md)
|
|
190
|
+
- [Views](docs/views.md)
|
|
191
|
+
- [Metrics](docs/metrics.md)
|
|
192
|
+
- [Add a formulation](docs/add-a-formulation.md)
|
|
193
|
+
- [Design context](docs/design-context.md) (the seed document)
|
|
194
|
+
- [Extraction report](docs/extraction-report.md) (provenance from the source repo)
|
|
195
|
+
- ADRs in [`docs/adr/`](docs/adr/)
|
|
196
|
+
|
|
197
|
+
## Contributing
|
|
198
|
+
|
|
199
|
+
See [`CONTRIBUTING.md`](CONTRIBUTING.md). Bugs, new formulations, design
|
|
200
|
+
decisions, and good-first-issues all have dedicated templates.
|
|
201
|
+
|
|
202
|
+
## License
|
|
203
|
+
|
|
204
|
+
Apache 2.0. Portions adapted from
|
|
205
|
+
[`joernmht/raiLPminerExperimentation`](https://github.com/joernmht/raiLPminerExperimentation)
|
|
206
|
+
under MIT — see [`docs/extraction-report.md`](docs/extraction-report.md).
|