-
Notifications
You must be signed in to change notification settings - Fork 57
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
double free or corruption (out) error #341
Comments
Do you have a reproducible example? How are you calling Ipopt? |
The code that produces the error comes from a longer procedure. It involves a little data processing, running a few models to get approx. solutions / warmstarts to the lower level optimization problem, and then all of the iterations in the iterative solution procedure. The bilevel code in principal is similar to the following PR: joaquimg/BilevelJuMP.jl#184 (see https://github.com/joaquimg/BilevelJuMP.jl/blob/b0160b788bbe0e22dd7ce21b113cbb596f79e06d/docs/src/examples/Iterative_example1.jl for a simple example). Ipopt is also called like this (MOI), and the first iterations (sometimes all) run through perfectly fine. |
It's going to be hard, if not impossible, to debug this without a reliable reproducible example. |
Is there a good way to create a single reproducible model run? Maybe something like writing the |
In theory, Does it happen with a solver other than MA97? |
I think .nl files order variables (see https://www.ampl.com/wp-content/uploads/Hooking-Your-Solver-to-AMPL-by-David-M.-Gay.pdf). Since the problem seems related to some numerical situation, this will likely make a difference (?). Nevertheless, I will try... ERROR: MathOptInterface.GetAttributeNotAllowed{MathOptInterface.ListOfModelAttributesSet}: Getting attribute MathOptInterface.ListOfModelAttributesSet() cannot be performed: Ipopt.Optimizer does not support getting the attribute MathOptInterface.ListOfModelAttributesSet(). You may want to use a `CachingOptimizer` in `AUTOMATIC` mode or you may need to call `reset_optimizer` before doing this operation if the `CachingOptimizer` is in `MANUAL` mode. Is this intended (and is there another way except copying to I did also send out another run with MA86. Usually different linear solvers produce different solutions/trajectories, so if it comes back without problems we cannot infer the error is related to MA97. But if we're lucky it will also produce an error. Then we could at least exclude the linear solvers from the list of likely candidates (they could still both have a similar issue, but this seems less likely...). Unfortunately, we will have to wait a bit for the results... |
Ah. You probably need to use |
In my case, this is how |
I can then write the |
I don't understand. Where did Are you using BilevelJuMP or just MOI and Ipopt? If you're using MOI, then use |
Sorry, that was a bit confusing. I'm using an extended version of BilevelJuMP (that was the PR I had linked here: #341 (comment)). There, the solver is instantiated like this: using MathOptInterface
using Ipopt
const MOI = MathOptInterface
optimizer = MOI.instantiate(Ipopt.Optimizer; with_bridge_type = Float64)
dest = MOI.FileFormats.Model(; filename = joinpath(pwd(),"tst_logs","tst.nl"))
MOI.copy_to(dest, optimizer)
MOI.write_to_file(dest, joinpath(pwd(),"tst_logs","_model.nl")) The error message is:
with:
Edit: forgot the const MOI line... |
@odow Should the code above work, or am I approaching this from the wrong side? |
Try: optimizer = MOI.Utilities.CachingOptimizer(
MOI.Utilities.UniversalFallback(MOI.Utilities.Model{Float64}()),
MOI.instantiate(Ipopt.Optimizer; with_bridge_type = Float64),
) |
Ok, so this is probably the best I can do...
Will set this up and hopefully get back with a reproducible example... |
Ok, I did a bit of testing on this and there might be a problem with MOI and .nl files. using MathOptInterface
using Ipopt
src = MOI.FileFormats.Model(format = MOI.FileFormats.FORMAT_NL)
MOI.read_from_file(src, joinpath(pwd(),"_model_storage", "model.nl"))
solver = MOI.instantiate(Ipopt.Optimizer; with_bridge_type = Float64)
MOI.copy_to(solver, src)
MOI.set(solver, MOI.RawOptimizerAttribute("warm_start_init_point"), "yes")
MOI.set(solver, MOI.RawOptimizerAttribute("warm_start_bound_push"), 1e-12)
MOI.set(solver, MOI.RawOptimizerAttribute("warm_start_bound_frac"), 1e-12)
MOI.set(solver, MOI.RawOptimizerAttribute("warm_start_slack_bound_frac"), 1e-12)
MOI.set(solver, MOI.RawOptimizerAttribute("warm_start_slack_bound_push"), 1e-12)
MOI.set(solver, MOI.RawOptimizerAttribute("warm_start_mult_bound_push"), 1e-12)
MOI.set(solver, MOI.RawOptimizerAttribute("mu_init"), 1e-12)
MOI.set(solver, MOI.RawOptimizerAttribute("print_level"), 5)
MOI.optimize!(solver) |
I don't think we support dual starts in the NL files yet. |
I can try to write this up the next few days. |
Think I was a bit optimistic here... But instead, I managed to write an extension of the MOF format that correctly stores primal and dual starts. If leaving out starts was not a design choice for MOF, I could also do a PR with the amendments to MOI. |
😆 I'm not surprised. NL files are pretty cryptic!
Not a design choice. Just something I didn't get around to. Please open a PR. We'll also have to make changes to the schema: https://github.com/jump-dev/MathOptFormat The place to add is somewhere: |
Closing this, I believe it is related to dlopen() when handling linear solvers. |
Hi everyone,
I am solving a series of MPECs, where a relaxation on complementary slackness conditions is tightened every iteration. The model code works as expected most of the time, however i do sometimes get strange memory related errors with Ipopt and MA97. Likely, they are not related to the julia interface, but I think it might be best to start here and make my way downstream. I have attached a log of the last unsuccessful iteration below.
The error is likely related to some numerically odd constellation, as the 20 successful runs before that did use the same code and only had different values.
Do you think there is a better way to dig into this than just by creating a more detailed log?
If not, I will try to come up with a more detailed report, but this might take some time as the model needs to run all previous iterations again...
Any help is much appreciated, thanks in advance :D
The text was updated successfully, but these errors were encountered: