MILP Visualizer
Turn a MILP/LP model into a 2D map of its structure using graph embedding. Variables placed closer together are more "similar" in some sense. In a CVRP model, for example, each vehicle forms its own cluster, and each cluster breaks down further into sub-clusters per customer node. Since these patterns emerge from problem structure and not variable names, similar models produce similar looking maps. This introduces a way to structurally compare different models, without the need of initial knowledge.
Install
pip install milp_visualizer
Quick start
import milp_visualizer
milp_visualizer.visualize("model.mps") # or "model.lp"
Creates variable_graph.html, which contains the final result.
Works directly on live solver models too, no file needed:
import gurobipy as gp
model = gp.Model()
# ... build model ...
milp_visualizer.visualize(model)
Similarly, HiGHS and ortools models can be visualized by supplying the model as first parameter.
Usage
milp_visualizer.visualize(
source, # path (str/Path) or a Gurobi/HiGHS/OR-Tools model
output=None, # output path e.g. "graph.html" or "graph.png"; default: variable_graph.html / constraint_graph.html
mode="variables", # "variables" or "constraints"
exclude=None, # drop nodes before graph construction list of prefixes and globs
groups=None, # merge related nodes into one before embedding
max_neighbors=None, # cap edges drawn per node
label_nodes=None, # annotate node names (default: auto for <=50 nodes)
node_categories=None, # {node_name: hex_color} manual color override
)
exclude / groups syntax
Both take a string (or list of strings). Plain strings are a prefix match;
strings containing * or ? are a glob:
*captures an integer - used bygroupsto partition nodes by that value?matches any integer without capturing it
milp_visualizer.visualize("model.mps", exclude="slack_") # drop all slack_* variables
milp_visualizer.visualize("model.mps", groups=["x[?,*]"]) # group x[i,j] by j
Output files
visualize() writes one file, based on output's extension:
.html(default, recommended) - interactive Plotly scatter.png- static matplotlib scatter
License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file milp_visualizer-0.1.0.tar.gz.
File metadata
- Download URL: milp_visualizer-0.1.0.tar.gz
- Upload date:
- Size: 30.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e33ffe62d64ebcf0cc03d247f3e73d7eb8aaeda19d54d5793f0f01a04aa81e9
|
|
| MD5 |
fcddcdc8ab54bad6179faa781119034a
|
|
| BLAKE2b-256 |
e4824c512c77d2ba878edb451e5660209a1894080fef8fbbefb0b90725b97f35
|
Provenance
The following attestation bundles were made for milp_visualizer-0.1.0.tar.gz:
Publisher:
publish.yml on Agoraaa/milp-visualizer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
milp_visualizer-0.1.0.tar.gz -
Subject digest:
1e33ffe62d64ebcf0cc03d247f3e73d7eb8aaeda19d54d5793f0f01a04aa81e9 - Sigstore transparency entry: 2494277107
- Sigstore integration time:
-
Permalink:
Agoraaa/milp-visualizer@c020a2815d5e29153ce78764b3f5f8d92baa88b4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Agoraaa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c020a2815d5e29153ce78764b3f5f8d92baa88b4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file milp_visualizer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: milp_visualizer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a8b2fc1021320978f19111a6d5a83aeec426f8270db551ede342779768530b5
|
|
| MD5 |
4e71032209ba1258b796a6fe23d33729
|
|
| BLAKE2b-256 |
d82cee05b01f2c2bf51c61a8e1052273058e4f258ba232d3c9afdbeb1c809f35
|
Provenance
The following attestation bundles were made for milp_visualizer-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Agoraaa/milp-visualizer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
milp_visualizer-0.1.0-py3-none-any.whl -
Subject digest:
0a8b2fc1021320978f19111a6d5a83aeec426f8270db551ede342779768530b5 - Sigstore transparency entry: 2494277189
- Sigstore integration time:
-
Permalink:
Agoraaa/milp-visualizer@c020a2815d5e29153ce78764b3f5f8d92baa88b4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Agoraaa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c020a2815d5e29153ce78764b3f5f8d92baa88b4 -
Trigger Event:
push
-
Statement type: