IPOPT suppress output file generation

I took a deeper look. I can’t reproduce this, even with pure Ipopt. Consider:

julia> using Ipopt

julia> function eval_f(x::Vector{Float64})
           return x[1] * x[4] * (x[1] + x[2] + x[3]) + x[3]
       end
eval_f (generic function with 1 method)

julia> function eval_g(x::Vector{Float64}, g::Vector{Float64})
           g[1] = x[1] * x[2] * x[3] * x[4]
           g[2] = x[1]^2 + x[2]^2 + x[3]^2 + x[4]^2
           return
       end
eval_g (generic function with 1 method)

julia> function eval_grad_f(x::Vector{Float64}, grad_f::Vector{Float64})
           grad_f[1] = x[1] * x[4] + x[4] * (x[1] + x[2] + x[3])
           grad_f[2] = x[1] * x[4]
           grad_f[3] = x[1] * x[4] + 1
           grad_f[4] = x[1] * (x[1] + x[2] + x[3])
           return
       end
eval_grad_f (generic function with 1 method)

julia> function eval_jac_g(
           x::Vector{Float64},
           rows::Vector{Int32},
           cols::Vector{Int32},
           values::Union{Nothing,Vector{Float64}},
       )
           if values === nothing
               rows .= [1, 1, 1, 1, 2, 2, 2, 2]
               cols .= [1, 2, 3, 4, 1, 2, 3, 4]
           else
               values[1] = x[2] * x[3] * x[4]  # 1,1
               values[2] = x[1] * x[3] * x[4]  # 1,2
               values[3] = x[1] * x[2] * x[4]  # 1,3
               values[4] = x[1] * x[2] * x[3]  # 1,4
               values[5] = 2 * x[1]            # 2,1
               values[6] = 2 * x[2]            # 2,2
               values[7] = 2 * x[3]            # 2,3
               values[8] = 2 * x[4]            # 2,4
           end
           return
       end
eval_jac_g (generic function with 1 method)

julia> function build_problem()
           prob = Ipopt.CreateIpoptProblem(
               4,                     # n
               [1.0, 1.0, 1.0, 1.0],  # x_L
               [5.0, 5.0, 5.0, 5.0],  # x_U
               2,                     # m
               [25.0, 40.0],          # g_L
               [Inf, 40.0],           # g_U
               8,
               10,
               eval_f,
               eval_g,
               eval_grad_f,
               eval_jac_g,
               nothing, # eval_h,
           )
           Ipopt.AddIpoptStrOption(prob, "hessian_approximation", "limited-memory")
           return prob
       end
build_problem (generic function with 1 method)

julia> p1 = build_problem();

julia> Ipopt.OpenIpoptOutputFile(p1, "ipopt.log", 5)

julia> p2 = build_problem();

julia> p2.x = [1.0, 4.75, 3.82, 1.379];

julia> Ipopt.OpenIpoptOutputFile(p2, "ipopt.log", 5)

julia> Ipopt.IpoptSolve(p2)
This is Ipopt version 3.14.14, running with linear solver MUMPS 5.6.2.

Number of nonzeros in equality constraint Jacobian...:        4
Number of nonzeros in inequality constraint Jacobian.:        4
Number of nonzeros in Lagrangian Hessian.............:        0

Total number of variables............................:        4
                     variables with only lower bounds:        0
                variables with lower and upper bounds:        4
                     variables with only upper bounds:        0
