Skip to main content

3D Visualization of Branch-and-Cut Trees using PySCIPOpt

Project description

TreeD

TreeD on PyPI

Visual representation of the branch-and-cut tree of SCIP using spatial dissimilarities of LP solutions -- Interactive Example


Example


Example2D


TreeD uses SCIP via PySCIPOpt to visualize the Branch-and-Cut tree traversed during the solution of a mixed-integer linear program (MIP or MILP). The LP solutions at each node are projected into a 2-dimensional space using a range of different transformation algorithms. Per default, multi-dimensional scaling (mds) is used. Other methods and further options can be displayed by running python -m treed --help. The 2-dimensional data points are visualized in a 3D space with regards to their respective LP solution value. Nodes higher up represent LP solutions with a higher value. These nodes are usually found later in the search and show the progress in increasing the lower or dual bound to close the MIP gap.

The color of the individual nodes is used to show different values like node age, LP iteration count, or LP condition number.

The shape of the nodes depict whether this LP solution was created through branching (🔵) or through LP resolves (🔷) at the ssame node, e.g. including cutting planes or added conflicts.

There is also a more traditional mode that ignores the spatial dimension and draws an abstract tree. This is activated via the method draw2d() or the command line flag --classic.

Installation

python -m pip install treed

Usage

  • run python -m treed --help to get usage information or use this code snippet in a Jupyter notebook:
from treed import TreeD

treed = TreeD(
    probpath="model.mps",
    nodelimit=2000,
    showcuts=True
)

treed.solve()
fig = treed.draw()
fig.show(renderer='notebook')

There is also a (faster) 2D mode that skips the projection of LP solutions and generates a more traditional tree instead:

...
fig = treed.draw2d()
fig.show(renderer='notebook')

Dependencies

  • PySCIPOpt to solve the instance and generate the necessary tree data
  • Plotly to draw the 3D visualization
  • pandas to organize the collected data
  • sklearn for multi-dimensional scaling
  • pysal to compute statistics based on spatial (dis)similarity; this is optional

Export to Amira

  • run AmiraTreeD.py to get usage information.

AmiraTreeD.py generates the '.am' data files to be loaded by Amira software to draw the tree using LineRaycast.

Settings

Project View

  • DataTree.am: SpatialGraph data file with tree nodes and edges.
  • LineRaycast: Module to display the SpatialGraph. Note that is needed to set the colormap according to py code output (For instance 'Color map from 1 to 70' in this picture).
  • DataOpt.am: SpatialGraph data file with optimun value.
  • Opt Plane: Display the optimal value as a plane.

Preview

Amira preview

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

treed-2.1.0.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

treed-2.1.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file treed-2.1.0.tar.gz.

File metadata

  • Download URL: treed-2.1.0.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for treed-2.1.0.tar.gz
Algorithm Hash digest
SHA256 e7389097d9aa0745703c055b3e264cd0f38f984fcc8aa6b97279e17242f72c97
MD5 a0a8dfe9f1f8a67c9e392c0a28fb99bd
BLAKE2b-256 71af64252706ba5dfd669c6f16afafe6932fecc2f4de15ab39f4cbd6b91dd3f6

See more details on using hashes here.

File details

Details for the file treed-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: treed-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for treed-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cfdc5f53999b2fb32eafa3d0aa5b67b6839eece9fad056b41857be18d7e00fe0
MD5 ba68e77de2f9400e0e1c7c6e6f514513
BLAKE2b-256 b5db51f76b9b9d58034911f439e7ac17d34fe5c9818baa238a1573dcc2238403

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page