diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 929a3fbd..00000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM julia:1.10 - -RUN apt-get update && apt-get install -y git - -RUN julia -e 'using Pkg; Pkg.activate("."); Pkg.instantiate()' diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8329d866..79c82594 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,7 +1,17 @@ { - "extensions": [ - "julialang.language-julia" - ], - "runArgs": ["--privileged"], - "dockerFile": "Dockerfile" -} + "image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu-24.04", + "features": { + "ghcr.io/julialang/devcontainer-features/julia": "1.10" + }, + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.fontFamily": "monospace", + "julia.environmentPath": "." + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "quarto.quarto", + "GitHub.copilot", + ], +} \ No newline at end of file diff --git a/src/AIAPC2020/hooks.jl b/src/AIAPC2020/hooks.jl index 77626276..d24f9699 100644 --- a/src/AIAPC2020/hooks.jl +++ b/src/AIAPC2020/hooks.jl @@ -56,7 +56,11 @@ function _best_action_lookup(state_, table) best_action = 1 max_value = table[1, state_] - for i = 2:size(table, 1) + for i = axes(table, 1) + if i == 1 + continue + end + value = table[i, state_] if value > max_value max_value = value diff --git a/src/multiprocessing_template_dddc.jl b/src/multiprocessing_template_dddc.jl index f0fb267d..75615403 100644 --- a/src/multiprocessing_template_dddc.jl +++ b/src/multiprocessing_template_dddc.jl @@ -1,6 +1,7 @@ using AlgorithmicCompetition using Statistics -using DataFrames CSV +using DataFrames +using CSV using Distributed using Dates diff --git a/test/integration.jl b/test/integration.jl index b3fd17f6..e3753563 100644 --- a/test/integration.jl +++ b/test/integration.jl @@ -568,7 +568,7 @@ end ξ = 0.1 δ = 0.95 n_prices = 15 - max_iter = 1000000 + max_iter = Int64(5e6) price_index = 1:n_prices competition_params_dict = Dict( @@ -584,11 +584,11 @@ end δ, max_iter, competition_solution_dict; - convergence_threshold = 100, + convergence_threshold = 500, ) - c_out = run(hyperparameters; stop_on_convergence = false, debug = true) + c_out = run(hyperparameters; stop_on_convergence = true, debug = true) # ensure that the policy is updated by the learner @test sum(c_out.policy[Player(1)].policy.learner.approximator.model .!= 0) != 0 @@ -607,15 +607,12 @@ end c_out.hook[Player(2)][1].best_response_vector - @test mean( - c_out.hook[Player(1)][2].rewards[(end-2):end] .!= - c_out.hook[Player(2)][2].rewards[(end-2):end], - ) >= 0.3 + @test mean(argmax(c_out.policy[Player(1)].policy.learner.approximator.model, dims=1) .!= argmax(c_out.policy[Player(2)].policy.learner.approximator.model, dims=1)) < 0.98 for i in [Player(1), Player(2)] @test c_out.hook[i][1].convergence_duration >= 0 @test c_out.hook[i][1].is_converged - @test c_out.hook[i][1].convergence_threshold == 100 + @test c_out.hook[i][1].convergence_threshold == 500 @test sum(c_out.hook[i][2].rewards .== 0) == 0 end @@ -712,8 +709,8 @@ end for debug in [true, false] AlgorithmicCompetition.run_dddc( n_parameter_iterations = 1, - max_iter = Int(2e5), - convergence_threshold = Int(1e5), + max_iter = Int(1e5), + convergence_threshold = Int(1e2), n_grid_increments = 3, debug = debug, ) diff --git a/viz/a1_viz.jl b/viz/a1_viz.jl index 1512fc52..57311b45 100644 --- a/viz/a1_viz.jl +++ b/viz/a1_viz.jl @@ -22,7 +22,7 @@ csv_files = filter!( df_ = DataFrame.(CSV.File.(csv_files)) -for i = 1:length(df_) +for i = eachindex(df_, 2) df_[i][!, "metadata"] .= csv_files[i] end df = vcat(df_...) diff --git a/viz/dddc_viz.jl b/viz/dddc_viz.jl index 0c091cc8..a1ae83d9 100644 --- a/viz/dddc_viz.jl +++ b/viz/dddc_viz.jl @@ -39,7 +39,7 @@ df_raw_ = arrow_files[.!is_summary_file] if rebuild_summary_files rm.(df_summary_) - @showprogress for i in 1:length(df_raw_) + @showprogress for i in eachindex(df_raw_) df = DataFrame(Arrow.Table(df_raw_[i])) if nrow(df) > 0 df = expand_and_extract_dddc(df) @@ -52,7 +52,7 @@ end if rebuild_overall_summary arrows_ = DataFrame.(Arrow.Table.(df_summary_)) - for i = 1:length(arrows_) + for i = eachindex(arrows_) arrows_[i][!, "metadata"] .= df_summary_[i] if "signal_is_strong" in names(arrows_[i]) arrows_[i] = select!(arrows_[i], Not(:signal_is_strong))