Total number of equality constraints.................:        1
Total number of inequality constraints...............:        1
        inequality constraints with only lower bounds:        1
   inequality constraints with lower and upper bounds:        0
        inequality constraints with only upper bounds:        0

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0  1.7162928e+01 7.66e-02 5.20e-01   0.0 0.00e+00    -  0.00e+00 0.00e+00   0
   1  1.7103404e+01 1.81e-04 1.46e-02  -1.8 1.35e-01    -  9.91e-01 1.00e+00h  1
   2  1.7015921e+01 1.73e-04 3.11e-02  -3.1 1.36e-01    -  1.00e+00 9.99e-01f  1
   3  1.7014053e+01 5.93e-05 1.10e-02  -5.0 2.58e-03    -  1.00e+00 1.00e+00h  1
   4  1.7014006e+01 1.99e-05 4.20e-03  -6.4 3.53e-03    -  1.00e+00 9.95e-01h  1
   5  1.7014016e+01 1.43e-06 1.01e-05  -8.5 9.44e-04    -  1.00e+00 1.00e+00h  1
   6  1.7014017e+01 4.97e-14 2.07e-08 -11.0 1.49e-07    -  1.00e+00 1.00e+00h  1
   7  1.7014017e+01 0.00e+00 1.75e-12 -11.0 5.27e-11    -  1.00e+00 1.00e+00h  1

Number of Iterations....: 7

                                   (scaled)                 (unscaled)
Objective...............:   1.7014017140224173e+01    1.7014017140224173e+01
Dual infeasibility......:   1.7487404428810206e-12    1.7487404428810206e-12
Constraint violation....:   0.0000000000000000e+00    0.0000000000000000e+00
Variable bound violation:   9.9908077366706038e-09    9.9908077366706038e-09
Complementarity.........:   1.0000053295879501e-11    1.0000053295879501e-11
Overall NLP error.......:   1.0000053295879501e-11    1.0000053295879501e-11


Number of objective function evaluations             = 8
Number of objective gradient evaluations             = 8
Number of equality constraint evaluations            = 8
Number of inequality constraint evaluations          = 8
Number of equality constraint Jacobian evaluations   = 8
Number of inequality constraint Jacobian evaluations = 8
Number of Lagrangian Hessian evaluations             = 0
Total seconds in IPOPT                               = 0.073

EXIT: Optimal Solution Found.
0

julia> print(read("ipopt.log", String))
This is Ipopt version 3.14.14, running with linear solver MUMPS 5.6.2.

Number of nonzeros in equality constraint Jacobian...:        4
Number of nonzeros in inequality constraint Jacobian.:        4
Number of nonzeros in Lagrangian Hessian.............:        0

Total number of variables............................:        4
                     variables with only lower bounds:        0
                variables with lower and upper bounds:        4
                     variables with only upper bounds:        0
Total number of equality constraints.................:        1
Total number of inequality constraints...............:        1
        inequality constraints with only lower bounds:        1
   inequality constraints with lower and upper bounds:        0
        inequality constraints with only upper bounds:        0

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0  1.7162928e+01 7.66e-02 5.20e-01   0.0 0.00e+00    -  0.00e+00 0.00e+00   0
   1  1.7103404e+01 1.81e-04 1.46e-02  -1.8 1.35e-01    -  9.91e-01 1.00e+00h  1
   2  1.7015921e+01 1.73e-04 3.11e-02  -3.1 1.36e-01    -  1.00e+00 9.99e-01f  1
   3  1.7014053e+01 5.93e-05 1.10e-02  -5.0 2.58e-03    -  1.00e+00 1.00e+00h  1
   4  1.7014006e+01 1.99e-05 4.20e-03  -6.4 3.53e-03    -  1.00e+00 9.95e-01h  1
   5  1.7014016e+01 1.43e-06 1.01e-05  -8.5 9.44e-04    -  1.00e+00 1.00e+00h  1
   6  1.7014017e+01 4.97e-14 2.07e-08 -11.0 1.49e-07    -  1.00e+00 1.00e+00h  1
   7  1.7014017e+01 0.00e+00 1.75e-12 -11.0 5.27e-11    -  1.00e+00 1.00e+00h  1

Number of Iterations....: 7

                                   (scaled)                 (unscaled)
