diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a946c0b..6bbbb6f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,19 @@ jobs: - '2' arch: - x64 + include: + - arch: aarch64 + os: macos-latest + version: '1' + threads: '1' + - arch: x64 + os: macos-latest + version: '1' + threads: '1' + - arch: x64 + os: windows-latest + version: '1' + threads: '1' steps: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index fb0f502..f1f2c68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # News +## v0.6.0 - 2024-09-13 + +- Simplify one of the switch protocols to avoid dependence on GraphMatching.jl which does not install well on non-linux systems. Do not rely on the default `SimpleSwitchDiscreteProt` for the time being. ## v0.5.0 - 2024-09-05 diff --git a/Project.toml b/Project.toml index c021739..716f233 100644 --- a/Project.toml +++ b/Project.toml @@ -1,18 +1,15 @@ name = "QuantumSavory" uuid = "2de2e421-972c-4cb5-a0c3-999c85908079" authors = ["Stefan Krastanov "] -version = "0.5" +version = "0.6" [deps] -Cbc = "9961bab8-2fa3-5c5a-9d89-47fab24efd76" Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" ConcurrentSim = "6ed1e86c-fcaf-46a9-97e0-2b26a2cdb499" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" -GraphsMatching = "c3af3a8c-b79e-4b01-bf44-c718d7e0e0d6" IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e" -JuMP = "4076af6c-e467-56ae-b986-b466b2749572" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" NetworkLayout = "46757867-2c16-5918-afeb-47bfcb05e46a" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" @@ -35,15 +32,12 @@ Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" QuantumSavoryMakie = "Makie" [compat] -Cbc = "1.2" Combinatorics = "1" ConcurrentSim = "1.4.1" Distributions = "0.25.90" DocStringExtensions = "0.9" Graphs = "1.9" -GraphsMatching = "0.2" IterTools = "1.4.0" -JuMP = "1.21.1" LinearAlgebra = "1" Makie = "0.20, 0.21" NetworkLayout = "0.4.4" diff --git a/examples/simpleswitch/Project.toml b/examples/simpleswitch/Project.toml index e2bb24c..07adacf 100644 --- a/examples/simpleswitch/Project.toml +++ b/examples/simpleswitch/Project.toml @@ -4,6 +4,7 @@ ConcurrentSim = "6ed1e86c-fcaf-46a9-97e0-2b26a2cdb499" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" QuantumSavory = "2de2e421-972c-4cb5-a0c3-999c85908079" +QuantumSymbolics = "efa7fd63-0460-4890-beb7-be1bbdfbaeae" ResumableFunctions = "c5292f4c-5179-55e1-98c5-05642aab7184" Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" WGLMakie = "276b4fcb-3e11-5398-bf8b-a0c2d153d008" diff --git a/src/ProtocolZoo/switches.jl b/src/ProtocolZoo/switches.jl index 05fb3e8..2b1ac82 100644 --- a/src/ProtocolZoo/switches.jl +++ b/src/ProtocolZoo/switches.jl @@ -4,14 +4,13 @@ using QuantumSavory using QuantumSavory.ProtocolZoo using QuantumSavory.ProtocolZoo: EntanglementCounterpart, AbstractProtocol using Graphs: edges, complete_graph, neighbors -using GraphsMatching: maximum_weight_matching +#using GraphsMatching: maximum_weight_matching # TODO-MATCHING due to the dependence on BlossomV.jl this has trouble installing. See https://github.com/JuliaGraphs/GraphsMatching.jl/issues/14 using Combinatorics: combinations -using JuMP: MOI, optimizer_with_attributes -import Cbc using DocStringExtensions: TYPEDEF, TYPEDFIELDS using ConcurrentSim: @process, timeout, Simulation, Process #using ResumableFunctions: @resumable, @yield # TODO serious bug that makes it not work without full `using` using ResumableFunctions +using Random export SimpleSwitchDiscreteProt, SwitchRequest @@ -65,6 +64,9 @@ julia> let ``` """ function promponas_bruteforce_choice(M,N,backlog,eprobs) # TODO mark as public but unexported + @warn "The switch optimization routine is using a random placeholder optimization method due to issues with installing the BlossomV algorithm. Do not rely on this code to validate research results." + return randperm(N)[1:M] + # TODO-MATCHING due to the dependence on BlossomV.jl this has trouble installing. See https://github.com/JuliaGraphs/GraphsMatching.jl/issues/14 best_weight = 0.0 best_assignment = zeros(Int, M) graphs = [complete_graph(i) for i in 1:M] # preallocating them to avoid expensive allocations in the inner loop @@ -298,9 +300,14 @@ function _switch_successful_entanglements_best_match(prot, reverseclientindex) end # get the maximum match for the actually connected nodes ne = length(entangled_clients) + if ne < 2 return nothing end entangled_clients_revindex = [reverseclientindex[k] for k in entangled_clients] @debug "Switch $(prot.switchnode) successfully entangled with clients $entangled_clients" # (indexed as $entangled_clients_revindex)" - (;weight, mate) = match_entangled_pattern(prot.backlog, entangled_clients_revindex, complete_graph(ne), zeros(Int, ne, ne)) + + # TODO-MATCHING due to the dependence on BlossomV.jl this has trouble installing. See https://github.com/JuliaGraphs/GraphsMatching.jl/issues/14 + # (;weight, mate) = match_entangled_pattern(prot.backlog, entangled_clients_revindex, complete_graph(ne), zeros(Int, ne, ne)) + mate = collect(zip(entangled_clients_revindex[1:2:end], entangled_clients_revindex[2:2:end])) + isempty(mate) && return nothing return mate end diff --git a/test/test_examples.jl b/test/test_examples.jl index 502776a..d504af1 100644 --- a/test/test_examples.jl +++ b/test/test_examples.jl @@ -32,7 +32,8 @@ end @safetestset "simpleswitch" begin if get(ENV,"QUANTUMSAVORY_PLOT_TEST","")=="true" - include("../examples/simpleswitch/1_interactive_visualization.jl") + # TODO-MATCHING due to the dependence on BlossomV.jl this has trouble installing. See https://github.com/JuliaGraphs/GraphsMatching.jl/issues/14 + #include("../examples/simpleswitch/1_interactive_visualization.jl") end end diff --git a/test/test_protocolzoo_switch.jl b/test/test_protocolzoo_switch.jl index 004ae40..1970e50 100644 --- a/test/test_protocolzoo_switch.jl +++ b/test/test_protocolzoo_switch.jl @@ -39,6 +39,8 @@ end @process switch() run(sim, 30) res = query(net[2], EntanglementCounterpart, ❓, ❓) - @test abs(observable([res.slot, net[3][res.tag[3]]], X⊗X)) ≈ 1.0 # we are not running an EntanglementTracker so Pauli corrections are not applied - @test abs(observable([res.slot, net[3][res.tag[3]]], Z⊗Z)) ≈ 1.0 # we are not running an EntanglementTracker so Pauli corrections are not applied + + # TODO-MATCHING due to the dependence on BlossomV.jl this has trouble installing. See https://github.com/JuliaGraphs/GraphsMatching.jl/issues/14 + #@test abs(observable([res.slot, net[3][res.tag[3]]], X⊗X)) ≈ 1.0 # we are not running an EntanglementTracker so Pauli corrections are not applied + #@test abs(observable([res.slot, net[3][res.tag[3]]], Z⊗Z)) ≈ 1.0 # we are not running an EntanglementTracker so Pauli corrections are not applied end diff --git a/test/test_stateszoo_api.jl b/test/test_stateszoo_api.jl index cd4ed1f..cc2423b 100644 --- a/test/test_stateszoo_api.jl +++ b/test/test_stateszoo_api.jl @@ -34,8 +34,8 @@ r_drms = Register(2) initialize!(r_drms[1:2], drms) @test ! iszero(observable(r_drms[1:2], Z⊗Z)) -@test tr(zalm) == tr(express(zalm)) +@test tr(zalm) ≈ tr(express(zalm)) -@test tr(srms) == tr(express(srms)) +@test tr(srms) ≈ tr(express(srms)) -@test tr(drms) == tr(express(drms)) \ No newline at end of file +@test tr(drms) ≈ tr(express(drms)) \ No newline at end of file