{"id":17720991,"url":"https://github.com/0xdevalias/poc-linear-programming","last_synced_at":"2025-03-31T13:18:09.656Z","repository":{"id":259196895,"uuid":"862027823","full_name":"0xdevalias/poc-linear-programming","owner":"0xdevalias","description":"Proof of Concept (PoC) code/notes exploring using linear programming and similar for optimisation.","archived":false,"fork":false,"pushed_at":"2024-10-22T07:33:21.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T11:17:43.226Z","etag":null,"topics":["linear-programming","pulp"],"latest_commit_sha":null,"homepage":"https://gist.github.com/0xdevalias/b7ec3eba3d6173c279b3e9ee7068bc4b#linear-programming-optimisation-problems-etc","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0xdevalias.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},"funding":{"github":"0xdevalias","ko_fi":"devalias","custom":["https://buymeacoff.ee/devalias"]}},"created_at":"2024-09-23T22:59:10.000Z","updated_at":"2024-10-22T07:33:24.000Z","dependencies_parsed_at":"2024-10-23T12:23:52.486Z","dependency_job_id":null,"html_url":"https://github.com/0xdevalias/poc-linear-programming","commit_stats":null,"previous_names":["0xdevalias/poc-linear-programming"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xdevalias%2Fpoc-linear-programming","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xdevalias%2Fpoc-linear-programming/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xdevalias%2Fpoc-linear-programming/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xdevalias%2Fpoc-linear-programming/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xdevalias","download_url":"https://codeload.github.com/0xdevalias/poc-linear-programming/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246473279,"owners_count":20783236,"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":["linear-programming","pulp"],"created_at":"2024-10-25T15:30:05.855Z","updated_at":"2025-03-31T13:18:09.618Z","avatar_url":"https://github.com/0xdevalias.png","language":"Python","readme":"# poc-linear-programming\n\nProof of Concept (PoC) code/notes exploring using linear programming and similar for optimisation.\n\n\u003c!-- TOC start (generated with https://bitdowntoc.derlin.ch/) --\u003e\n- [Usage](#usage)\n- [See Also](#see-also)\n  - [My Other Related Deepdive Gist's and Projects](#my-other-related-deepdive-gists-and-projects)\n\u003c!-- TOC end --\u003e\n\n## Usage\n\nFirst time setup:\n\n```shell\n⇒ pyenv virtualenv 3.10.2 poc-linear-programming\n\n⇒ pyenv local poc-linear-programming\n\n⇒ pip install -r requirements.txt\n```\n\nMain:\n\n```shell\n⇒ python -m optimize_bottles_min_leftover_units_or_cost -h\nusage: optimize_bottles_min_leftover_units_or_cost.py [-h] [--min-stacks MIN_STACKS] [--max-stacks MAX_STACKS] [--mode {leftover_units,leftover_units_cost}]\n\nOptimize supplement purchasing strategy.\n\noptions:\n  -h, --help            show this help message and exit\n  --min-stacks MIN_STACKS\n                        Minimum number of stacks (default: 7 * 4 days)\n  --max-stacks MAX_STACKS\n                        Maximum number of stacks (default: 7 * 4 * 2 days)\n  --mode {leftover_units,leftover_units_cost}\n                        Optimization mode: 'leftover_units' or 'leftover_units_cost' (default: 'leftover_units_cost')\n```\n\nMain + `adjusted_leftover_units`/`adjusted_leftover_units_cost` (optimise on leftover units/cost of purchased bottles rather than total):\n\n```shell\n⇒ python -m optimize_bottles_min_leftover_units_or_cost_of_leftover_bought -h\nusage: optimize_bottles_min_leftover_units_or_cost_of_leftover_bought.py [-h] [--min-stacks MIN_STACKS] [--max-stacks MAX_STACKS] [--mode {leftover_units,leftover_units_cost,adjusted_leftover_units,adjusted_leftover_units_cost}]\n\nOptimize supplement purchasing strategy.\n\noptions:\n  -h, --help            show this help message and exit\n  --min-stacks MIN_STACKS\n                        Minimum number of stacks (default: 7 * 4 days)\n  --max-stacks MAX_STACKS\n                        Maximum number of stacks (default: 7 * 4 * 2 days)\n  --mode {leftover_units,leftover_units_cost,adjusted_leftover_units,adjusted_leftover_units_cost}\n                        Optimization mode (default: 'leftover_units_cost')\n```\n\nOther/legacy:\n\n```shell\n# Seemingly not super useful\npython -m optimize_bottles_min_leftover_units_constrain_usage_pct\n\n# Legacy\npython -m legacy.lcm_bottles\npython -m legacy.lcm_bottles_with_max\npython -m legacy.optimize_supplements_w1_max_stacks_constrain_usage_pct\npython -m legacy.optimize_supplements_w1_max_stacks_constrain_usage_pct_last_bottle\npython -m legacy.optimize_supplements_w2_max_stacks_min_leftovers\npython -m legacy.optimize_supplements_w2_max_stacks_min_leftovers_constrain_weekly\npython -m legacy.optimize_supplements_w3_max_stacks_min_leftover_cost_min_total_cost\npython -m legacy.optimize_supplements_w3_max_stacks_min_leftover_cost_min_total_cost_constrain_usage_pct\npython -m legacy.optimize_supplements_w3_max_stacks_min_leftovers_min_total_cost\n```\n\nExtra random things (may not be linear programming based, but still relates to some form of optimisation problem):\n\n```shell\n# Playing with Neighbour’s Ladder (Applied Optimization)\npython shortest-ladder.py\npython shortest-ladder-2.py\n```\n\n## See Also\n\n### My Other Related Deepdive Gist's and Projects\n\n- [Linear Programming, Optimisation Problems, etc (0xdevalias gist)](https://gist.github.com/0xdevalias/b7ec3eba3d6173c279b3e9ee7068bc4b#linear-programming-optimisation-problems-etc)\n","funding_links":["https://github.com/sponsors/0xdevalias","https://ko-fi.com/devalias","https://buymeacoff.ee/devalias"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xdevalias%2Fpoc-linear-programming","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xdevalias%2Fpoc-linear-programming","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xdevalias%2Fpoc-linear-programming/lists"}