Script for genering results #62
paraynaud
started this conversation in
Show and tell
Replies: 2 comments
-
Generate profiles, you have to create the mandatory sub-repositories: using JSOSolvers, SolverBenchmark, SolverTools, Plots, DataFrames
using NLPModels, NLPModelsModifiers
using CSV
using PartiallySeparableNLPModels
n = 10
include("models.jl")
const max_time = 5.0
const max_eval = 10000
solver = Dict{Symbol,Function}(
:PBFGS => ((prob;kwargs...) -> JSOSolvers.trunk(PBFGSNLPModel(prob); monotone=true, max_eval, verbose=0, kwargs...)),
:PLBFGS => ((prob;kwargs...) -> JSOSolvers.trunk(PLBFGSNLPModel(prob); monotone=true, max_eval, verbose=0, kwargs...)),
:PSR1 => ((prob;kwargs...) -> JSOSolvers.trunk(PSR1NLPModel(prob); monotone=true, max_eval, verbose=0, kwargs...)),
:PLSR1 => ((prob;kwargs...) -> JSOSolvers.trunk(PLSR1NLPModel(prob); monotone=true, max_eval, verbose=0, kwargs...)),
:PSE => ((prob;kwargs...) -> JSOSolvers.trunk(PSENLPModel(prob); monotone=true, max_eval, verbose=0, kwargs...)),
:PLSE => ((prob;kwargs...) -> JSOSolvers.trunk(PLSENLPModel(prob); monotone=true, max_eval, verbose=0, kwargs...)),
:PCS => ((prob;kwargs...) -> JSOSolvers.trunk(PCSNLPModel(prob); monotone=true, max_eval, verbose=0, kwargs...)),
:PS => ((prob;kwargs...) -> JSOSolvers.trunk(PSNLPModel(prob); monotone=true, max_eval, verbose=0, kwargs...)),
:LBFGS => ((prob;kwargs...) -> JSOSolvers.trunk(LBFGSModel(prob); monotone=true, max_eval, verbose=0, kwargs...)),
:LSR1 => ((prob;kwargs...) -> JSOSolvers.trunk(LSR1Model(prob); monotone=true, max_eval, verbose=0, kwargs...)),
:TRUNK => ((prob;kwargs...) -> JSOSolvers.trunk(prob; monotone=true, max_eval, verbose=0, kwargs...)),
)
ENV["JULIA_DEBUG"] = SolverBenchmark # show which solver is called
stats = bmark_solvers(solver, ps_problems; max_time)
keys_stats = keys(stats)
# result's path, must be created
path_result = pwd()*"/dvpt/benchmark/results/"
# Show tables
selected_fields = [:name, :nvar, :elapsed_time, :iter, :dual_feas, :status, :objective, :neval_obj, :neval_grad, :neval_hprod, :obj_5grad_5Hv]
for i in keys_stats
println(stdout, "\n" * string(i) )
pretty_stats(stdout, stats[i][!, [:name, :nvar, :elapsed_time, :iter, :dual_feas, :status, :objective, :neval_obj, :neval_grad, :neval_hprod]], tf=tf_markdown)
end
# Show markdow
location_md = string(path_result*"tables.md")
io = open(location_md,"w")
for i in keys_stats
println(io, "\n" * string(i) )
pretty_stats(io, stats[i][!, [:name, :nvar, :elapsed_time, :iter, :dual_feas, :status, :objective, :neval_obj, :neval_grad, :neval_hprod]], tf=tf_markdown)
end
close(io)
cost(df) = (df.status .!= :success) * Inf + df.t
# Write DataFrame
for key in keys_stats
CSV.write(path_result*"dataframes/"*string(key)*".csv", stats[key])
end
# Read previous results
# memorize_keys_stats = [:PLSR1, :PBFGS, :PSE, :PLSE, :PLBFGS, :TRUNK, :PSR1, :PCS, :PS, :TRUNK_LBFGS, :TRUNK_LSR1]
# new_stats = Dict{Symbol, DataFrame}()
# for key in memorize_keys_stats
# new_stats[key] = DataFrame(CSV.File(path_result*"dataframes/"*string(key)*".csv"))
# end
#= Print latex results=#
location_latex = string(path_result*"tables.tex")
io = open(location_latex,"w")
for i in keys_stats
println(io, "\n" * string(i) )
pretty_latex_stats(io, stats[i][!, [:name, :nvar, :elapsed_time, :iter, :dual_feas, :status, :objective, :neval_obj, :neval_grad, :neval_hprod]])
end
close(io)
println("Write profiles")
# Remove printing profiles for servers
ENV["GKSwstype"]=100
# Writing profiles
p_iter = SolverBenchmark.performance_profile(stats, df -> (df.status .!= :first_order) * Inf + df.iter; legend=:bottomright )
savefig(p_iter, path_result*"profiles/iter_profile.pdf")
p_time = SolverBenchmark.performance_profile(stats, df -> (df.status .!= :first_order) * Inf + df.elapsed_time; legend=:bottomright )
savefig(p_time, path_result*"profiles/time_profile.pdf")
p_time = SolverBenchmark.performance_profile(stats, df -> (df.status .!= :first_order) * Inf + df.neval_obj + 5*df.neval_grad; legend=:bottomright )
savefig(p_time, path_result*"profiles/obj_5grad.pdf") |
Beta Was this translation helpful? Give feedback.
0 replies
-
Current results (n=50):
n=200:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Select the partially separable problems,
models.jl
:Beta Was this translation helpful? Give feedback.
All reactions