Skip to content

Commit

Permalink
Update data processing
Browse files Browse the repository at this point in the history
  • Loading branch information
pedromxavier committed Oct 15, 2024
1 parent 8a9bdf9 commit 1b8024f
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 24 deletions.
26 changes: 13 additions & 13 deletions scripts/build/library/deploy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ function deploy!(path::AbstractString)
write(joinpath(QUBOLib.build_path(path), "tar-ball.hash"), tar_ball_hash)

# Retrieve last QUBOLib tag
# last_tag = read(joinpath(QUBOLib.build_path(path), "last.tag"), String)
# next_tag = next_data_tag(last_tag)
last_tag = read(joinpath(QUBOLib.build_path(path), "last.tag"), String)
next_tag = next_data_tag(last_tag)

# write(joinpath(QUBOLib.build_path(path), "next.tag"), next_tag)
write(joinpath(QUBOLib.build_path(path), "next.tag"), next_tag)

# # Write Artifacts.toml entry
# artifact_entry = """
# [qubolib]
# git-tree-sha1 = "$(git_tree_hash)"
# lazy = true
# Write Artifacts.toml entry
artifact_entry = """
[qubolib]
git-tree-sha1 = "$(git_tree_hash)"
lazy = true
# [[qubolib.download]]
# url = "https://github.com/JuliaQUBO/QUBOLib.jl/releases/download/$(qubolib_tag)/qubolib.tar.gz"
# sha256 = "$(tar_ball_hash)"
# """
[[qubolib.download]]
url = "https://github.com/JuliaQUBO/QUBOLib.jl/releases/download/$(qubolib_tag)/qubolib.tar.gz"
sha256 = "$(tar_ball_hash)"
"""

# write(joinpath(QUBOLib.build_path(path), "Artifacts.toml"), artifact_entry)
write(joinpath(QUBOLib.build_path(path), "Artifacts.toml"), artifact_entry)

return nothing
end
Expand Down
34 changes: 28 additions & 6 deletions scripts/build/sources/hen.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const HEN_DATA = Dict(
"arXiv-1903-10928-3r3x" => Dict(
:url => "https://sites.usc.edu/itayhen/files/2019/09/3r3x.zip",
:url => "https://github.com/JuliaQUBO/QUBOLib.jl/releases/download/mirror-v0/arXiv-1903-10928-3r3x.zip",
:data => Dict{String,Any}(
"name" => "3-Regular 3-XORSAT (arXiv:1903.10928)",
"author" => ["Itay Hen"],
Expand All @@ -10,7 +10,7 @@ const HEN_DATA = Dict(
),
),
"arXiv-1903-10928-5r5x" => Dict(
:url => "https://sites.usc.edu/itayhen/files/2019/09/5r5x.zip",
:url => "https://github.com/JuliaQUBO/QUBOLib.jl/releases/download/mirror-v0/arXiv-1903-10928-5r5x.zip",
:data => Dict{String,Any}(
"name" => "5-Regular 5-XORSAT (arXiv:1903.10928)",
"author" => ["Itay Hen"],
Expand All @@ -20,7 +20,7 @@ const HEN_DATA = Dict(
),
),
"arXiv-2103-08464-3r3x" => Dict(
:url => "https://unmm-my.sharepoint.com/personal/talbash_unm_edu/_layouts/15/download.aspx?SourceUrl=%2Fpersonal%2Ftalbash%5Funm%5Fedu%2FDocuments%2FWebsiteData%2FarXiv210308464%2F3r3x%5F2body%2Ezip",
:url => "https://github.com/JuliaQUBO/QUBOLib.jl/releases/download/mirror-v0/arXiv-2103-08464-3r3x.zip",
:data => Dict{String,Any}(
"name" => "3-Regular 3-XORSAT (arXiv:2103.08464)",
"author" => ["Matthew Kowalsky", "Tameem Albash", "Itay Hen", "Daniel A. Lidar"],
Expand Down Expand Up @@ -51,7 +51,9 @@ function load_hen!(index::QUBOLib.LibraryIndex, code::AbstractString)

@info "[$code] Extracting archive"

run(`unzip -qq -o -j $file_path 'instance*.txt' -d $data_path`)
run(`unzip -qq -o -j $file_path '*.txt' -d $data_path`)

patch_hen!(index, code)

return nothing
end
Expand Down Expand Up @@ -89,7 +91,7 @@ function build_hen!(index::QUBOLib.LibraryIndex, code::AbstractString; cache::Bo
catch e
if e isa QUBOTools.SyntaxError
@warn """
[$code] Failed to read instance '$path':
[$code] Failed to read instance @ '$path':
$(sprint(showerror, e))
"""

Expand All @@ -102,7 +104,27 @@ function build_hen!(index::QUBOLib.LibraryIndex, code::AbstractString; cache::Bo
mod_i = QUBOLib.add_instance!(index, model, code; name = basename(path))

if isnothing(mod_i)
@warn "[$code] Failed to read instance '$path'"
@warn "[$code] Failed to read instance @ '$path'"
end
end

return nothing
end

function patch_hen!(index::QUBOLib.LibraryIndex, code::AbstractString)
@info "[$code] Applying patches"

if code == "arXiv-1903-10928-5r5x"
let path = abspath(QUBOLib.cache_data_path(index, code), "._instance_5r5x_n24_s265.txt")
@info "[$code] Removing '$path'"

rm(path; force = true)
end
elseif code == "arXiv-1903-10928-3r3x"
let path = abspath(QUBOLib.cache_data_path(index, code), "instance_3r3x_n35_s2301.txt")
@info "[$code] Removing '$path'"

rm(path; force = true)
end
end

Expand Down
10 changes: 5 additions & 5 deletions src/QUBOLib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ const QUBOLIB_LOGO = raw"""
┃ ██ ▀▀▄███ ██ ██ ██ ██ ██ ██ ┃
┃ ▀██████▀▄▄ ▀██████▀ █████▀ ▀██████▀ ┃
┃ ┃
┃ ██ ██ ██ ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
┃ ██ ██ ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
┃ ██ ██ █████▄
┃ ██ ██ ██ ██ ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
┃ ███████ ██ █████▀ ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
┃ ██ ██ ██ ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
┃ ██ ██ ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
┃ ██ ██ █████▄ ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
┃ ██ ██ ██ ██ ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ ┃
┃ ███████ ██ █████▀ ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
"""

Expand Down

0 comments on commit 1b8024f

Please sign in to comment.