Commit ae5b52ae authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent fcd7d1b1
......@@ -240,20 +240,11 @@ def Restructure(ztree, newStructure):
# The process of insert/forget is organized as follows:
# every node from B set will in the end be associated to a node from A set.
# to make this association we:
# - compute D(Ai,Bj) where D is weighted distance
# - if we need to insert, we order Bj by δA(Bj) = min_i D(Ai,Bj)
# and note Bj with max(δA(Bj)) to be associated with newly created nodes.
# - if we need to forget, we order Ai by δB(Ai) = min_j D(Ai,Bj)
# and note Ai with max(δB(Ai)) to be forgotten.
# - after As are forgotten or some Bs are associated with new, we associate
# 1-1 the rest of A with the rest of B since all those nodes come in key↑ order.
# - compute D(Ai,Bj) where D is distance in between ranges
# - find solution to linear assignment problem A <- B with the cost given by D
# https://en.wikipedia.org/wiki/Assignment_problem
#
# sum min d(a,b) sum min d(a,b)
# a∈A b∈B b∈B a∈A
# D(A,B) = ────────────── + ────────────── XXX -> D(A,B) = |A.lo, B.lo| + |A.hi - B.hi|
# N(A) N(B)
#
# XXX ^^^ -> assignment problem
# D(A,B) = |A.lo, B.lo| + |A.hi - B.hi|
# we will modify nodes from new set:
# - node.Z will point to associated znode
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment