This commit is contained in:
parent
33bf6496c9
commit
fe61c179cd
@ -7,4 +7,5 @@ steps:
|
||||
- name: python-tests
|
||||
image: themattrix/tox
|
||||
commands:
|
||||
- tox
|
||||
# python 3.9 is not included in themattrix/tox yet
|
||||
- tox -e py36,py37,py38,py36-lint,py37-lint,py38-lint
|
||||
|
20
README.md
20
README.md
@ -1,13 +1,16 @@
|
||||
# Simplex dictionary
|
||||
|
||||
[![Python Versions](https://img.shields.io/badge/python-3.6%20|%203.7-blue.svg)](https://img.shields.io/badge/python-3.6%20|%203.7-blue.svg)
|
||||
[![Python Versions](https://img.shields.io/badge/python-3.6%20|%203.7-blue.svg)](https://img.shields.io/badge/python-3.6%20|%203.7%20|%203.8%20|%203.9-blue.svg)
|
||||
[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://img.shields.io/badge/license-MIT-green.svg)
|
||||
[![Build Status](https://drone.typename.fr/api/badges/mikael.capelle/simplex/status.svg)](https://drone.typename.fr/mikael.capelle/simplex)
|
||||
|
||||
`simplex` is a small python module that implements a `simplex_dictionary` structure representing
|
||||
a dictionary for the [Simplex algorithm](https://en.wikipedia.org/wiki/Simplex_algorithm).
|
||||
`simplex` is a small python module that implements a `simplex_dictionary` structure
|
||||
representing a dictionary for the
|
||||
[Simplex algorithm](https://en.wikipedia.org/wiki/Simplex_algorithm).
|
||||
The package is intended for educational purpose, e.g., to have students implement the
|
||||
Simplex algorithm based on the structure.
|
||||
|
||||
# Basic usage
|
||||
## Basic usage
|
||||
|
||||
The following code creates a simplex dictionary with 5 variables:
|
||||
|
||||
@ -38,10 +41,15 @@ sdict.z = 0
|
||||
# Coefficients of the non-basic variables in the objective function:
|
||||
sdict.c[x1] = 3
|
||||
sdict.c[x2] = 2
|
||||
|
||||
# Trying to set the coefficients for a basic variables that should be 0 raise an
|
||||
# exception:
|
||||
sdict.c[x3] = 4 # raises "x_3 is not a non-basic variable."
|
||||
sdict.b[x1] = 1 # raises "x_1 is not a basic variable."
|
||||
```
|
||||
|
||||
When using the `simplex` module within a jupyter notebook, the `display()` method outputs
|
||||
a latex version of the dictionary:
|
||||
When using the `simplex` module within a jupyter notebook, the `display()` method
|
||||
outputs a latex version of the dictionary:
|
||||
|
||||
```python
|
||||
sdict.display(name='S_0')
|
||||
|
@ -9,14 +9,11 @@ extend-ignore =
|
||||
warn_return_any = True
|
||||
warn_unused_configs = True
|
||||
|
||||
[mypy-pytest.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-IPython.*]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[tox:tox]
|
||||
envlist = py{36,37,38},py{36,37,38}-lint
|
||||
envlist = py{36,37,38,39},py{36,37,38,39}-lint
|
||||
|
||||
[testenv]
|
||||
deps =
|
||||
@ -24,13 +21,14 @@ deps =
|
||||
commands =
|
||||
pytest tests
|
||||
|
||||
[testenv:py{36,37,38}-lint]
|
||||
[testenv:py{36,37,38,39}-lint]
|
||||
deps =
|
||||
black
|
||||
flake8
|
||||
flake8-black
|
||||
mypy
|
||||
isort
|
||||
|
||||
commands =
|
||||
black --check --diff setup.py simplex tests
|
||||
flake8 simplex tests
|
||||
|
2
setup.py
2
setup.py
@ -8,7 +8,7 @@ with open("README.md", "r") as fh:
|
||||
test_requires = ["pytest", "mypy", "black", "flake8", "flake8-black"]
|
||||
|
||||
setuptools.setup(
|
||||
name="simplex", # Replace with your own username
|
||||
name="simplex-dictionary",
|
||||
version="0.0.1",
|
||||
author="Mikaël Capelle",
|
||||
author_email="capelle.mikael@gmail.com",
|
||||
|
@ -1,4 +1,3 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
|
||||
from .simplex_dictionary import simplex_dictionary # noqa: F401
|
||||
|
0
simplex/py.typed
Normal file
0
simplex/py.typed
Normal file
Loading…
Reference in New Issue
Block a user