Giter VIP home page Giter VIP logo

Comments (5)

odow avatar odow commented on July 18, 2024

Looks like you need set_optimizer_attribute(m, "max_wall_time", 1.0). Ipopt uses different methods to set options, so we rely on the type passed by the user to infer which method to call. If you pass the wrong type, this error occurs.

from ipopt.jl.

this-josh avatar this-josh commented on July 18, 2024

Thanks that works. The Ipopt docs say it must be an int, using an int sets it with the ipopt.jl function ipopt.AddIpoptIntOption, and the error message says it must be an int so it is quite confusing that the solution is to make it a float? Although, I appreciate that ipopt.jl has to infer what ipopt is after so I'm not sure how this situation could be improved.

Also, set_time_limit_sec(m, 20.0) doesn't work and doesn't give an error, I guess this may be a JuMP issue?

from ipopt.jl.

odow avatar odow commented on July 18, 2024

The Ipopt docs say it must be an int

Where?

Also, set_time_limit_sec(m, 20.0) doesn't work and doesn't give an error

It sets the max_cpu_time attribute, because when the code was written, max_wall_time didn't exist:

Ipopt.jl/src/MOI_wrapper.jl

Lines 240 to 254 in e5f978c

MOI.supports(::Optimizer, ::MOI.TimeLimitSec) = true
function MOI.set(model::Optimizer, ::MOI.TimeLimitSec, value::Real)
MOI.set(model, MOI.RawOptimizerAttribute("max_cpu_time"), Float64(value))
return
end
function MOI.set(model::Optimizer, ::MOI.TimeLimitSec, ::Nothing)
delete!(model.options, "max_cpu_time")
return
end
function MOI.get(model::Optimizer, ::MOI.TimeLimitSec)
return get(model.options, "max_cpu_time", nothing)
end

from ipopt.jl.

this-josh avatar this-josh commented on July 18, 2024

Sorry, I miss-read the docs and presumed the error message would be in agreement with the docs, it seems the docs don't specify any types. But the error message does state Int. I'm unsure on the aforementioned inference mechanism, but perhaps there could be a try: int; except: float kind of methodology? Providing a function an int, the c call then being inferred, and then receiving an error saying the function requires an int seems like a process which could be improved.

I see, I haven't previously set that attribute manually. However, in my experience set_time_limit_sec has no bearing on the run time of an ipopt model, I've set it to 20 and had ipopt run for over 600 seconds. Sorry I'm unsure on how to easily make a minimum working example of this

from ipopt.jl.

odow avatar odow commented on July 18, 2024

My experience is to generally be against hacks like the try-catch, because it leads to small incompatibilities between Ipopt via MOI and Ipopt the C library. If you're using Ipopt, and you choose to set a solver-specific attribute like max_wall_time, there's a bit of overhead on the user to figure out the correct option.

Note that when you use the solver-independent option set_time_limit_sec we promote things automatically.

from ipopt.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.