Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
37a49cf8
Commit
37a49cf8
authored
May 14, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6e5b283b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
wcfs/internal/xbtree.py
wcfs/internal/xbtree.py
+7
-2
No files found.
wcfs/internal/xbtree.py
View file @
37a49cf8
...
...
@@ -274,9 +274,13 @@ def Restructure(ztree, newStructure):
rn
.
node
.
Z
=
None
def
D
(
a
,
b
):
def
fin
(
v
):
# TeX hack: inf = 10000
if
v
==
+
inf
:
return
+
1E4
if
v
==
-
inf
:
return
-
1E4
assert
abs
(
v
)
<
1E3
return
v
def
d
(
x
,
y
):
if
x
==
y
:
return
0
# prevents inf-inf -> nan
return
abs
(
x
-
y
)
return
abs
(
fin
(
x
)
-
fin
(
y
))
return
d
(
a
.
range
.
klo
,
b
.
range
.
klo
)
+
\
d
(
a
.
range
.
khi
,
b
.
range
.
khi
)
...
...
@@ -292,6 +296,7 @@ def Restructure(ztree, newStructure):
# property of D function so that if B2 > B1 (all keys in B2 > all keys
# in B1) and A < B1.hi, then D(B2, A) > D(B1, A).
print
()
print
(
'COST:'
)
print
(
C
)
jv
,
iv
=
scipy
.
optimize
.
linear_sum_assignment
(
C
)
print
(
jv
,
iv
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment