Skip to content

Commit

Permalink
Merge pull request #98 from jeremiahpslewis/jpsl/devfix
Browse files Browse the repository at this point in the history
Update devcontainer
  • Loading branch information
jeremiahpslewis authored Sep 20, 2024
2 parents f3fefec + bad4c41 commit a5be2dd
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 26 deletions.
5 changes: 0 additions & 5 deletions .devcontainer/Dockerfile

This file was deleted.

22 changes: 16 additions & 6 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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",
],
}
6 changes: 5 additions & 1 deletion src/AIAPC2020/hooks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/multiprocessing_template_dddc.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using AlgorithmicCompetition
using Statistics
using DataFrames CSV
using DataFrames
using CSV
using Distributed
using Dates

Expand Down
17 changes: 7 additions & 10 deletions test/integration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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,
)
Expand Down
2 changes: 1 addition & 1 deletion viz/a1_viz.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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_...)
Expand Down
4 changes: 2 additions & 2 deletions viz/dddc_viz.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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))
Expand Down

0 comments on commit a5be2dd

Please sign in to comment.