Skip to content

Commit

Permalink
remove blossom does not compile on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
Luisenden authored and Krastanov committed Sep 13, 2024
1 parent 4eeb57a commit 83bfb88
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 12 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ authors = ["Stefan Krastanov <[email protected]>"]
version = "0.5"

[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"
Expand All @@ -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"
Expand Down
1 change: 1 addition & 0 deletions examples/simpleswitch/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 11 additions & 4 deletions src/ProtocolZoo/switches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions test/test_protocolzoo_switch.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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]]], XX)) 1.0 # we are not running an EntanglementTracker so Pauli corrections are not applied
@test abs(observable([res.slot, net[3][res.tag[3]]], ZZ)) 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

0 comments on commit 83bfb88

Please sign in to comment.