-
-
Notifications
You must be signed in to change notification settings - Fork 100
Complete solve interface migration from SciMLBase to OptimizationBase #1053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complete solve interface migration from SciMLBase to OptimizationBase #1053
Conversation
This PR completes the migration of the optimization solve interface that was removed from SciMLBase (between v2.120.0 and master) to OptimizationBase. Changes: - Update `src/solve.jl` with complete documentation from SciMLBase: - Full docstrings for solve(), init(), and solve!() functions - Detailed callback documentation with examples - Complete parameter documentation - Update `src/OptimizationBase.jl`: - Import and export optimizer trait functions from SciMLBase - Export new error types - Update `test/solver_missing_error_messages.jl`: - Comprehensive tests for optimizer error conditions - Tests for trait validation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The `__init` and `__solve` functions are internal hooks, but the actual dispatches should be to CommonSolve.jl's `init`, `solve`, and `solve!` functions (which are imported via SciMLBase). Changes: - Import `init`, `solve`, `solve!`, `__init`, and `__solve` from SciMLBase - Change function definitions from `SciMLBase.solve` to `solve` to properly extend the CommonSolve interface - Remove `SciMLBase.` prefix from function calls to use the imported functions directly - Keep type annotations with `SciMLBase.` prefix (these are correct) This matches the pattern used in other SciML packages like OrdinaryDiffEq.jl and aligns with the CommonSolve.jl interface design. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Fixed the solve interface to use CommonSolve dispatches correctly. IssueThe Changes Made
RationaleThis pattern matches what's used in other SciML packages like OrdinaryDiffEq.jl and aligns with the CommonSolve.jl interface design. The CommonSolve functions ( Commit: 51bd57a |
Changes: - Add CommonSolve as a direct dependency in Project.toml - Import init, solve, solve! directly from CommonSolve instead of SciMLBase - Keep __init and __solve imported from SciMLBase (internal hooks) - Remove unnecessary comment about DiffEqBase This makes the dependency on CommonSolve explicit and clarifies that the solve interface comes from CommonSolve.jl. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Now importing CommonSolve interface functions directly from CommonSolve.jl instead of through SciMLBase. Changes in commit 29388ffb2:
This makes the dependency explicit and clarifies the interface structure. |
Match DiffEqBase style by importing all solve interface functions from SciMLBase rather than directly from CommonSolve. SciMLBase already imports from CommonSolve and exports these functions, so all packages in the ecosystem should import from SciMLBase for consistency. Changes: - Remove CommonSolve as a direct dependency - Import solve, init, solve!, __init, __solve from SciMLBase - Keep all other SciMLBase imports organized together This matches exactly how DiffEqBase handles the solve interface. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Updated to follow DiffEqBase pattern exactly. Changes in commit 2bce34bFollowing the DiffEqBase style guide, all solve interface functions should be imported from SciMLBase, not directly from CommonSolve: import SciMLBase: solve, init, solve!, __init, __solve,
OptimizationProblem,
...This is the standard pattern across the SciML ecosystem:
This keeps the dependency graph clean and ensures consistency across all SciML packages. |
Summary
This PR completes the migration of the optimization solve interface that was removed from SciMLBase (between v2.120.0 and master) to OptimizationBase, as referenced in SciML/SciMLBase.jl@v2.120.0...master.
Changes
Updated:
lib/OptimizationBase/src/solve.jlsolve()function including:init()functionUpdated:
lib/OptimizationBase/src/OptimizationBase.jlallowsbounds,requiresboundsallowsconstraints,requiresconstraintsallowscallback,requiresgradientrequireshessian,requiresconsjac,requiresconshesssupports_opt_cache_interfaceIncompatibleOptimizerError,OptimizerMissingErrorUpdated:
lib/OptimizationBase/test/solver_missing_error_messages.jlNotes
This PR builds on existing work in OptimizationBase and adds the complete documentation and interface that was previously in SciMLBase. The code has been formatted using JuliaFormatter with SciMLStyle.
Test Plan
🤖 Generated with Claude Code