engri-1101 / gilp

A Python package for visualizing the geometry of linear programs.
https://gilp.henryrobbins.com
Other
46 stars 8 forks source link

branch and bound visualization #2

Closed rlacjfjin closed 3 years ago

rlacjfjin commented 3 years ago

Hi, the visualization of branch and bound is not work. In my case, gilp.bnb_visual(lp) returns list, such as [Figure({ 'data': [{'type': 'scatter', 'visible': False, 'x': [9.1], 'y': [20.8]}, {'hoverinfo': 'none', 'line': {'color': 'black', 'width': 1}, 'mode': 'lines', 'showlegend': False, 'type': 'scatter', 'x': [],... ... ] Is there a solution?

henryrobbins commented 3 years ago

The function bnb_visual(lp) returns a list of plotly plots. There is a separate plot for each iteration of branch and bound. You can then use .show() to show one of the plots.

For example,

nodes = gilp.bnb_visual(gilp.examples.STANDARD_2D_IP)

# plot each of the iterations
for node in nodes:
     node.show()

# show the final iteration with the full branch and bound tree
nodes[-1].show()