Skip to content

Commit

Permalink
Updated README and updated html and image examples in docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
henryrobbins committed Nov 3, 2020
1 parent 8e2857a commit 7fbe40c
Show file tree
Hide file tree
Showing 24 changed files with 170 additions and 72 deletions.
40 changes: 23 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
# GILP

[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://lbesson.mit-license.org/)
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/gilp.svg)](https://pypi.python.org/pypi/gilp/)
[![CircleCI](https://circleci.com/gh/circleci/circleci-docs.svg?style=shield)](https://app.circleci.com/pipelines/github/henryrobbins/gilp)
[![Documentation Status](https://readthedocs.org/projects/gilp/badge/?version=latest)](https://gilp.readthedocs.io/en/latest/?badge=latest)
[![codecov](https://codecov.io/gh/henryrobbins/gilp/branch/master/graphs/badge.svg)](https://codecov.io/gh/henryrobbins/gilp)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/henryrobbins/gilp)
[![PyPI download month](https://img.shields.io/pypi/dm/gilp.svg)](https://pypi.python.org/pypi/gilp/)

GILP (Geometric Interpretation of Linear Programs) is a Python package for
visualizing the geometry of [linear programs](https://en.wikipedia.org/wiki/Linear_programming) (LPs) and the [simplex algorithm](https://en.wikipedia.org/wiki/Simplex_algorithm). LPs can be constructed from NumPy arrays and many examples
visualizing the geometry of:

- [Linear Programs](https://en.wikipedia.org/wiki/Linear_programming) (LPs)
- [The Simplex Algorithm](https://en.wikipedia.org/wiki/Simplex_algorithm)
- [The Branch and Bound Algorithm](https://en.wikipedia.org/wiki/Branch_and_bound)

LPs can be constructed from NumPy arrays and many examples
(such as the [Klee-Minty cube](https://en.wikipedia.org/wiki/Klee%E2%80%93Minty_cube))
are included. The revised simplex method is implemented along with various pivot
rules (such as [Bland's](https://en.wikipedia.org/wiki/Bland%27s_rule)
and Dantzig's). Additionally, an initial feasible solution and iteration limit
may be set. The package relies on [Plotly](https://plotly.com/python/) to generate standalone HTML files which can be viewed in a Jupyter
Notebook inline or in a web browser.
are included. The revised simplex method is implemented along with phase I for finding
an initial feasible solution. The package relies on [Plotly](https://plotly.com/python/)
to generate standalone HTML files which can be viewed in a Jupyter Notebook
inline or in a web browser.

![Output](images/ALL_INTEGER_3D_LP.png?raw=true "Output")
## Examples

![2d simplex example](images/LIMITING_CONSTRAINT_2D_LP.png?raw=true)
![3d simplex example](images/ALL_INTEGER_3D_LP.png?raw=true)
![2d branch and bound example](images/branch_and_bound_2d.png?raw=true)
![3d branch and bound example](images/branch_and_bound_3d.png?raw=true)

## Installation

Expand Down Expand Up @@ -76,7 +84,7 @@ For example, consider the following LP:
The LP instance is created as follows.

```python
from gilp.simplex import LP
import gilp

A = np.array([[2, 1],
[1, 1],
Expand All @@ -92,23 +100,22 @@ lp = LP(A,b,c)
After creating an LP, one can run simplex and generate a visualization with

```python
from gilp.visualize import simplex_visual
simplex_visual(lp)
gilp.simplex_visual(lp)]
```

where ```simplex_visual()``` returns a plotly figure. The figure can then be
viewed on a Jupyter Notebook inline using

```python
simplex_visual(lp).show()
gilp.simplex_visual(lp).show()
```

If ```.show()``` is run outside a Jupyter Notebook enviroment, the visualization
will open up in the browser. Alternatively, the HTML file can be written and then
opened.

```python
simplex_visual(lp).write_html('name.html')
gilp.simplex_visual(lp).write_html('name.html')
```

Below is the visualization for the example LP. The plot on the left shows the
Expand All @@ -119,9 +126,8 @@ tableaus. The objective slider lets one see the objective line or plane for
some range of objective values.


![Output](images/ALL_INTEGER_2D_LP.png?raw=true "Output")
![2d simplex example](images/ALL_INTEGER_2D_LP.png?raw=true)

## License

Licensed under the [MIT License](https://choosealicense.com/licenses/mit/)

12 changes: 6 additions & 6 deletions docs/examples/ALL_INTEGER_2D_LP.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/examples/ALL_INTEGER_3D_LP.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/examples/DEGENERATE_FIN_2D_LP.html

Large diffs are not rendered by default.

85 changes: 85 additions & 0 deletions docs/examples/DODECAHEDRON_3D_LP.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/examples/KLEE_MINTY_2D_LP.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/examples/KLEE_MINTY_3D_LP.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/examples/LIMITING_CONSTRAINT_2D_LP.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/examples/MULTIPLE_OPTIMAL_3D_LP.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/examples/SQUARE_PYRAMID_3D_LP.html

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions docs/examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,10 @@ algorithm?"

.. raw:: html
:file: KLEE_MINTY_3D_LP.html

Dodecahedron 3D LP
------------------
A 3D LP with feasible region in the shape of a regular dodecahedron.

.. raw:: html
:file: DODECAHEDRON_3D_LP.html
12 changes: 6 additions & 6 deletions docs/quickstart_guide/feasible_region.html

Large diffs are not rendered by default.

Binary file modified images/ALL_INTEGER_2D_LP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/ALL_INTEGER_3D_LP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/DEGENERATE_FIN_2D_LP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/DODECAHEDRON_3D_LP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/KLEE_MINTY_2D_LP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/KLEE_MINTY_3D_LP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/LIMITING_CONSTRAINT_2D_LP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/MULTIPLE_OPTIMAL_3D_LP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/SQUARE_PYRAMID_3D_LP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/branch_and_bound_2d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/branch_and_bound_3d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="gilp",
version="1.0.0rc1",
version="1.0.0rc2",
author="Henry Robbins",
author_email="hwr26@cornell.edu",
description="A Python package for visualizing the geometry of linear programs.",
Expand Down

0 comments on commit 7fbe40c

Please sign in to comment.