|
1 | | -# GrUMPy 0.9.2 |
2 | | - |
3 | | -## Now with Python 3 support! |
| 1 | +# GrUMPy 0.95 |
4 | 2 |
|
5 | 3 | [](https://zenodo.org/badge/latestdoi/18217673) |
6 | 4 |
|
@@ -30,38 +28,40 @@ pip install coinor.grumpy |
30 | 28 | ``` |
31 | 29 |
|
32 | 30 | 1. GrUMPy depends on [GiMPy](https://github.com/coin-or/GiMPy), which will be automatically installed as part of the setup. However, in order for GiMPy to visualize the branch-and-bound tree, it's necessary to install [GraphViz](http://www.graphviz.org) and choose one of these additional methods for display: |
33 | | - * Recommended: [xdot 0.6](https://pypi.python.org/pypi/xdot). |
34 | | - * Install with `pip install xdot==0.6` |
35 | | - * Call `set_display_mode('xdot')` |
36 | | - Note that xdot 0.6 depends on [PyGtk](http://www.pygtk.org/) (see below for platform-specific installation instructions for installing). |
37 | | - * [Python Imaging Library](http://www.pythonware.com/products/pil/) and call `set_display_mode('PIL')` |
38 | | - * [Pygame](pygame.org) and call `set_display_mode('pygame')` |
39 | | - * Call `set_display_mode('file')` to just write files to disk that have to then be opened manually. |
| 31 | + * Recommended: [matplotlib](https://pypi.org/project/matplotlib/) and call |
| 32 | + `set_display_mode('matplotlib') |
| 33 | + * [Python Imaging Library](http://www.pythonware.com/products/pil/) and |
| 34 | + call `set_display_mode('PIL')` |
| 35 | + * Call `set_display_mode('file')` to just write files to disk that have to |
| 36 | + then be opened manually. |
40 | 37 |
|
41 | | - It is also possible to typeset labels in LaTex and to output the graph in LaTex format using `dot2tex` (**Warning**: recent versions of `dot2tex` have not perfectly, your mileage may vary). After installing `dot2tex`, this can be done by simply calling the method `write(basename='fileName', format='dot')`, and then doing `dot2tex --tmath fileName.dot` or by calling `set_display_mode('dot2tex')` and then `display()` as usual. At the moment, the latter only seems to work with version `2.9.0dev` available [here](https://github.com/Alwnikrotikz/dot2tex). For the former method, just using `easy_install dot2tex` should work fine. |
| 38 | +It is also possible to typeset labels in LaTex and to output the graph in |
| 39 | +LaTex format using `dot2tex` (**Warning**: recent versions of `dot2tex` have |
| 40 | +not perfectly, your mileage may vary). After installing `dot2tex`, this can be |
| 41 | +done by simply calling the method `write(basename='fileName', format='dot')`, |
| 42 | +and then doing `dot2tex --tmath fileName.dot` or by calling |
| 43 | +`set_display_mode('dot2tex')` and then `display()` as usual. At the moment, |
| 44 | +the latter only seems to work with version `2.9.0dev` available |
| 45 | +[here](https://github.com/Alwnikrotikz/dot2tex). For the former method, just |
| 46 | +using `easy_install dot2tex` should work fine. |
| 47 | + |
42 | 48 | 1. GrUMPy also creates some visualizations with [gnuplot](https://sourceforge.net/projects/gnuplot/). For tips on installing `gnuplot`, see below. |
43 | 49 | 1. GrUMPy can also visualize 2D polyhedra with the installation of [pypolyhedron](https://github.com/tkralphs/pypolyhedron), which can be install with `pip install pypolyhedron` |
44 | 50 |
|
45 | 51 | # Additional Notes for Windows Installation |
46 | 52 |
|
47 | 53 | * To install Graphviz, download the installer [here](http://www.graphviz.org/Download.php). **Important**: after installing, you must manually add the graphviz `bin` directory (usually `C:\Program Files (x86)\Graphviz2.38\bin`) to your `PATH` |
48 | | - * If you want to use `xdot`, there are some more requirements: |
49 | | - * Unfortunately, you must have a 32-bit version of Python 2.7 |
50 | | - * You must install the [PyGtk version 2.22.6](http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.22/pygtk-all-in-one-2.22.6.win32-py2.7.msi). Version 2.24 is buggy on Windows. |
51 | | - * To install `gnuplot`, download the installer [here](https://sourceforge.net/projects/gnuplot/). Note that the CYGWIN version of gnuplot may not work when called from Python. |
| 54 | + * To install `gnuplot`, download the installer [here](http://www.gnuplot.info/). Note that the CYGWIN version of gnuplot may not work when called from Python. |
52 | 55 |
|
53 | 56 | # Additional Notes for Linux Installation |
54 | 57 |
|
55 | 58 | * Graphviz can be installed as a package on most Linux distros, e.g., `sudo apt-get install graphviz` |
56 | | - * To use `xdot`, you need to install PyGtk. On Debian/Ubuntu, do `sudo apt-get install python-gtk2` |
57 | | - * Gnuplot should be available for installation with your favorite package manager. |
| 59 | + * Gnuplot should also be available for installation with your favorite package manager. |
58 | 60 |
|
59 | 61 | # Additional Notes for OS X Users |
60 | 62 |
|
61 | 63 | * The situation with Python on OS X is a bit of a mess. It is recommended to install python using [homebrew](http://brew.sh) with `brew install python`). |
62 | | - * With homebbrew, one can also easily install graphviz (`brew install graphviz`), PyGtk (`brew install pygtk`), and gnuplot (`brew install gnuplot`) |
63 | | - |
64 | | -There have been reports of incompatibilities with recent versions of PyGtk, but I have not attempted yet to track this down. If things break, you may try some variant of the instructions above for installing on Windows. |
| 64 | + * With homebbrew, one can also easily install graphviz (`brew install graphviz`) and gnuplot (`brew install gnuplot`) |
65 | 65 |
|
66 | 66 | ## Examples of Visualizations |
67 | 67 |
|
@@ -217,23 +217,12 @@ for line in file: |
217 | 217 | To display the visualizations, do |
218 | 218 |
|
219 | 219 | ```python |
220 | | -import sys |
221 | | -import StringIO |
222 | | -from PIL import Image as PIL_Image |
223 | | - |
224 | | -#BAK-style visualizations |
225 | | - |
226 | | -#gnuplot_image = StringIO.StringIO(bt.GenerateHistogram() |
227 | | -gnuplot_image = StringIO.StringIO(bt.GenerateTreeImage()) |
228 | | -#gnuplot_image = StringIO.StringIO(bt.GenerateScatterplot() |
229 | | -#gnuplot_image = StringIO.StringIO(bt.GenerateIncumbentPath() |
230 | | -#gnuplot_image = StringIO.StringIO(bt.GenerateForecastImages() |
231 | | -im = PIL_Image.open(gnuplot_image) |
232 | | -im.show() |
233 | | - |
234 | | -#GiMPy visualization (GraphViz) |
| 220 | +# BAK style |
| 221 | +bt.set_display_mode('matplotlib') |
| 222 | +bt.display('tree') |
235 | 223 |
|
236 | | -bt.set_display_mode('xdot') |
| 224 | +# Graphviz style |
| 225 | +bt.set_layout('dot') |
237 | 226 | bt.display() |
238 | 227 | ``` |
239 | 228 |
|
|
0 commit comments