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

make stepper analysis script produce more CSVs #668

Merged
merged 1 commit into from
Apr 3, 2021
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
32 changes: 26 additions & 6 deletions benchmarks/stepper/analyze.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,35 @@ function make_perf_profiles(all_df, comp, metric)
end

function instance_stats(all_df)
one_solver = filter(t -> t.solver_options == "basic", all_df)
inst_df = select(one_solver, :num_cones => ByRow(log10) => :numcones, [:n, :p, :q] => ((x, y, z) -> log10.(x .+ y .+ z)) => :npq)
basic_solver = filter(t -> t.solver_options == "basic", all_df)
inst_df = select(basic_solver,
:num_cones => ByRow(log10) => :lognumcones,
[:n, :p, :q] => ((x, y, z) -> log10.(x .+ y .+ z)) => :lognpq,
)
CSV.write(joinpath(csv_folder, "inststats.csv"), inst_df)
# for solve times, only include converged instances
solve_times = filter(t -> t.conv, one_solver)
CSV.write(joinpath(csv_folder, "solvetimes.csv"), select(solve_times, :solve_time => ByRow(log10) => :time))
# for other stats, only include converged instances
basic_solver_conv = filter(t -> t.conv, basic_solver)
CSV.write(joinpath(csv_folder, "basicinststats.csv"), select(basic_solver_conv,
:solve_time,
:solve_time => ByRow(log10) => :log_solve_time,
[:n, :p, :q] => ((x, y, z) -> x .+ y .+ z) => :npq,
),)
# use shift for proportion in uprhs
shift_solver = filter(t -> t.solver_options == "shift", all_df)
shift_solver_conv = filter(t -> t.conv, shift_solver)
CSV.write(joinpath(csv_folder, "shiftinststats.csv"), select(shift_solver_conv,
[:time_uprhs, :solve_time] => ((x, y) -> log10.(x ./ y)) => :logproprhs,
[:time_uprhs, :solve_time] => ((x, y) -> x ./ y) => :proprhs,
),)
# for relative improvement, include only basic and shift, and then only instances where both converged
two_solver = filter(t -> t.solver_options in ("basic", "shift"), all_df)
two_solver = combine(groupby(two_solver, :inst_key), names(all_df), :conv => all => :two_conv)
two_solver_conv = filter(t -> t.two_conv, two_solver)
two_solver_conv = combine(groupby(two_solver_conv, :inst_key), names(two_solver_conv), :solve_time => (x -> (x[1] - x[2]) / x[1]) => :improvement)
CSV.write(joinpath(csv_folder, "basicshiftinststats.csv"), select(two_solver_conv, :solve_time, :improvement))

# only used to get list of cones manually
ex_df = combine(groupby(one_solver, :example),
ex_df = combine(groupby(basic_solver, :example),
:cone_types => (x -> union(eval.(Meta.parse.(x)))) => :cones,
:cone_types => length => :num_instances,
)
Expand Down
14 changes: 7 additions & 7 deletions examples/matrixcompletion/JuMP_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ insts["slow"] = [
((10, 18),),
]
insts["various"] = [
((5, 8),),
((5, 8), ExpPSDOptimizer),
((5, 8), SOCExpPSDOptimizer),
((5, 12),),
((5, 12), SOCExpPSDOptimizer),
((5, 16),),
((5, 20),),
((10, 20),),
((10, 20), ExpPSDOptimizer),
((10, 20), SOCExpPSDOptimizer),
((10, 25),),
((10, 25), SOCExpPSDOptimizer),
((10, 25),),
((10, 30),),
]
return (MatrixCompletionJuMP, insts)
8 changes: 4 additions & 4 deletions examples/matrixcompletion/native_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ insts["slow"] = [
((18, 180, true, true, false, false),),
]
insts["various"] = [
((5, 50, true, true, true, true),),
((5, 50, true, true, true, false),),
((10, 50, true, true, true, true),),
((10, 100, true, true, true, true),),
((5, 100, true, true, true, true),),
((5, 100, true, true, true, false),),
((10, 200, true, true, true, true),),
((10, 200, true, true, true, true),),
]
return (MatrixCompletionNative, insts)