Skip to content

Can OptimizationMOI use the common maxiters interface? #844

@SebastianM-C

Description

@SebastianM-C
Contributor

Question❓

I was wondering if there's something that prevents OptimizationMOI from using the globally passed maxiters. Currently (Optimization v4.0.3, OptimizationMOI v0.5.0), when I pass that, I get

┌ Warning: common maxiters argument is currently not used by Feasibility
│ 
│ Subject to:
│ 
│ Nonlinear
│ . Set number of iterations via optimizer specific keyword arguments.
└ @ OptimizationMOI ~/.julia/packages/OptimizationMOI/tpWKG/src/OptimizationMOI.jl:87

Activity

Vaibhavdixit02

Vaibhavdixit02 commented on Oct 26, 2024

@Vaibhavdixit02
Member

The issue is that specific solvers need differently named arguments for this so there isn't an obvious mapping

SebastianM-C

SebastianM-C commented on Oct 27, 2024

@SebastianM-C
ContributorAuthor

I see...
I was wondering where can I look into the details for Ipopt in particular, as I'm using "max_iter" => x for setting the maxiters, but that doesn't correspond to what opt_state.iter considers as iterations. I think that in the optimization state we get some internal iterations too, so I was wondering if I'm using the wrong argument or if there's a bug / different convention used in Optimization.jl

ChrisRackauckas

ChrisRackauckas commented on Oct 27, 2024

@ChrisRackauckas
Member

maxiters needs should just do the natural thing with each solver. Of course some solvers will have outer and inner iterations etc. but nobody will look into it. We need to stand by the same principle everywhere: the simple things should work, and the complex things should be possible.

SebastianM-C

SebastianM-C commented on Apr 23, 2025

@SebastianM-C
ContributorAuthor

I was wondering where can I look into the details for Ipopt in particular, as I'm using "max_iter" => x for setting the maxiters, but that doesn't correspond to what opt_state.iter considers as iterations.

I realized that the issue here is that the OptimizationMOI wrapper uses the objective function for the callbacks. In the case of Ipopt at least, we need to use https://github.com/jump-dev/Ipopt.jl?tab=readme-ov-file#solver-specific-callbacks since we would want to get the callback called after a step is accepted and not on every internal iteration. I tried this and it does indeed match with what max_iter is setting. Would it make sense to have a OptimizationIpopt or some more specific handling for Ipopt?

ChrisRackauckas

ChrisRackauckas commented on Apr 23, 2025

@ChrisRackauckas
Member

OptimizationIpopt would be a good library. Yes, if there's special things we can do for IPOPT let's do it, it is used often enough that making specific improvements to it is a good idea.

added a commit that references this issue on Aug 13, 2025
f938a95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @ChrisRackauckas@Vaibhavdixit02@SebastianM-C

      Issue actions

        Can OptimizationMOI use the common `maxiters` interface? · Issue #844 · SciML/Optimization.jl