Skip to content

Commit

Permalink
Move delayedProts out of the loop
Browse files Browse the repository at this point in the history
  • Loading branch information
hanakl committed Jan 16, 2025
1 parent b1c8f5e commit 3c50b2d
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions test/test_protocolzoo_entanglement_consumer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,31 +46,33 @@ for n in 3:30
end

# test for period=nothing

@resumable function delayedProts(sim, net, n)
@yield timeout(sim, 5)
for e in edges(net)
eprot = EntanglerProt(sim, net, e.src, e.dst; rounds=-1, randomize=true, margin=5, hardmargin=3)
@process eprot()
end

for v in 2:n-1
sprot = SwapperProt(sim, net, v; nodeL = <(v), nodeH = >(v), chooseL = argmin, chooseH = argmax, rounds = -1)
@process sprot()
end

for v in vertices(net)
etracker = EntanglementTracker(sim, net, v)
@process etracker()
end
end

for n in 3:30
regsize = 10
net = RegisterNet([Register(regsize) for j in 1:n])
sim = get_time_tracker(net)

@resumable function delayedProts(sim)
@yield timeout(sim, 5)
for e in edges(net)
eprot = EntanglerProt(sim, net, e.src, e.dst; rounds=-1, randomize=true, margin=5, hardmargin=3)
@process eprot()
end

for v in 2:n-1
sprot = SwapperProt(sim, net, v; nodeL = <(v), nodeH = >(v), chooseL = argmin, chooseH = argmax, rounds = -1)
@process sprot()
end

for v in vertices(net)
etracker = EntanglementTracker(sim, net, v)
@process etracker()
end
end
econ = EntanglementConsumer(sim, net, 1, n; period=nothing)
@process econ()
@process delayedProts(sim)
@process delayedProts(sim, net, n)

run(sim, 100)

Expand Down

0 comments on commit 3c50b2d

Please sign in to comment.