Skip to main content

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 by groups to 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

GPL

Metadata

Release files for milp-visualizer 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for milp-visualizer 0.1.0
File Size Uploaded
milp_visualizer-0.1.0.tar.gz 30.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for milp-visualizer 0.1.0
File Interpreter ABI Platform
milp_visualizer-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 64.4 kB

Release files / milp_visualizer-0.1.0.tar.gz

Download URL milp_visualizer-0.1.0.tar.gz
Size 30.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1e33ffe62d64ebcf0cc03d247f3e73d7eb8aaeda19d54d5793f0f01a04aa81e9
BLAKE2b-256 checksum
How to use checksums
e4824c512c77d2ba878edb451e5660209a1894080fef8fbbefb0b90725b97f35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 16, 2026.

Transparency log

Release files / milp_visualizer-0.1.0-py3-none-any.whl

Download URL milp_visualizer-0.1.0-py3-none-any.whl
Size 33.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a8b2fc1021320978f19111a6d5a83aeec426f8270db551ede342779768530b5
BLAKE2b-256 checksum
How to use checksums
d82cee05b01f2c2bf51c61a8e1052273058e4f258ba232d3c9afdbeb1c809f35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page