Remove instances from repository; download on the fly

This commit is contained in:
2022-01-20 16:17:48 -06:00
parent fbc4b004cd
commit e41f4d11c2
203 changed files with 11 additions and 54 deletions

View File

@@ -8,6 +8,8 @@ using DataStructures
using GZip
import Base: getindex, time
const INSTANCES_URL = "https://axavier.org/UnitCommitment.jl/0.3/instances"
"""
read_benchmark(name::AbstractString)::UnitCommitmentInstance
@@ -23,7 +25,15 @@ Example
"""
function read_benchmark(name::AbstractString)::UnitCommitmentInstance
basedir = dirname(@__FILE__)
return UnitCommitment.read("$basedir/../../instances/$name.json.gz")
filename = "$basedir/../../instances/$name.json.gz"
url = "$INSTANCES_URL/$name.json.gz"
if !isfile(filename)
@info "Downloading: $(url)"
dpath = download(url)
mkpath(dirname(filename))
cp(dpath, filename)
end
return UnitCommitment.read(filename)
end
"""