diff --git a/Project.toml b/Project.toml index c7f5e43..59821d8 100644 --- a/Project.toml +++ b/Project.toml @@ -4,6 +4,7 @@ authors = ["Dimitri Lozeve "] version = "0.1.0" [deps] +CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" [compat] diff --git a/src/GardenOptim.jl b/src/GardenOptim.jl index c880dcf..c1d4f1f 100644 --- a/src/GardenOptim.jl +++ b/src/GardenOptim.jl @@ -1,5 +1,6 @@ module GardenOptim +using CSV using Logging export update! @@ -46,5 +47,13 @@ function update!(grid::Array{Int, 2}, costs::Array{Float64, 2}, beta::Float64 = grid end +function loadcosts() + df = CSV.read("data/costs.csv") + df = coalesce.(df, 0) # replace missing values by 0 + costs = convert(Matrix, df[:, 2:end]) + @debug "cost matrix of size $(size(costs))" + # ensure the matrix is symmetric: keep the max of itself and its transpose + costs = max.(costs, permutedims(costs)) +end end # module