Scaffold Bayesian-optimization script with honegumi + customized tensegrity campaign#30
Scaffold Bayesian-optimization script with honegumi + customized tensegrity campaign#30sgbaird-alt with Copilot wants to merge 10 commits into
Conversation
Agent-Logs-Url: https://github.com/vertical-cloud-lab/tensegrity-optimization/sessions/80628ae5-57f5-4adc-b6d1-7afc176dd978 Co-authored-by: sgbaird-alt <71569943+sgbaird-alt@users.noreply.github.com>
|
@copilot per your best judgement, incorporate #24 and other mentions of specific variables and objectives mentioned in: The undergraduate mentoring grant proposal: https://github.com/vertical-cloud-lab/tensegrity-optimization/blob/main/proposal.pdf Verify that it runs. If you haven't already, use reasonable assumptions for dummy objective function(s) |
… objectives Agent-Logs-Url: https://github.com/vertical-cloud-lab/tensegrity-optimization/sessions/ed162ef1-2fc0-45ee-825e-70b5148e4bf8 Co-authored-by: sgbaird <45469701+sgbaird@users.noreply.github.com>
Done in f6f3af8. Added
Sticking with PLA + TPU (the spec in all three PDFs); PR #24's PETG variant can be added later as an extra categorical. The dummy Verified: |
Agent-Logs-Url: https://github.com/vertical-cloud-lab/tensegrity-optimization/sessions/567de152-0262-4bf4-8075-8edbd316ece8 Co-authored-by: sgbaird-yolo <235173974+sgbaird-yolo@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds an initial Bayesian-optimization code path under bo/ using honegumi to generate a regenerable Ax/BoTorch scaffold, plus a hand-written “real campaign” script that encodes the project’s tensegrity design variables/objectives and runs end-to-end with a synthetic evaluator.
Changes:
- Introduces
bo/generate_scaffold.pyto render a pinned-version honegumi Ax scaffold (bo/tensegrity_bo.py) and a smoke-test rendering mode. - Adds
bo/tensegrity_campaign.py, a customized multi-objective Ax campaign with the project’s design space + objectives and a dummy evaluator to enable immediate iteration. - Adds BO-focused README/docs, requirements pins, and pytest smoke tests; updates repo README and
.gitignoreaccordingly.
Reviewed changes
Copilot reviewed 8 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents the new bo/ directory and basic usage commands. |
| .gitignore | Ignores Python caches and the generated BO campaign plot artifact. |
| bo/init.py | Marks bo as a package for imports/tests. |
| bo/generate_scaffold.py | Wraps honegumi rendering; adds --smoke-test generation path. |
| bo/tensegrity_bo.py | Generated honegumi Ax scaffold script committed to repo. |
| bo/tensegrity_campaign.py | Customized Ax MOO campaign with real variables/objectives + dummy evaluator + plotting. |
| bo/requirements.txt | Adds pinned dependencies for the BO scaffold/campaign. |
| bo/README.md | Documents scaffold regen, customized campaign, and customization checklist. |
| bo/tests/init.py | Marks tests as a package. |
| bo/tests/test_generate_scaffold.py | Smoke tests for engine build + rendered script structure + iteration count. |
| bo/tests/test_tensegrity_campaign.py | Smoke tests for dummy evaluator, search space, and a short Ax run. |
| ax-platform==0.4.3 | ||
| numpy<2 | ||
| pandas<2.3 | ||
| matplotlib |
| ax_client.attach_trial(parameterization) | ||
| ax_client.complete_trial(trial_index=i, raw_data=y_train[i]) |
| @pytest.mark.slow | ||
| def test_main_short_run_completes(capsys): | ||
| # The default (no --full) runs 5 BO iterations with batch size 2 on top of | ||
| # the pilot seed. We pass --no-plot to keep the test headless and fast. | ||
| exit_code = main(["--no-plot", "--seed", "0", "--batch-size", "2"]) |
| it exists only so that the BO loop has something to optimize before the first | ||
| batch of physical tests lands. Replace it with a call into the experimental | ||
| data layer (or an FE surrogate) when ready; the BO loop in `main` does not | ||
| does not need to change. |
| python bo/generate_scaffold.py # writes bo/tensegrity_bo.py | ||
| SMOKE_TEST=true python bo/tensegrity_bo.py # quick smoke run | ||
|
|
| # denominator's `4.0 mm^2` is a reference skin cross-section that gives a | ||
| # ~50% cushion at t*w = 4 mm^2 — re-fit against pilot data when available. |
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/vertical-cloud-lab/tensegrity-optimization/sessions/b30dd5aa-0fc2-452d-bf84-7ed9e45b2c00 Co-authored-by: sgbaird-yolo <235173974+sgbaird-yolo@users.noreply.github.com>
Applied all six reviewer comments in d6bba70:
|
…guard Agent-Logs-Url: https://github.com/vertical-cloud-lab/tensegrity-optimization/sessions/91e672a1-d9e0-40c9-b3cd-8b01d96e636f Co-authored-by: sgbaird <45469701+sgbaird@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/vertical-cloud-lab/tensegrity-optimization/sessions/31a1ab8b-1606-4965-931b-855171ab66ef Co-authored-by: sgbaird-alt <71569943+sgbaird-alt@users.noreply.github.com>
Updated the campaign's variables and design types in 834ca15 to track PR #24's PETG+TPU Edison literature table (
Verified: |
… bridge for PR #30 Agent-Logs-Url: https://github.com/vertical-cloud-lab/tensegrity-optimization/sessions/976ba0ab-7b7c-477d-96b8-3d6a1e14da39 Co-authored-by: sgbaird <45469701+sgbaird@users.noreply.github.com>
|
Noting that I think we'll start including printer processing parameters (e.g., temperatures) into the design space. |
Repo had no BO code yet. Added a
honegumi-driven scaffold for the multi-material tensegrity energy-absorption campaign so we have a runnable Ax/BoTorch starting point to iterate on, plus a hand-customized companion script that wires up the real design variables and objectives drawn fromproposal.tex,idetc-abstract.tex,nasa-space-grant/proposal.tex, and PR #24.bo/layoutgenerate_scaffold.py— wrapshonegumi.core._honegumi.Honegumi, declaresCONFIG, renderstensegrity_bo.py.--smoke-testoverrides honegumi'sdummyflag for a 5-iter variant (honegumi's publicgenerate()always forcesdummy=False).tensegrity_bo.py— generated,black-formatted Ax loop; Branin placeholder objective is intentionally left for replacement per the customization checklist.tensegrity_campaign.py— hand-customized Ax MOO campaign companion to the regenerable scaffold. Flat top-to-bottom script (nomain(), no__main__guard, no CLI) — tune theN_ITERATIONS/BATCH_SIZE/SEEDmodule-level constants in place. Design space now tracks the PETG-strut + TPU-skin recommendations from PR Explore TPU+PLA BO design variables and base structures (Edison literature result + PR #22 design-gaps synthesis, hierarchical search space) #24's Edison literature scoping:[1.5, 5.0] mm, strut length[15, 50] mm, TPU cable diameter[1.0, 3.0] mm, twist angle[10°, 45°], prestress[0%, 5%], PETG infill[40%, 100%], interface wrap thickness[0.4, 2.0] mm.{3, 4, 6, 8, 12}.{truncated_octahedron, simplex_4_strut, t3_prism, stacked_prism}(the four "defensible seed families" from PR Explore TPU+PLA BO design variables and base structures (Edison literature result + PR #22 design-gaps synthesis, hierarchical search space) #24), tiling ∈{1×1×1, 1×1×2, 2×2×1, 2×2×2, 3×3×2}, TPU shore ∈{85A, 95A}, PETG infill pattern ∈{rectilinear, grid, gyroid}, build orientation ∈{vertical, horizontal, 45°}.F_peak_N, maximizeSEA_J_per_g, maximizeeta.Exploration is handled by Ax's default
GenerationStrategy(Sobol quasi-random init → model-based MOO acquisition), so no hand-curated pilot designs are baked into the script. Ships a documented analyticalsimulate_specimendummy evaluator (PETG mass model, topology stiffness, tiling factor, shore-softness cushion, infill strength scaling, infill-pattern stiffness, twist-angle sweet-spot bonus near 30°, build-orientation force multiplier, heteroscedastic noise) so the BO loop runs end-to-end without experimental data.requirements.txt—honegumi==0.4.3,ax-platform==0.4.3,numpy<2,pandas<2.3,matplotlib,black>=24.0. Thenumpy<2/pandas<2.3pins are required: ax 0.4.3 callsnp.percentile(..., interpolation=...)(gone in numpy 2) and writes to DataFrame-backed arrays that pandas 3 returns read-only.blackis pinned explicitly becausegenerate_scaffold.pyimports it to format the rendered scaffold.README.md— config table mapped to honegumi's curriculum tutorials, regen/run instructions, a "Customized campaign" section documenting the PR Explore TPU+PLA BO design variables and base structures (Edison literature result + PR #22 design-gaps synthesis, hierarchical search space) #24-aligned variables/objectives intensegrity_campaign.py, and a checklist for swapping the dummy evaluator for the experimental data layer.tests/— pytest smoke tests covering the honegumi engine build, rendered-script structure, and full-vs-smoke iteration count of the scaffold generator. (The previous campaign-script smoke tests were removed oncetensegrity_campaign.pybecame a flat top-level script — importing it would otherwise trigger the BO loop during test collection.)CONFIGMultiobjective ·Defaultmodel ·Singletask ·categorical=True·custom_threshold=True·existing_data=True·synchrony=Batch·visualize=True. Constraints (sum/order/linear/composition) off; flip inCONFIGand re-run the generator.Repo plumbing
README.mdgains a BO section + structure entry..gitignoreignores__pycache__/,*.py[cod],.pytest_cache/,*.egg-info/, and the generatedbo/campaign_pareto.png.bo/__init__.py+bo/tests/__init__.pymakeboa real package so tests don't manipulatesys.path.Verification
MPLBACKEND=Agg python bo/tensegrity_campaign.py→ 10 BO-selected trials (Sobol-initialized), 4 Pareto-optimal designs, Pareto-front PNG written.pytest bo/tests→ generator scaffold smoke tests (3 tests; 2 pre-existingblack.report.NothingChangedfailures are unrelated to the PETG variable update).Notes for review
tensegrity_bo.pyis byte-stable; commit it alongside anyCONFIGchange rather than editing the generated file by hand.tensegrity_bo.pynow also captures thetrial_indexreturned byattach_trial()when seeding existing data (the previous loop-counter assumption was fragile if Ax trial indices ever diverged).penalty_lookupblocks and Branin math intensegrity_bo.pyare honegumi template output — the customization lives intensegrity_campaign.pyinstead, leaving the scaffold faithful to honegumi's output.tensegrity_campaign.pynow uses PETG struts + TPU 85A/95A skin per PR Explore TPU+PLA BO design variables and base structures (Edison literature result + PR #22 design-gaps synthesis, hierarchical search space) #24's Edison literature recommendations (superseding the earlier PLA + TPU placeholder). The dummy evaluator includes a PETG density (1.27 g/cm³) and a shore-softness cushion factor.