Objective...............:   1.7014017140224173e+01    1.7014017140224173e+01
Dual infeasibility......:   1.7487404428810206e-12    1.7487404428810206e-12
Constraint violation....:   0.0000000000000000e+00    0.0000000000000000e+00
Variable bound violation:   9.9908077366706038e-09    9.9908077366706038e-09
Complementarity.........:   1.0000053295879501e-11    1.0000053295879501e-11
Overall NLP error.......:   1.0000053295879501e-11    1.0000053295879501e-11


Number of objective function evaluations             = 8
Number of objective gradient evaluations             = 8
Number of equality constraint evaluations            = 8
Number of inequality constraint evaluations          = 8
Number of equality constraint Jacobian evaluations   = 8
Number of inequality constraint Jacobian evaluations = 8
Number of Lagrangian Hessian evaluations             = 0
Total seconds in IPOPT                               = 0.073

EXIT: Optimal Solution Found.

julia> Ipopt.IpoptSolve(p1)
This is Ipopt version 3.14.14, running with linear solver MUMPS 5.6.2.

Number of nonzeros in equality constraint Jacobian...:        4
Number of nonzeros in inequality constraint Jacobian.:        4
Number of nonzeros in Lagrangian Hessian.............:        0

Total number of variables............................:        4
                     variables with only lower bounds:        0
                variables with lower and upper bounds:        4
                     variables with only upper bounds:        0
Total number of equality constraints.................:        1
Total number of inequality constraints...............:        1
        inequality constraints with only lower bounds:        1
   inequality constraints with lower and upper bounds:        0
        inequality constraints with only upper bounds:        0

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0  4.1009029e+00 3.59e+01 1.54e+00   0.0 0.00e+00    -  0.00e+00 0.00e+00   0
   1  6.3369396e+00 3.43e+01 2.40e+01  -5.7 5.89e+00    -  2.21e-03 4.20e-02h  1
   2  5.4097700e+00 3.42e+01 1.38e+02   0.2 5.15e+00    -  1.72e-05 2.32e-03F  1
   3  3.9539430e+01 1.38e+01 1.45e+03  -1.1 4.74e+00    -  1.00e+00 3.76e-01h  2
   4  1.8118029e+01 2.90e+00 7.27e+02   0.7 2.49e+01    -  1.00e+00 6.47e-01f  1
   5  2.0775371e+01 1.57e-01 8.47e-01   0.1 1.12e+01    -  1.00e+00 1.00e+00f  1
   6  1.7334617e+01 1.78e-01 3.19e-01  -1.6 5.17e+00    -  9.23e-01 1.00e+00f  1
   7  1.6866329e+01 3.04e-01 1.62e-01  -1.6 3.10e-01    -  1.00e+00 1.00e+00h  1
   8  1.6989287e+01 4.78e-02 3.79e-02  -2.4 1.30e-01    -  9.95e-01 1.00e+00h  1
   9  1.7013532e+01 1.25e-03 6.00e-03  -3.7 1.35e-02    -  9.96e-01 1.00e+00h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  10  1.7014026e+01 5.99e-07 5.62e-04  -5.3 4.51e-04    -  1.00e+00 1.00e+00h  1
  11  1.7014017e+01 5.43e-08 3.78e-06  -7.4 1.84e-04    -  1.00e+00 1.00e+00h  1
  12  1.7014017e+01 1.56e-11 3.32e-09 -11.0 3.12e-06    -  1.00e+00 1.00e+00h  1

Number of Iterations....: 12

                                   (scaled)                 (unscaled)
Objective...............:   1.7014017140214442e+01    1.7014017140214442e+01
Dual infeasibility......:   3.3177681309590336e-09    3.3177681309590336e-09
Constraint violation....:   1.5603518477291800e-11    1.5603518477291800e-11
Variable bound violation:   9.9909249762220043e-09    9.9909249762220043e-09
Complementarity.........:   1.0110284647548166e-11    1.0110284647548166e-11
Overall NLP error.......:   3.3177681309590336e-09    3.3177681309590336e-09


