Skip to content

0xdevalias/poc-linear-programming

Repository files navigation

poc-linear-programming

Proof of Concept (PoC) code/notes exploring using linear programming and similar for optimisation.

Usage

First time setup:

⇒ pyenv virtualenv 3.10.2 poc-linear-programming

⇒ pyenv local poc-linear-programming

⇒ pip install -r requirements.txt

Main:

⇒ python -m optimize_bottles_min_leftover_units_or_cost -h
usage: optimize_bottles_min_leftover_units_or_cost.py [-h] [--min-stacks MIN_STACKS] [--max-stacks MAX_STACKS] [--mode {leftover_units,leftover_units_cost}]

Optimize supplement purchasing strategy.

options:
  -h, --help            show this help message and exit
  --min-stacks MIN_STACKS
                        Minimum number of stacks (default: 7 * 4 days)
  --max-stacks MAX_STACKS
                        Maximum number of stacks (default: 7 * 4 * 2 days)
  --mode {leftover_units,leftover_units_cost}
                        Optimization mode: 'leftover_units' or 'leftover_units_cost' (default: 'leftover_units_cost')

Main + adjusted_leftover_units/adjusted_leftover_units_cost (optimise on leftover units/cost of purchased bottles rather than total):

⇒ python -m optimize_bottles_min_leftover_units_or_cost_of_leftover_bought -h
usage: 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}]

Optimize supplement purchasing strategy.

options:
  -h, --help            show this help message and exit
  --min-stacks MIN_STACKS
                        Minimum number of stacks (default: 7 * 4 days)
  --max-stacks MAX_STACKS
                        Maximum number of stacks (default: 7 * 4 * 2 days)
  --mode {leftover_units,leftover_units_cost,adjusted_leftover_units,adjusted_leftover_units_cost}
                        Optimization mode (default: 'leftover_units_cost')

Other/legacy:

# Seemingly not super useful
python -m optimize_bottles_min_leftover_units_constrain_usage_pct

# Legacy
python -m legacy.lcm_bottles
python -m legacy.lcm_bottles_with_max
python -m legacy.optimize_supplements_w1_max_stacks_constrain_usage_pct
python -m legacy.optimize_supplements_w1_max_stacks_constrain_usage_pct_last_bottle
python -m legacy.optimize_supplements_w2_max_stacks_min_leftovers
python -m legacy.optimize_supplements_w2_max_stacks_min_leftovers_constrain_weekly
python -m legacy.optimize_supplements_w3_max_stacks_min_leftover_cost_min_total_cost
python -m legacy.optimize_supplements_w3_max_stacks_min_leftover_cost_min_total_cost_constrain_usage_pct
python -m legacy.optimize_supplements_w3_max_stacks_min_leftovers_min_total_cost

Extra random things (may not be linear programming based, but still relates to some form of optimisation problem):

# Playing with Neighbour’s Ladder (Applied Optimization)
python shortest-ladder.py
python shortest-ladder-2.py

See Also

My Other Related Deepdive Gist's and Projects

About

Proof of Concept (PoC) code/notes exploring using linear programming and similar for optimisation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages