Skip to main content

Simplex dictionary

Python Versions License Build Status

simplex is a small python module that implements a simplex_dictionary structure representing a dictionary for the Simplex algorithm. The package is intended for educational purpose, e.g., to have students implement the Simplex algorithm based on the structure.

Basic usage

The following code creates a simplex dictionary with 5 variables:

from simplex import simplex_dictionary

# The list of variables (can be anything):
x1, x2, x3, x4, x5 = ('x_{}'.format(i + 1) for i in range(5))
variables = [x1, x2, x3, x4, x5]

# The simplex dictionary with B = (x3, x4, x5):
sdict = simplex_dictionary(B=[x3, x4, x5], N=[x1, x2])

# Set the values of the basic variables:
sdict.b = {x3: 18, x4: 42, x5: 24}

# Coefficients of the non-basic variables in the dictionary (we represent
# the positive coefficients):
sdict.a = {
    x3: {x1: 2, x2: 1},
    x4: {x1: 2, x2: 3},
    x5: {x1: 3, x2: 1}
}

# Current value of the objective:
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:

sdict.display(name='S_0')

Release files for simplex-dictionary 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simplex-dictionary 0.0.1
File Size Uploaded
simplex-dictionary-0.0.1.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simplex-dictionary 0.0.1
File Interpreter ABI Platform
simplex_dictionary-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.4 kB

Release files / simplex-dictionary-0.0.1.tar.gz

Download URL simplex-dictionary-0.0.1.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4f7d52ffa97da8aac9f5ad60e7411337286897f48c9fbfc6f27fe7335be5b05c
BLAKE2b-256 checksum
How to use checksums
328dcc8a9047c7a94420a76362a8d19e8d2cbb87ef03be99b7306db217b7fc40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.2

Release files / simplex_dictionary-0.0.1-py3-none-any.whl

Download URL simplex_dictionary-0.0.1-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba0ff4f8c5583b57216ccf7a270c11cd49d688340c9780f476271cdb8479a28e
BLAKE2b-256 checksum
How to use checksums
1d0d27adab00f9fadf01dcc70168c261296aefc1aabf6d726d3d75dff74252b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.2

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page