vtjeng / MIPVerify.jl

Evaluating Robustness of Neural Networks with Mixed Integer Programming
MIT License
113 stars 31 forks source link

Silence output from solvers for tightening and during testing #131

Closed vtjeng closed 1 year ago

vtjeng commented 1 year ago

Silence output from solvers 1) for tightening and 2) during all testing via the solution outlined in https://github.com/jump-dev/JuMP.jl/issues/1883#issuecomment-1434120039.

The key function is optimize_silent!, which is a wrapper on top of optimize!.

function optimize_silent!(m)
    redirect_stdout(devnull) do
        optimize!(m)
        # Required, per https://discourse.julialang.org/t/consistent-way-to-suppress-solver-output/20437/9
        Base.Libc.flush_cstdio()
    end
end

We bump the minimum required Julia version to 1.6 since https://github.com/JuliaLang/julia/pull/36146 (which allows redirect_stdout(devnull) to work cross-platform) is only found in 1.6.0 and later. This necessitates dropping x86 support, since the HDF5 package (which we use to import data) does not compile in 1.6; see https://github.com/vtjeng/MIPVerify.jl/actions/runs/4201127640/jobs/7287828526#step:6:303.