Fix garden output to CSV

This commit is contained in:
Dimitri Lozeve 2020-02-22 18:33:00 +01:00
parent 2b4c21972d
commit 2982cbf42c

View file

@ -3,6 +3,7 @@ module GardenOptim
using Logging using Logging
using DocStringExtensions using DocStringExtensions
using Tables
export loadplants, loadgarden, loadclassification, loadcosts export loadplants, loadgarden, loadclassification, loadcosts
export update!, randomgardenevolution!, outputgarden export update!, randomgardenevolution!, outputgarden
@ -18,9 +19,9 @@ include("loaddata.jl")
include("mcmc.jl") include("mcmc.jl")
"Save the garden to a CSV file." "Save the garden to a CSV file."
function outputgarden(garden::Matrix{Int}, plants::Vector{String}) function outputgarden(garden::Matrix{Int}, plants::Vector{Symbol})
output = vcat([""], plants)[garden .+ 1] output = vcat([""], String.(plants))[garden .+ 1]
CSV.write("output.csv", Tables.table(output), writeheader=false) CSV.write("out/output.csv", Tables.table(output), writeheader=false)
end end
end # module end # module