Skip to content
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

Avoid AbstractVector in stats.solver_specific #102

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/run_solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ function solve_problems(solver, problems;
colstats :: Vector{Symbol} = [:name, :nvar, :ncon, :status, :elapsed_time, :objective, :dual_feas, :primal_feas],
info_hdr_override :: Dict{Symbol,String} = Dict{Symbol,String}(),
prune :: Bool=true, kwargs...)
solverstr = split(string(solver), ".")[end]

f_counters = collect(fieldnames(Counters))
fnls_counters = collect(fieldnames(NLSCounters))[2:end] # Excludes :counters
ncounters = length(f_counters) + length(fnls_counters)
Expand Down Expand Up @@ -65,8 +63,10 @@ function solve_problems(solver, problems;
end
if first_problem
for (k,v) in s.solver_specific
insertcols!(stats, ncol(stats)+1, k => Vector{Union{typeof(v),Missing}}())
push!(specific, k)
if !(typeof(v) <: AbstractVector)
insertcols!(stats, ncol(stats)+1, k => Vector{Union{typeof(v),Missing}}())
push!(specific, k)
end
end

@info log_header(colstats, types[col_idx], hdr_override=info_hdr_override)
Expand Down
3 changes: 2 additions & 1 deletion test/dummy_solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function dummy_solver(nlp :: AbstractNLPModel;
return GenericExecutionStats(:unknown, nlp,
objective=fx, dual_feas=norm(dual), primal_feas=norm(cx),
multipliers=y, multipliers_L=zeros(T, nvar), multipliers_U=zeros(T, nvar),
elapsed_time=elapsed_time, solution=x, iter=iter
elapsed_time=elapsed_time, solution=x, iter=iter,
solver_specific = Dict(:multiplier => y)
)
end
2 changes: 2 additions & 0 deletions test/test_bmark.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ function test_bmark()
end

statuses, avgs = quick_summary(stats)

pretty_stats(stats[:dummy])
end

@testset "Testing logging" begin
Expand Down