{"id":16328062,"url":"https://github.com/terminaldweller/simplex","last_synced_at":"2025-07-19T22:34:44.580Z","repository":{"id":206077998,"uuid":"495839912","full_name":"terminaldweller/simplex","owner":"terminaldweller","description":"Yet another simplex implementation in python","archived":false,"fork":false,"pushed_at":"2023-01-29T20:56:21.000Z","size":192,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-10T06:13:39.058Z","etag":null,"topics":["big-m","simplex"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/terminaldweller.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-24T13:39:44.000Z","updated_at":"2023-11-07T19:05:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"3f39b788-b7cb-4d54-8141-69ec763214fe","html_url":"https://github.com/terminaldweller/simplex","commit_stats":null,"previous_names":["terminaldweller/simplex"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/terminaldweller/simplex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terminaldweller%2Fsimplex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terminaldweller%2Fsimplex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terminaldweller%2Fsimplex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terminaldweller%2Fsimplex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terminaldweller","download_url":"https://codeload.github.com/terminaldweller/simplex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terminaldweller%2Fsimplex/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266031726,"owners_count":23866816,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["big-m","simplex"],"created_at":"2024-10-10T23:13:37.617Z","updated_at":"2025-07-19T22:34:44.537Z","avatar_url":"https://github.com/terminaldweller.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- [![Codacy Badge](https://app.codacy.com/project/badge/Grade/5fd619053adf4ce88c4333e306aafa4a)](https://www.codacy.com/gh/terminaldweller/simplex/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=terminaldweller/simplex\u0026amp;utm_campaign=Badge_Grade) --\u003e\n\u003c!-- [![Total alerts](https://img.shields.io/lgtm/alerts/g/terminaldweller/simplex.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/terminaldweller/simplex/alerts/) --\u003e\n\n# Simplex\n\nA python package that solve linear programming problems using the simplex method.\u003cbr/\u003e\nFeatures:\u003cbr/\u003e\n* The Problem is input into the program by a file containing python expression.\u003cbr/\u003e\n* Solves both min and max problems(duh!).\u003cbr/\u003e\n* Uses the big M method to find a basic feasible solution when there are none available in the original program.\u003cbr/\u003e\n* Handles adding slack variables to convert the problem into standard form.\u003cbr/\u003e\n* Uses the lexicographic rule to prevent ending up in a loop due to degenerate extreme points.\u003cbr/\u003e\n* outputs in html.\u003c/br\u003e\n\nRun Help to get a list of available commandline options.\u003cbr/\u003e\n```sh\n./test.py --help                                                                                                                                                                             [INSERT] 32mS 0↵ L3\nusage: test.py [-h] [--equs EQUS] [--csv CSV] [--delim DELIM] [--slack SLACK] [--aux AUX] [--iter ITER] [--min] [--verbose] [--debug] [--out] [--numba]\n\noptions:\n  -h, --help            show this help message and exit\n  --equs EQUS, -e EQUS  the path to the file containing the equations\n  --csv CSV, -c CSV     the path to the CSV file containing the problem\n  --delim DELIM, -l DELIM\n                        the separator for the csv file\n  --slack SLACK, -s SLACK\n                        slack variable base name, names are cretedby adding a number to the string\n  --aux AUX, -a AUX     aux variable base name, names are cretedby adding a number to the string\n  --iter ITER, -i ITER  maximum number of iterations\n  --min, -m             determines whether its a minimization problem.if not, its a maximization problem\n  --verbose, -v         whether to print output verbosely\n  --debug, -d           whether to print debug info\n  --out, -o             path to the output file\n  --numba, -n           whether to print debug info]q\n```\n\nExample usage:\u003cbr/\u003e\n```sh\ndsimplex -e ./tests/equ6.py -a xa -v -s z -m\n```\n\n## The Equation File\ndsimplex currently accepts two input formats:\u003c/br\u003e\n\n### Python Expressions\nEach equation in the equations file should a valid python expression. There are a couple notes though:\u003cbr/\u003e\n* For conditions that end in equality you must use `==` instead of `=` to make it a legal python expression.\n* Nothing will be evaluated so writing something like `4/5*x1` is illegal. Use `.8*x1` instead.\n* You can use comments inside the equations file. They are the same format as the python comments.\n* The cost equation is one without a binary comparison operator, e.g. `\u003c=,\u003c,\u003e=,\u003e`.\n* The order of the equations in the equations file is not important. You can put them in in any order you want.\nAs an example:\u003cbr/\u003e\n```py\n# cyclic test\n-0.75 * x4 + 20 * x5 - 0.5 * x6 + 6 * x7\nx1 + 0.25 * x4 - 8 * x5 - x6 + 9 * x7 == 0\nx2 + 0.5 * x4 - 12 * x5 - 0.5 * x6 + 3 * x7 == 0\nx3 + x6 == 1\nx1 \u003e= 0\nx2 \u003e= 0\nx3 \u003e= 0\nx4 \u003e= 0\nx5 \u003e= 0\nx6 \u003e= 0\nx7 \u003e= 0\n```\n\n### CSV\n* The order of the equations is not important. It is also not important where the cost function is in the csv file as long as it is there.\n* The variables with zero coefficients should be left empty.\n```csv\nx1,x2,x3,x4,x5,x6,x7,cond,rhs\n,,,-0.75,20,-0.5,6,,\n1,,,0.25,-8,-1,9,=,0\n,1,,0.5,-12,-0.5,3,=,0\n,,1,,,1,,=,1\n1,,,,,,,\u003e=,0\n,1,,,,,,\u003e=,0\n,,1,,,,,\u003e=,0\n,,,1,,,,\u003e=,0\n,,,,1,,,\u003e=,0\n,,,,,1,,\u003e=,0\n,,,,,,1,\u003e=,0\n```\n```csv\nx1,x2,x3,x4,x5,x6,x7,cond,rhs\n,,,-0.75,20,-0.5,6,,\n1,,,0.25,-8,-1,9,=,0\n,1,,0.5,-12,-0.5,3,=,0\n,,1,,,1,,=,1\n1,,,,,,,\u003e=,0\n,1,,,,,,\u003e=,0\n,,1,,,,,\u003e=,0\n,,,1,,,,\u003e=,0\n,,,,1,,,\u003e=,0\n,,,,,1,,\u003e=,0\n,,,,,,1,\u003e=,0\nnull,,,,,,,,\n,,,-0.75,20,-0.5,6,,\n1,,,0.25,-8,-1,9,=,0\n,1,,0.5,-12,-0.5,3,=,0\n,,1,,,1,,=,1\n1,,,,,,,\u003e=,0\n,1,,,,,,\u003e=,0\n,,1,,,,,\u003e=,0\n,,,1,,,,\u003e=,0\n,,,,1,,,\u003e=,0\n,,,,,1,,\u003e=,0\n,,,,,,1,\u003e=,0\nnull,,,,,,,,\n,,,-0.75,20,-0.5,6,,\n1,,,0.25,-8,-1,9,=,0\n,1,,0.5,-12,-0.5,3,=,0\n,,1,,,1,,=,1\n1,,,,,,,\u003e=,0\n,1,,,,,,\u003e=,0\n,,1,,,,,\u003e=,0\n,,,1,,,,\u003e=,0\n,,,,1,,,\u003e=,0\n,,,,,1,,\u003e=,0\n,,,,,,1,\u003e=,0\nnull,,,,,,,,\n,,,-0.75,20,-0.5,6,,\n1,,,0.25,-8,-1,9,=,0\n,1,,0.5,-12,-0.5,3,=,0\n,,1,,,1,,=,1\n1,,,,,,,\u003e=,0\n,1,,,,,,\u003e=,0\n,,1,,,,,\u003e=,0\n,,,1,,,,\u003e=,0\n,,,,1,,,\u003e=,0\n,,,,,1,,\u003e=,0\n,,,,,,1,\u003e=,0\n```\n```csv\nx1,x2,x3,condition,rhs\n1,1,-4,,\n1,1,2,\u003c=,9\n1,1,-1,\u003c=,2\n-1,1,1,\u003c=,4\n1,,,\u003e=,0\n,1,,\u003e=,0\n,,1,\u003e=,0\nx1,x2,cond,rhs\n1,-2,,\n1,1,\u003e=,2\n-1,1,\u003e=,1\n,1,\u003c=,3\n1,,\u003e=,0\n,1,\u003e=,0\nx1,x2,x3,x4,x5,x6,x7,cond,rhs\n,,,-0.75,20,-0.5,6,,\n1,,,0.25,-8,-1,9,=,0\n,1,,0.5,-12,-0.5,3,=,0\n,,1,,,1,,=,1\n1,,,,,,,\u003e=,0\n,1,,,,,,\u003e=,0\n,,1,,,,,\u003e=,0\n,,,1,,,,\u003e=,0\n,,,,1,,,\u003e=,0\n,,,,,1,,\u003e=,0\n,,,,,,1,\u003e=,0\n```\n\n## How to Get\nYou first need to install tkinter.\u003c/br\u003e\nYou can get tkinter from you distro's repo.\u003c/br\u003e\nThen you can get dsimplex from [pypi](https://pypi.org/project/dsimplex/):\u003cbr/\u003e\n```sh\npip3 install dsimplex\n```\nOr you can clone this repo and run it like that:\u003cbr/\u003e\n```sh\ngit clone https://github.com/terminaldweller/simplex \u0026\u0026 cd simplex \u0026\u0026 poetry install\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterminaldweller%2Fsimplex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterminaldweller%2Fsimplex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterminaldweller%2Fsimplex/lists"}