Repository navigation
Perf/stage solvers - #5
Open
rafaelborges5 wants to merge 6 commits into
Open
rafaelborges5 wants to merge 6 commits into
rafaelborges5 wants to merge 6 commits into
Conversation
rafaelborges5
commented
Oct 13, 2026
Owner
- Add the ability to use FATROP instead of only IPOPT, there is a different OCP formulation due to it's requirements when it comes to definition of states.
- Add the ability to provide compiled derivatives to both IPOPT (doable within Casadi), but had to write a C adapter in order to allow it for FATROP.
- Add the ability to enable / disable these compiled derivatives, as well as a hashing system in order for the system to know when a recompilation is needed or not. IPOPT or FATROP can be chosen
- Updated documentation
There was a problem hiding this comment.
🟡 Changes recommended
Backend validation gaps and unsafe concurrent cache compilation can produce unsupported solves or failed builds.
4 open findings
What changed in this PR
Adds stage-wise IPOPT and FATROP backends with cached compiled derivatives, CLI integration, documentation, and tests.
Changes:
- Implements stage-wise OCP formulations and solver adapters.
- Adds compiled-derivative caching and prebuild support.
- Documents and tests solver/derivative combinations.
| File | Description |
|---|---|
tests/optimization/test_stage_solvers.py |
Tests solver agreement and derivatives. |
src/fast_lto/README.md |
Documents solver performance. |
src/fast_lto/pipeline.py |
Configures and prebuilds solvers. |
src/fast_lto/optimization/stage_problem.py |
Defines stage-wise OCPs. |
src/fast_lto/optimization/stage_ipopt.py |
Implements compiled IPOPT derivatives. |
src/fast_lto/optimization/stage_fatrop.py |
Implements FATROP integration. |
src/fast_lto/optimization/README.md |
Documents new backends. |
src/fast_lto/optimization/integrators.py |
Supports symbolic step sizes. |
src/fast_lto/optimization/global_ocp.py |
Selects solver backends. |
src/fast_lto/optimization/fatrop_glue.c |
Adapts FATROP’s C interface. |
src/fast_lto/optimization/codegen.py |
Compiles and caches derivatives. |
src/fast_lto/cli.py |
Adds solver and prebuild flags. |
README.md |
Adds FATROP usage examples. |
pyproject.toml |
Packages the C adapter. |
configs/README.md |
Documents configuration options. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+76
to
+78
| t0 = time.perf_counter() | ||
| build = root / f"{name}_{key}" | ||
| build.mkdir(parents=True, exist_ok=True) |
Comment on lines
+1017
to
+1018
| if solver not in SOLVERS: | ||
| raise ValueError(f"Unknown solver: {solver!r}. Must be one of {list(SOLVERS)}.") |
| kappa_half = np.asarray(track["curvatures_half"], dtype=float) | ||
| w_left = np.asarray(track["w_left"], dtype=float) - boundary_margin | ||
| w_right = np.asarray(track["w_right"], dtype=float) - boundary_margin | ||
| ds = float(track["ds_m"]) |
Comment on lines
+742
to
+743
| if config.derivatives != "compiled": | ||
| raise ValueError("Nothing to prebuild: set derivatives: compiled.") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

