Skip to main content

Linear Programming Solver and Sensitivity Analysis Toolkit

Project description

LinProg

Linear Programming Solver and Sensitivity Analysis Toolkit.

Installation

pip install linprog

Example

# ============================================================
# Example
# max 3x1 + 5x2
#
# s.t.
# x1          <= 4
#      2x2    >= 8
# 3x1 + 2x2   <= 18
# x1 + x2     == 7
# x1, x2 >= 0
# ============================================================
from linprog import LinearProgram

lp = LinearProgram(
    c=[3,5],
    A=[
        [1,0],
        [0,2],
        [3,2],
        [1,1]
    ],
    senses=["<=",">=","<=","=="],
    b=[4,8,18,7],
    objective="max",
    bounds=[(0, None), (0, None)],
    var_names=["x1", "x2"],
    con_names=["cte1", "cte3", "cte3", "cte4"],
)

lp.solve()
# display the linear program model
print(lp.reportModel())
# display the linear program in standard form
print(lp.reportStandardModelFormat())
# display the linear program in matrix form
print(lp.reportMatrixFormat())
# solution of the linear program
print(lp.solution)
# display the solution
print(lp.reportSolution())
# display the sensitivity analysis
print(lp.report_sensitive_analysis())

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

linprog-1.2.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

linprog-1.2.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file linprog-1.2.0.tar.gz.

File metadata

  • Download URL: linprog-1.2.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for linprog-1.2.0.tar.gz
Algorithm Hash digest
SHA256 aba3d100e7489c5c96d1ab8323f24379b5074aa3b1b353471e0868f881a0eea8
MD5 9440db2f1b5619bdfaeb9ceaec33f0ba
BLAKE2b-256 300f2701f5602d2844a2801eff83d47ca0db524e755e334a807f946e15d23dfa

See more details on using hashes here.

File details

Details for the file linprog-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: linprog-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for linprog-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d123ef590261c12c5fc63e0a03a8aca649f60e34e87fcb95bb7b912a44a13852
MD5 3c7b90a73614eb95348b65b1b0a3c323
BLAKE2b-256 bc06e415493a76a8c2a08be4ea51be09d7bc58ebea1aeee2188169f2a6bf27e6

See more details on using hashes here.

Supported by

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