-
Notifications
You must be signed in to change notification settings - Fork 2
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
updateVariableSolverData! bug and API #565
Comments
Add tests for this in DFG |
We should decide how we want to use this. |
originally posted in a comment: #570 (comment) Maybe we shouldn't overwrite expected behaviour from base copy with deepcopy? Personally I don't think we should provide too many functions. Every function has to be documented and maintained.
Is the function we are trying to replace function deepcopySolverData!(dfg::AbstractDFG, label::Symbol, srcKey::Sybol, dstKey::Symbol)
vnd = deepcopy(getSolverData!(dfg, label, srcKey))
vnd.solverKey = dstKey
updateSolverData!(dfg, vnd)
end Now that I'm thinking it through. function addSolverData!(dfg::AbstractDFG, label::Symbol, vnd, solverKey::Symbol)
vnd.solverKey = dstKey
addSolverData!(dfg, vnd)
end |
definitely not change the behaviour of a method from Base. |
No, the idea is just to have the solveKey available inside the structure as a duplicate from the Dict container in which the VND is stored. Nothing crazy, just duplication.
I disagree with the user having to do band-aids for DFG internal duplication decision. |
|
Dehann, I think you are missing the point |
maybe, how I understand it is that Sam asked for a duplicate of the solveKey inside VND. So nothing changes, except that there is a forced duplication of one ::Symbol register.
|
No that is not the issue. The issue is it was used in IIF to copy from one solver data to another. and the key was removed from the parameters completely. I thought to add copy functionality. |
not following
Do you perhaps have the piece of code where that is happening? Links above are only to DFG. |
I'll try and find it. it is where the init solve key is made |
Okay, so that line in IIF is using the I would add---to address the duplication of vnd = getVND(..., :default)
dcvnd = deepcopy(vnd) # solveKey=:default
updateVariableSolverData!(... dcvnd, , :graphinit, ...) In this case, DFG should update PS, I think |
remember the user of VND is probably unaware that there is duplication of |
My and Sam's vote is for vnd = getVND(..., :default)
dcvnd = deepcopy(vnd) # solveKey=:default
vnd.solverKey = :graphinit
addVariableSolverData!(..., dcvnd) Just because ist a little strange to have |
I saw there was a bunch of solvekey and a few solverkey mixed. I think Sam went with solverkey |
i disagree, this is a special case and would rather have: updateVariableSolverData!(..., dcvnd, :newkey, checkSolvekey=false) since the verb is A DFG design decision/requirement is to duplicate The quirk about duplicating Using the duplicated
Doesn't make sense, all the Similarly, in IIF we want to compare to There is a special interest design consideration inside DFG only to have this duplication, and should probably not be forced down on users. If you don't know about the |
okay, so i thought some more and came up with a compromise (especially since i’m out voted 2-1). Why not just do both. Do as Johan and Sam suggest by extracting Then also write a second update! wrapper function with different parameter arguments which includes the Just to reiterate, literally every other time (and there are many) that we use solveKey, the solveKey is passed in as a argument to the function. So NOTE, the 2-1 suggested approach (#565 (comment)) is more consistent with the example in the repo README, where the key values are stored in # In-memory DFG
dfg = LightDFG{NoSolverParams}()
addVariable!(dfg, DFGVariable(:a))
addVariable!(dfg, DFGVariable(:b)) |
FYI: DistributedFactorGraphs.jl/src/services/DFGVariable.jl Lines 552 to 569 in 182a5b6
|
|
This is somewhat related to #1084, maybe both will use the same new verb. |
and
and this is also broken:
The text was updated successfully, but these errors were encountered: