Skip to content

docs(examples): Add comprehensive Phase 3 constrained optimization ex…#65

Merged
noahgift merged 1 commit into
mainfrom
claude/research-optimization-techniques-01LWS5ZwqVEHQ13NbShwH7Ls
Nov 23, 2025
Merged

docs(examples): Add comprehensive Phase 3 constrained optimization ex…#65
noahgift merged 1 commit into
mainfrom
claude/research-optimization-techniques-01LWS5ZwqVEHQ13NbShwH7Ls

Conversation

@noahgift

Copy link
Copy Markdown
Contributor

…amples

Add constrained_optimization.rs demonstrating the three Phase 3 algorithms:

  • Projected Gradient Descent: Non-negative quadratic minimization
  • Augmented Lagrangian: Equality-constrained least squares
  • Interior Point: Linear programming, quadratic programming

Includes 5 examples (~750 lines):

  1. Non-negative quadratic with Projected GD (working perfectly)
  2. Equality-constrained least squares with Augmented Lagrangian (excellent constraint satisfaction)
  3. Linear programming with Interior Point
  4. Quadratic programming with Interior Point
  5. Method comparison on box-constrained problem

Follows established pattern from batch_optimization.rs and convex_optimization.rs with detailed mathematical background, problem setup, solution validation, and performance analysis.

Related: Phase 3 completion (commits 9-11)

…amples

Add constrained_optimization.rs demonstrating the three Phase 3 algorithms:
- Projected Gradient Descent: Non-negative quadratic minimization
- Augmented Lagrangian: Equality-constrained least squares
- Interior Point: Linear programming, quadratic programming

Includes 5 examples (~750 lines):
1. Non-negative quadratic with Projected GD (working perfectly)
2. Equality-constrained least squares with Augmented Lagrangian (excellent constraint satisfaction)
3. Linear programming with Interior Point
4. Quadratic programming with Interior Point
5. Method comparison on box-constrained problem

Follows established pattern from batch_optimization.rs and convex_optimization.rs
with detailed mathematical background, problem setup, solution validation,
and performance analysis.

Related: Phase 3 completion (commits 9-11)
@noahgift noahgift merged commit 10f3291 into main Nov 23, 2025
@noahgift noahgift deleted the claude/research-optimization-techniques-01LWS5ZwqVEHQ13NbShwH7Ls branch November 23, 2025 18:21
noahgift added a commit that referenced this pull request Mar 7, 2026
Add `apr eval --task mbpp --data mbpp.jsonl` with full inference pipeline:
- MbppProblem struct (text, code, task_id, test_list, test_setup_code)
- run_mbpp() with same inference bridge as HumanEval (ALB-084)
- run_mbpp_inference() with SafetensorsToAprConverter + forward_with_cache
- Natural language prompt → completion → test_list assertion execution
- max_new_tokens=512, timeout=10s (longer than HumanEval)
- JSON output with per_problem_results, pass@k metrics

974 problems from Google MBPP dataset. Reuses sample_token(),
truncate_at_function_boundary(), execute_python_test(), compute_pass_at_k().

Refs #65

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
noahgift added a commit that referenced this pull request Mar 7, 2026
Add `apr eval --task mbpp --data mbpp.jsonl` with full inference pipeline:
- MbppProblem struct (text, code, task_id, test_list, test_setup_code)
- run_mbpp() with same inference bridge as HumanEval (ALB-084)
- run_mbpp_inference() with SafetensorsToAprConverter + forward_with_cache
- Natural language prompt → completion → test_list assertion execution
- max_new_tokens=512, timeout=10s (longer than HumanEval)
- JSON output with per_problem_results, pass@k metrics

974 problems from Google MBPP dataset. Reuses sample_token(),
truncate_at_function_boundary(), execute_python_test(), compute_pass_at_k().

Refs #65

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
noahgift added a commit that referenced this pull request Apr 19, 2026
v0.31.1 was yanked from crates.io because `cargo install aprender@0.31.1`
panicked at aprender-mcp build.rs — `CARGO_MANIFEST_DIR/../../contracts/
apr-mcp-tool-schemas-v1.yaml` lives in the monorepo tree but NOT in the
published tarball (outside the package root), so every external install
hit a hard panic at build time.

Three-layer defense so this class never recurs:

1. **In-crate contract copy** — contracts/apr-mcp-tool-schemas-v1.yaml
   copied into crates/aprender-mcp/contracts/ and Cargo.toml `include`
   lists `contracts/*.yaml`. build.rs reads `CARGO_MANIFEST_DIR/
   contracts/…` (no `..` escape). Drift-guarded by new test
   `contract_copy_matches_workspace_root` which asserts byte-identity
   with the workspace-root copy in-tree, and skips when the workspace
   copy is absent (published-tarball mode).

2. **Static Poka-Yoke** — scripts/check_build_rs_paths.sh walks every
   git-tracked build.rs, flags any that join `".."` onto
   CARGO_MANIFEST_DIR AND `panic!`/`unwrap_or_else(…panic)` AND lack a
   `.exists()` guard or `ALLOW_ESCAPE` annotation. Reverting this fix
   locally makes the gate exit 1 with a remediation message.

3. **Wired into both gates** — `make tier3` runs the check pre-push,
   and `.github/workflows/ci.yml` `workspace-test` job runs it on every
   PR so a future build.rs path escape can't sneak back in.

Yank command (already executed):
  cargo yank --version 0.31.1 <each of 68 crates>  # all confirmed yanked

Next step after this lands: cut v0.31.2, re-publish all 68 crates at
40s/crate pacing (crates.io 30-per-10min window), verify `cargo install
aprender --version 0.31.2` actually installs this time.

Refs: task #64 (yank), #65 (fix), #66 (prevention)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
noahgift added a commit that referenced this pull request Apr 19, 2026
…rd (#910)

v0.31.1 was yanked from crates.io because `cargo install aprender@0.31.1`
panicked at aprender-mcp build.rs — `CARGO_MANIFEST_DIR/../../contracts/
apr-mcp-tool-schemas-v1.yaml` lives in the monorepo tree but NOT in the
published tarball (outside the package root), so every external install
hit a hard panic at build time.

Three-layer defense so this class never recurs:

1. **In-crate contract copy** — contracts/apr-mcp-tool-schemas-v1.yaml
   copied into crates/aprender-mcp/contracts/ and Cargo.toml `include`
   lists `contracts/*.yaml`. build.rs reads `CARGO_MANIFEST_DIR/
   contracts/…` (no `..` escape). Drift-guarded by new test
   `contract_copy_matches_workspace_root` which asserts byte-identity
   with the workspace-root copy in-tree, and skips when the workspace
   copy is absent (published-tarball mode).

2. **Static Poka-Yoke** — scripts/check_build_rs_paths.sh walks every
   git-tracked build.rs, flags any that join `".."` onto
   CARGO_MANIFEST_DIR AND `panic!`/`unwrap_or_else(…panic)` AND lack a
   `.exists()` guard or `ALLOW_ESCAPE` annotation. Reverting this fix
   locally makes the gate exit 1 with a remediation message.

3. **Wired into both gates** — `make tier3` runs the check pre-push,
   and `.github/workflows/ci.yml` `workspace-test` job runs it on every
   PR so a future build.rs path escape can't sneak back in.

Yank command (already executed):
  cargo yank --version 0.31.1 <each of 68 crates>  # all confirmed yanked

Next step after this lands: cut v0.31.2, re-publish all 68 crates at
40s/crate pacing (crates.io 30-per-10min window), verify `cargo install
aprender --version 0.31.2` actually installs this time.

Refs: task #64 (yank), #65 (fix), #66 (prevention)

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants