Skip to content

solverKey -> solveKey, fix #599 #602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions src/CloudGraphsDFG/services/CloudGraphsDFG.jl
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ function getVariable(dfg::CloudGraphsDFG, label::Union{Symbol, String})
for ppe in listPPEs(dfg, label)
variable.ppeDict[ppe] = getPPE(dfg, label, ppe)
end
for solverKey in listVariableSolverData(dfg, label)
variable.solverDataDict[solverKey] = getVariableSolverData(dfg, label, solverKey)
for solveKey in listVariableSolverData(dfg, label)
variable.solverDataDict[solveKey] = getVariableSolverData(dfg, label, solveKey)
end
dataDict = getDataEntries(dfg, label)
for (k,v) in dataDict
Expand Down Expand Up @@ -543,7 +543,7 @@ function _unpackPPE(dfg::G, packedPPE::Dict{String, Any})::AbstractPointParametr
end

function listPPEs(dfg::CloudGraphsDFG, variablekey::Symbol; currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::Vector{Symbol}
return _listVarSubnodesForType(dfg, variablekey, MeanMaxPPE, "solverKey"; currentTransaction=currentTransaction)
return _listVarSubnodesForType(dfg, variablekey, MeanMaxPPE, "solveKey"; currentTransaction=currentTransaction)
end

function getPPE(dfg::CloudGraphsDFG, variablekey::Symbol, ppekey::Symbol=:default; currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::AbstractPointParametricEst
Expand Down Expand Up @@ -578,8 +578,8 @@ function addPPE!(dfg::CloudGraphsDFG,
ppe::P;
currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::AbstractPointParametricEst where
{P <: AbstractPointParametricEst}
if ppe.solverKey in listPPEs(dfg, variablekey, currentTransaction=currentTransaction)
error("PPE '$(ppe.solverKey)' already exists")
if ppe.solveKey in listPPEs(dfg, variablekey, currentTransaction=currentTransaction)
error("PPE '$(ppe.solveKey)' already exists")
end
softType = getSofttype(dfg, variablekey)
# Add additional properties for the PPE
Expand All @@ -600,8 +600,8 @@ function updatePPE!(
ppe::P;
currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::P where
{P <: AbstractPointParametricEst}
if !(ppe.solverKey in listPPEs(dfg, variablekey, currentTransaction=currentTransaction))
@warn "PPE '$(ppe.solverKey)' does not exist, adding"
if !(ppe.solveKey in listPPEs(dfg, variablekey, currentTransaction=currentTransaction))
@warn "PPE '$(ppe.solveKey)' does not exist, adding"
end
softType = getSofttype(dfg, variablekey, currentTransaction=currentTransaction)
# Add additional properties for the PPE
Expand Down Expand Up @@ -727,20 +727,20 @@ function _unpackVariableNodeData(dfg::G, packedDict::Dict{String, Any})::Variabl
end

function listVariableSolverData(dfg::CloudGraphsDFG, variablekey::Symbol; currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::Vector{Symbol}
return _listVarSubnodesForType(dfg, variablekey, VariableNodeData, "solverKey"; currentTransaction=currentTransaction)
return _listVarSubnodesForType(dfg, variablekey, VariableNodeData, "solveKey"; currentTransaction=currentTransaction)
end

function getVariableSolverData(dfg::CloudGraphsDFG, variablekey::Symbol, solverKey::Symbol=:default; currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::VariableNodeData
properties = _getVarSubnodeProperties(dfg, variablekey, VariableNodeData, solverKey; currentTransaction=currentTransaction)
function getVariableSolverData(dfg::CloudGraphsDFG, variablekey::Symbol, solveKey::Symbol=:default; currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::VariableNodeData
properties = _getVarSubnodeProperties(dfg, variablekey, VariableNodeData, solveKey; currentTransaction=currentTransaction)
return _unpackVariableNodeData(dfg, properties)
end

function addVariableSolverData!(dfg::CloudGraphsDFG,
variablekey::Symbol,
vnd::VariableNodeData;
currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::VariableNodeData
if vnd.solverKey in listVariableSolverData(dfg, variablekey, currentTransaction=currentTransaction)
error("Solver data '$(vnd.solverKey)' already exists")
if vnd.solveKey in listVariableSolverData(dfg, variablekey, currentTransaction=currentTransaction)
error("Solver data '$(vnd.solveKey)' already exists")
end
retPacked = _matchmergeVariableSubnode!(
dfg,
Expand All @@ -758,8 +758,8 @@ function updateVariableSolverData!(dfg::CloudGraphsDFG,
useCopy::Bool=true,
fields::Vector{Symbol}=Symbol[];
currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::VariableNodeData
if !(vnd.solverKey in listVariableSolverData(dfg, variablekey, currentTransaction=currentTransaction))
@warn "Solver data '$(vnd.solverKey)' does not exist, adding rather than updating."
if !(vnd.solveKey in listVariableSolverData(dfg, variablekey, currentTransaction=currentTransaction))
@warn "Solver data '$(vnd.solveKey)' does not exist, adding rather than updating."
end
# TODO: Update this to use the selective parameters from fields.
retPacked = _matchmergeVariableSubnode!(
Expand All @@ -772,13 +772,13 @@ function updateVariableSolverData!(dfg::CloudGraphsDFG,
return _unpackVariableNodeData(dfg, retPacked)
end

function deleteVariableSolverData!(dfg::CloudGraphsDFG, variablekey::Symbol, solverKey::Symbol=:default; currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::VariableNodeData
function deleteVariableSolverData!(dfg::CloudGraphsDFG, variablekey::Symbol, solveKey::Symbol=:default; currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::VariableNodeData
retPacked = _deleteVarSubnode!(
dfg,
variablekey,
:SOLVERDATA,
_getLabelsForType(dfg, VariableNodeData, parentKey=variablekey),
solverKey,
solveKey,
currentTransaction=currentTransaction)
return _unpackVariableNodeData(dfg, retPacked)
end
Expand Down Expand Up @@ -839,12 +839,12 @@ function updateVariableSolverData!(dfg::CloudGraphsDFG,
end

function mergeVariableSolverData!(dfg::CloudGraphsDFG, sourceVariable::DFGVariable)
for solverKey in listVariableSolverData(dfg, sourceVariable.label)
for solveKey in listVariableSolverData(dfg, sourceVariable.label)
updateVariableSolverData!(
dfg,
sourceVariable.label,
getVariableSolverData(dfg, sourceVariable, solverKey),
solverKey)
getVariableSolverData(dfg, sourceVariable, solveKey),
solveKey)
end
end

Expand Down
8 changes: 4 additions & 4 deletions src/CloudGraphsDFG/services/CommonFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ function _getLabelsForInst(dfg::CloudGraphsDFG,
labels = _getLabelsForType(dfg, typeof(inst), parentKey=parentKey)
typeof(inst) <: DFGVariable && push!(labels, String(getLabel(inst)))
typeof(inst) <: DFGFactor && push!(labels, String(getLabel(inst)))
typeof(inst) <: AbstractPointParametricEst && push!(labels, String(inst.solverKey))
typeof(inst) <: VariableNodeData && push!(labels, String(inst.solverKey))
typeof(inst) <: AbstractPointParametricEst && push!(labels, String(inst.solveKey))
typeof(inst) <: VariableNodeData && push!(labels, String(inst.solveKey))
typeof(inst) <: AbstractDataEntry && push!(labels, String(inst.label))
return labels
end
Expand Down Expand Up @@ -316,8 +316,8 @@ function _matchmergeVariableSubnode!(
result = commit(tx)
end
length(result.errors) > 0 && error(string(result.errors))
length(result.results[1]["data"]) != 1 && error("Cannot find subnode '$(ppe.solverKey)' for variable '$variablekey'")
length(result.results[1]["data"][1]["row"]) != 1 && error("Cannot find subnode '$(ppe.solverKey)' for variable '$variablekey'")
length(result.results[1]["data"]) != 1 && error("Cannot find subnode '$(ppe.solveKey)' for variable '$variablekey'")
length(result.results[1]["data"][1]["row"]) != 1 && error("Cannot find subnode '$(ppe.solveKey)' for variable '$variablekey'")
return result.results[1]["data"][1]["row"][1]
end

Expand Down
2 changes: 1 addition & 1 deletion src/Deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
##==============================================================================
## Remove in 0.11
##==============================================================================
@deprecate addVariableSolverData!(dfg::AbstractDFG, variablekey::Symbol, vnd::VariableNodeData, solverKey::Symbol) addVariableSolverData!(dfg, variablekey, vnd)
@deprecate addVariableSolverData!(dfg::AbstractDFG, variablekey::Symbol, vnd::VariableNodeData, solveKey::Symbol) addVariableSolverData!(dfg, variablekey, vnd)

@deprecate updatePPE!(dfg::AbstractDFG, variablekey::Symbol, ppe::AbstractPointParametricEst, ppekey::Symbol) updatePPE!(dfg, variablekey, ppe)

Expand Down
30 changes: 15 additions & 15 deletions src/entities/DFGVariable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ mutable struct VariableNodeData{T<:InferenceVariable}
dontmargin::Bool
solveInProgress::Int
solvedCount::Int
solverKey::Symbol
solveKey::Symbol
events::Dict{Symbol,Threads.Condition}
VariableNodeData{T}(; solverKey::Symbol=:default) where {T <:InferenceVariable} =
new{T}(zeros(1,1), zeros(1,1), Symbol[], Int[], 0, false, :NOTHING, Symbol[], T(), false, 0.0, false, false, 0, 0, solverKey, Dict{Symbol,Threads.Condition}())
VariableNodeData{T}(; solveKey::Symbol=:default) where {T <:InferenceVariable} =
new{T}(zeros(1,1), zeros(1,1), Symbol[], Int[], 0, false, :NOTHING, Symbol[], T(), false, 0.0, false, false, 0, 0, solveKey, Dict{Symbol,Threads.Condition}())
VariableNodeData{T}(val::Array{Float64,2},
bw::Array{Float64,2},
BayesNetOutVertIDs::Array{Symbol,1},
Expand All @@ -50,12 +50,12 @@ mutable struct VariableNodeData{T<:InferenceVariable}
dontmargin::Bool,
solveInProgress::Int=0,
solvedCount::Int=0,
solverKey::Symbol=:default,
solveKey::Symbol=:default,
events::Dict{Symbol,Threads.Condition}=Dict{Symbol,Threads.Condition}()) where T <: InferenceVariable =
new{T}(val,bw,BayesNetOutVertIDs,dimIDs,dims,
eliminated,BayesNetVertID,separator,
softtype::T,initialized,inferdim,ismargin,
dontmargin, solveInProgress, solvedCount, solverKey, events)
dontmargin, solveInProgress, solvedCount, solveKey, events)
end

##------------------------------------------------------------------------------
Expand All @@ -75,17 +75,17 @@ VariableNodeData(val::Array{Float64,2},
dontmargin::Bool,
solveInProgress::Int=0,
solvedCount::Int=0,
solverKey::Symbol=:default
solveKey::Symbol=:default
) where T <: InferenceVariable =
VariableNodeData{T}(val,bw,BayesNetOutVertIDs,dimIDs,dims,
eliminated,BayesNetVertID,separator,
softtype::T,initialized,inferdim,ismargin,
dontmargin, solveInProgress, solvedCount,
solverKey)
solveKey)


VariableNodeData(softtype::T; solverKey::Symbol=:default) where T <: InferenceVariable =
VariableNodeData{T}(zeros(1,1), zeros(1,1), Symbol[], Int[], 0, false, :NOTHING, Symbol[], softtype, false, 0.0, false, false, 0, 0, solverKey)
VariableNodeData(softtype::T; solveKey::Symbol=:default) where T <: InferenceVariable =
VariableNodeData{T}(zeros(1,1), zeros(1,1), Symbol[], Int[], 0, false, :NOTHING, Symbol[], softtype, false, 0.0, false, false, 0, 0, solveKey)

##==============================================================================
## PackedVariableNodeData.jl
Expand Down Expand Up @@ -117,7 +117,7 @@ mutable struct PackedVariableNodeData
dontmargin::Bool
solveInProgress::Int
solvedCount::Int
solverKey::Symbol
solveKey::Symbol
PackedVariableNodeData() = new()
PackedVariableNodeData(x1::Vector{Float64},
x2::Int,
Expand All @@ -136,7 +136,7 @@ mutable struct PackedVariableNodeData
x15::Bool,
x16::Int,
solvedCount::Int,
solverKey::Symbol) = new(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16, solvedCount, solverKey)
solveKey::Symbol) = new(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16, solvedCount, solveKey)
# More permissive constructor needed for unmarshalling
PackedVariableNodeData(x1::Vector,
x2::Int,
Expand All @@ -155,12 +155,12 @@ mutable struct PackedVariableNodeData
x15::Bool,
x16::Int,
solvedCount::Int,
solverKey::Symbol) = new(
solveKey::Symbol) = new(
convert(Vector{Float64},x1),x2,
convert(Vector{Float64},x3),x4,
convert(Vector{Symbol},x5),
convert(Vector{Int},x6),x7,x8,x9,
convert(Vector{Symbol},x10),x11,x12,x13,x14,x15,x16, solvedCount, solverKey)
convert(Vector{Symbol},x10),x11,x12,x13,x14,x15,x16, solvedCount, solveKey)
end

##==============================================================================
Expand All @@ -182,7 +182,7 @@ abstract type AbstractPointParametricEst end
Data container to store Parameteric Point Estimate (PPE) for mean and max.
"""
struct MeanMaxPPE <: AbstractPointParametricEst
solverKey::Symbol #repeated because of Sam's request
solveKey::Symbol #repeated because of Sam's request
suggested::Vector{Float64}
max::Vector{Float64}
mean::Vector{Float64}
Expand All @@ -192,7 +192,7 @@ end
##------------------------------------------------------------------------------
## Constructors

MeanMaxPPE(solverKey::Symbol, suggested::Vector{Float64}, max::Vector{Float64}, mean::Vector{Float64}) = MeanMaxPPE(solverKey, suggested, max, mean, now(UTC))
MeanMaxPPE(solveKey::Symbol, suggested::Vector{Float64}, max::Vector{Float64}, mean::Vector{Float64}) = MeanMaxPPE(solveKey, suggested, max, mean, now(UTC))

## Metadata
"""
Expand Down
Loading