Skip to content

Conversation

ChrisRackauckas-Claude
Copy link

Summary

  • Fixes the persistent warning: "common maxiters argument is currently not used by [optimizer]" in OptimizationMOI
  • Implements solver-specific parameter mapping for the common maxiters interface
  • Supports major MOI solvers with their respective iteration limit parameter names

Changes Made

  • Added _set_maxiters! function that automatically maps maxiters to solver-specific parameters:

    • Ipopt: max_iter
    • Gurobi: IterationLimit
    • CPLEX: CPX_PARAM_ITLIM
    • SCIP: limits/iterations
    • Mosek: MSK_IPAR_INTPNT_MAX_ITERATIONS
    • OSQP: max_iter
    • ECOS: maxit
    • SCS: max_iters
    • COSMO: max_iter
  • Generic fallback that tries common parameter names for unknown solvers

  • Comprehensive error handling with informative warnings when mapping fails

  • Added tests to verify the functionality works correctly

Problem Solved

Before this PR, using solve(prob, optimizer; maxiters=100) would show the warning:

┌ Warning: common maxiters argument is currently not used by [optimizer]. 
│ Set number of iterations via optimizer specific keyword arguments.
└ @ OptimizationMOI

After this PR, the maxiters parameter is automatically mapped to the correct solver-specific parameter without warnings for supported solvers.

Test Plan

  • Verify _set_maxiters! function handles known solvers correctly
  • Verify generic fallback works for unknown solvers
  • Verify integration with solve() function
  • Verify cache interface compatibility

Closes

Fixes #844

🤖 Generated with Claude Code

- Add _set_maxiters! function to map common maxiters to solver-specific parameters
- Support major MOI solvers: Ipopt, Gurobi, CPLEX, SCIP, Mosek, OSQP, ECOS, SCS, COSMO
- Implement generic fallback that tries common parameter names
- Add comprehensive tests for the new functionality
- Resolves SciML#844

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <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.

Can OptimizationMOI use the common maxiters interface?
2 participants