Skip to main content

Lippy - solving linear programming problems.

Project description

Lippy

Lippy - solving linear programming problems.

Tests Package version Supported Python versions Total downloads


Source Code: https://github.com/ispaneli/lippy


Lippy is a module for solving linear programming problems on Python.

Provides:

  1. Simplex method in primal linear programming
  2. Simplex method in dual linear programming
  3. Branch and bound in integer linear programming
  4. Brute force method in integer linear programming
  5. Cutting-plane method in integer linear programming
  6. Zero-sum game in game theory using Simplex method

Simplex method in primal linear programming

import lippy as lp


c_vec = [6, 6, 6]
a_matrix = [
    [4, 1, 1],
    [1, 2, 0],
    [0, 0.5, 4]
]
b_vec = [5, 3, 8]

simplex = lp.SimplexMethod(c_vec, a_matrix, b_vec)
solution, func_value = simplex.solve()

Simplex method in dual linear programming

import lippy as lp


c_vec = [6, 6, 6]
a_matrix = [
    [4, 1, 1],
    [1, 2, 0],
    [0, 0.5, 4]
]
b_vec = [5, 3, 8]

c_vec, a_matrix, b_vec = lp.primal_to_dual_lp(c_vec, a_matrix, b_vec)
simplex = lp.SimplexMethod(c_vec, a_matrix, b_vec)
solution, func_value = simplex.solve()

Branch and bound in integer linear programming

import lippy as lp


c_vec = [3, 3, 7]
a_matrix = [
    [1, 1, 1],
    [1, 4, 0],
    [0, 0.5, 3]
]
b_vec = [3, 5, 7]

bab = lp.BranchAndBound(c_vec, a_matrix, b_vec)
solution, func_value = bab.solve()

Brute force method in integer linear programming

import lippy as lp


c_vec = [3, 3, 7]
a_matrix = [
    [1, 1, 1],
    [1, 4, 0],
    [0, 0.5, 3]
]
b_vec = [3, 5, 7]

force = lp.BruteForce(c_vec, a_matrix, b_vec)
solution, func_value = force.solve()

Cutting-plane method in integer linear programming

import lippy as lp


c_vec = [3, 3, 7]
a_matrix = [
    [1, 1, 1],
    [1, 4, 0],
    [0, 0.5, 3]
]
b_vec = [3, 5, 7]

gomory = lp.CuttingPlaneMethod(c_vec, a_matrix, b_vec)
gomory.solve()

Zero-sum game in game theory using Simplex method

import lippy as lp


game_matrix = [
    [8, 1, 17, 8, 1],
    [12, 6, 11, 10, 16],
    [4, 19, 11, 15, 2],
    [17, 19, 6, 17, 16]
]

game = lp.ZeroSumGame(game_matrix)
strategies = game.solve()

Logging

Existing logging modes:

  1. FULL_LOG
  2. MEDIUM_LOG
  3. LOG_OFF (default)

Logging is set when initializing a class object.

For example:

simplex = lp.SimplexMethod(c_vec, a_matrix, b_vec, log_mode=lp.LogMode.FULL_LOG)
bab = lp.BranchAndBound(c_vec, a_matrix, b_vec, log_mode=lp.LogMode.MEDIUM_LOG)

License

This project is licensed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lippy-0.0.5.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

lippy-0.0.5-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file lippy-0.0.5.tar.gz.

File metadata

  • Download URL: lippy-0.0.5.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for lippy-0.0.5.tar.gz
Algorithm Hash digest
SHA256 ac8b4782eb852a45fce1413c4844502cdc59faf688289cb0d9e4561e11938bae
MD5 12d0c233cce60ca5c08cb7b3f31fc7c3
BLAKE2b-256 b71d1678e00420522710d34d6d1767a3e0516837d0b374a897917bc3bd6ccade

See more details on using hashes here.

File details

Details for the file lippy-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: lippy-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for lippy-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8a1a92f0c0e6e84251c70278595003a44f06ebd3197742ee6ffdec4380032ea4
MD5 e4bd8a25e041e4d102f626eaa76056f8
BLAKE2b-256 8b78aca6df391ca0e593cc6e47a629f41cd619a6efeb8844eb7e82a1ba1418af

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page