Number of objective function evaluations             = 17
Number of objective gradient evaluations             = 13
Number of equality constraint evaluations            = 17
Number of inequality constraint evaluations          = 17
Number of equality constraint Jacobian evaluations   = 13
Number of inequality constraint Jacobian evaluations = 13
Number of Lagrangian Hessian evaluations             = 0
Total seconds in IPOPT                               = 0.014

EXIT: Optimal Solution Found.
0

julia> print(read("ipopt.log", String))
This is Ipopt version 3.14.14, running with linear solver MUMPS 5.6.2.

Number of nonzeros in equality constraint Jacobian...:        4
Number of nonzeros in inequality constraint Jacobian.:        4
Number of nonzeros in Lagrangian Hessian.............:        0

Total number of variables............................:        4
                     variables with only lower bounds:        0
                variables with lower and upper bounds:        4
                     variables with only upper bounds:        0
Total number of equality constraints.................:        1
Total number of inequality constraints...............:        1
        inequality constraints with only lower bounds:        1
   inequality constraints with lower and upper bounds:        0
        inequality constraints with only upper bounds:        0

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0  4.1009029e+00 3.59e+01 1.54e+00   0.0 0.00e+00    -  0.00e+00 0.00e+00   0
   1  6.3369396e+00 3.43e+01 2.40e+01  -5.7 5.89e+00    -  2.21e-03 4.20e-02h  1
   2  5.4097700e+00 3.42e+01 1.38e+02   0.2 5.15e+00    -  1.72e-05 2.32e-03F  1
   3  3.9539430e+01 1.38e+01 1.45e+03  -1.1 4.74e+00    -  1.00e+00 3.76e-01h  2
   4  1.8118029e+01 2.90e+00 7.27e+02   0.7 2.49e+01    -  1.00e+00 6.47e-01f  1
   5  2.0775371e+01 1.57e-01 8.47e-01   0.1 1.12e+01    -  1.00e+00 1.00e+00f  1
   6  1.7334617e+01 1.78e-01 3.19e-01  -1.6 5.17e+00    -  9.23e-01 1.00e+00f  1
   7  1.6866329e+01 3.04e-01 1.62e-01  -1.6 3.10e-01    -  1.00e+00 1.00e+00h  1
   8  1.6989287e+01 4.78e-02 3.79e-02  -2.4 1.30e-01    -  9.95e-01 1.00e+00h  1
   9  1.7013532e+01 1.25e-03 6.00e-03  -3.7 1.35e-02    -  9.96e-01 1.00e+00h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  10  1.7014026e+01 5.99e-07 5.62e-04  -5.3 4.51e-04    -  1.00e+00 1.00e+00h  1
  11  1.7014017e+01 5.43e-08 3.78e-06  -7.4 1.84e-04    -  1.00e+00 1.00e+00h  1
  12  1.7014017e+01 1.56e-11 3.32e-09 -11.0 3.12e-06    -  1.00e+00 1.00e+00h  1

Number of Iterations....: 12

                                   (scaled)                 (unscaled)
Objective...............:   1.7014017140214442e+01    1.7014017140214442e+01
Dual infeasibility......:   3.3177681309590336e-09    3.3177681309590336e-09
Constraint violation....:   1.5603518477291800e-11    1.5603518477291800e-11
Variable bound violation:   9.9909249762220043e-09    9.9909249762220043e-09
Complementarity.........:   1.0110284647548166e-11    1.0110284647548166e-11
Overall NLP error.......:   3.3177681309590336e-09    3.3177681309590336e-09


Number of objective function evaluations             = 17
Number of objective gradient evaluations             = 13
Number of equality constraint evaluations            = 17
Number of inequality constraint evaluations          = 17
Number of equality constraint Jacobian evaluations   = 13
Number of inequality constraint Jacobian evaluations = 13
Number of Lagrangian Hessian evaluations             = 0
Total seconds in IPOPT                               = 0.014

EXIT: Optimal Solution Found.

p1 opens the file first, then p2 opens it, solves and writes to file, then when p1 solves it overwrites the existing file. That seems to be working as expected?