The following code does not work when called from path that has blank space.
using JuMP, AmplNLWriter, Ipopt_jll
mod = Model(() -> AmplNLWriter.Optimizer(Ipopt_jll.amplexe))
set_attribute(mod, "output_file", joinpath(@__DIR__,"output.txt"))
optimize!(mod)
The output is:
Ipopt 3.14.17: output_file=/home/karlo/Desktop/mwe
Unknown keyword “2/output.txt”
Not sure on what package should I post issue report. Already have opened one on Yggdrasil issues, but seems it is not due to them.
@amontoison , @odow
If you dump(mod) you’ll see at some point something like
raw_status_string: String "Error calling the solver. Failed with: ProcessFailedException(Base.Process[Process(setenv(`/path/to/bin/ipopt /path/to/jl_imeXZ0/model.nl -AMPL 'hsllib=/path/to/mwe 2/something.txt' linear_solver=ma27`,[...]), ProcessExited(1))])"
As I’ve been trying to say for hours in Issue parsing Ipopt_jll string option when there is blank space in path · Issue #10540 · JuliaPackaging/Yggdrasil · GitHub , whatever piece of code is calling ipopt is not quoting the path correctly. I have no clue of what is calling ipopt, but there is where the issue. Or maybe it’s ipopt which can’t parse paths with strings. Either way, nothing to do with Yggdrasil.
2 Likes
odow
February 15, 2025, 6:13pm
3
Hi @KSepetanc ,
I’ve moved this thread to the Optimization section of Discourse: Optimization (Mathematical) - Julia Programming Language
If you have JuMP-related questions in future, please post here first, instead of opening GitHub issues. If it is a bug, I can help direct you to the appropriate place.
In this case, it is a bug in Escape spaces in cmd · Issue #196 · jump-dev/AmplNLWriter.jl · GitHub
Until I fix it, a work-around is probably:
using JuMP, AmplNLWriter, Ipopt_jll
mod = Model(() -> AmplNLWriter.Optimizer(Ipopt_jll.amplexe))
set_attribute(mod, "output_file", escape_string(joinpath(@__DIR__,"output.txt"), " "))
optimize!(mod)
Mose’s dump(mod) gets you there, but a better way is to call solution_summary(mod). This would explain what happened in more detail.
odow
February 17, 2025, 6:42pm
4
This is fixed in v1.2.3 of AmplNLWriter.jl.
For earlier versions, the work-around needed to be:
output_file = joinpath(@__DIR__,"output.txt")
set_attribute(mod, "output_file", "\"$(output_file)\"")
1 Like
Thank you for fixing it so quickly. Also for merging other PR’s.
1 Like