Skip to content

Chase-Projects/optimize_amino

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Optimize Amino

A linear-programming sketch of vegan protein. The site frames daily nutrition as an LP — minimize cost, subject to the nine essential amino acids — and then lets you solve your own pantry against it.

Live: https://chasevarga.com/optimize_amino/

Pages

Page What it is
index.html Essay: model, scenarios, 2D LP graph, embedded mini-tool
solver.html Full solver — every option (patterns, balanced mode, supplements)
simple.html High-contrast, semantic-HTML solver (WCAG-friendly)
grains.html Pantry guide: grains in the AA-LP
legumes.html Pantry guide: legumes
protein-powder.html Pantry guide: isolates
milk.html Pantry guide: plant milks
seitan.html Pantry guide: wheat gluten

Every page links to every other page via the shared SiteFooter.

Stack

Static. React 18 + Babel standalone are loaded from unpkg; JSX is transpiled in the browser. The LP is a Big-M simplex written from scratch (data.jsx::lpSolveMeal). Food records ship as a static JS file (foods-usda.js) generated once from USDA FoodData Central.

data.jsx                # LP, targets, FOODS, supplements
foods-usda.js           # eager USDA food table (regenerated by build_foods.py)
v2-ui.jsx               # shared visual primitives (theme, stickers, bars)
v2-nav.jsx              # TopNav (sticky)
v2-footer.jsx           # SiteFooter (shared across all pages)
v2-graph.jsx            # 2D LP feasibility-polygon diagram
v2-tool.jsx             # MiniTool (sticker-themed solver UI + receipt)
v2-page.jsx             # V2Intro essay layout
v2-category.jsx         # CategoryPage template
v2-category-data.jsx    # CATEGORY_CONFIGS
v2-solver-page.jsx      # SolverPage wrapper
simple.jsx              # Accessible/semantic SimplePage
build_foods.py          # One-shot USDA fetcher (USDA_API_KEY env var)

Run locally

No build step. From the repo root:

python3 -m http.server 8000
# → http://localhost:8000/

Rebuilding the food table

export USDA_API_KEY=...                       # FoodData Central key
python3 build_foods.py > foods-usda.js

The LP, in one paragraph

Variables are grams of each food in the pantry plus a pseudo-food for every essential amino acid (and a BCAA blend). Constraints require each AA to clear its FAO/NAM/NNR requirement scaled by body weight and meal fraction. The objective is total cost. Supplements have their real retail cost multiplied by a tunable factor (default 10×) so the solver only reaches for them when nothing in the pantry can cover the shortfall — which keeps the LP always feasible, while letting gaps stay visible on the receipt.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors