Skip to content

Commit

Permalink
Use nothing for initializing path matrix in the controller
Browse files Browse the repository at this point in the history
  • Loading branch information
ba2tro committed Nov 26, 2024
1 parent 160c579 commit 62a420c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/controlplane/2a_cnc_interactive.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include("setup.jl")

controller = Controller(sim, net, 6, zeros(8,8))
controller = Controller(sim, net, 6, fill(nothing, 8, 8))
@process controller()

req_gen = RequestGenerator(sim, net, 1, 8, 6)
Expand Down
4 changes: 2 additions & 2 deletions src/ProtocolZoo/ProtocolZoo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ end
error("`EntanglementTracker` on node $(prot.node) received a message $(msg) that it does not know how to handle (due to the absence of corresponding `EntanglementCounterpart` or `EntanglementHistory` or `EntanglementDelete` tags). This might have happened due to `CutoffProt` deleting qubits while swaps are happening. Make sure that the retention times in `CutoffProt` are sufficiently larger than the `agelimit` in `SwapperProt`. Otherwise, this is a bug in the protocol and should not happen -- please report an issue at QuantumSavory's repository.")
end
end
# @debug "EntanglementTracker @$(prot.node): Starting message wait at $(now(prot.sim)) with MessageBuffer containing: $(mb.buffer)"
@debug "EntanglementTracker @$(prot.node): Starting message wait at $(now(prot.sim)) with MessageBuffer containing: $(mb.buffer)"
@yield wait(mb)
@debug "EntanglementTracker @$(prot.node): Message wait ends at $(now(prot.sim))"
end
Expand Down Expand Up @@ -547,7 +547,7 @@ end
end
end
end
# @debug "RequestTracker @$(prot.node): Starting message wait at $(now(prot.sim)) with MessageBuffer containing: $(mb.buffer)"
@debug "RequestTracker @$(prot.node): Starting message wait at $(now(prot.sim)) with MessageBuffer containing: $(mb.buffer)"
@yield wait(mb)
@debug "RequestTracker @$(prot.node): Message wait ends at $(now(prot.sim))"
end
Expand Down
6 changes: 3 additions & 3 deletions src/ProtocolZoo/controllers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ See also [`RequestGenerator`](@ref), [`RequestTracker`](@ref)
"""The node in the network where the control protocol is physically located, ideally a centrally located node"""
node::Int
"""A matrix for the object containing physical graph metadata for the network"""
path_mat::Matrix{Union{Float64, PathMetadata}}
path_mat::Matrix{Union{Nothing, PathMetadata}}
end

@resumable function (prot::Controller)()
Expand All @@ -84,7 +84,7 @@ end
msg = querydelete!(mb, DistributionRequest, ❓, ❓)
if !isnothing(msg)
(msg_src, (_, src, dst)) = msg
if typeof(prot.path_mat[src, dst]) <: Number
if isnothing(prot.path_mat[src, dst])
prot.path_mat[src, dst] = PathMetadata(prot.net.graph, src, dst, Int(length(prot.net[1].staterefs)/2))
end
path_id = path_selection(prot.sim, prot.path_mat[src, dst])
Expand Down Expand Up @@ -113,7 +113,7 @@ end
end
end
end
# @debug "Controller @$(prot.node): Starting message wait at $(now(prot.sim)) with MessageBuffer containing: $(mb.buffer)"
@debug "Controller @$(prot.node): Starting message wait at $(now(prot.sim)) with MessageBuffer containing: $(mb.buffer)"
@yield wait(mb)
@debug "Controller @$(prot.node): Message wait ends at $(now(prot.sim))"
end
Expand Down

0 comments on commit 62a420c

Please sign in to comment.