Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
exapunks-hackmatch-bot
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
exapunks-hackmatch-bot
Commits
5efb10b4
Commit
5efb10b4
authored
Apr 12, 2020
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add heuristic column height to fragmentation score
parent
a8f3eb0d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
strategy.py
strategy.py
+3
-1
No files found.
strategy.py
View file @
5efb10b4
...
@@ -201,6 +201,7 @@ class State:
...
@@ -201,6 +201,7 @@ class State:
"""
"""
Minimize the sum of dist(i,j) between all blocks i,j of the same color.
Minimize the sum of dist(i,j) between all blocks i,j of the same color.
Magnify vertical distances to avoid column stacking.
Magnify vertical distances to avoid column stacking.
Add the vertical components of i and j to prioritize lower columns.
"""
"""
def
dist
(
i
,
j
):
def
dist
(
i
,
j
):
yi
,
xi
=
divmod
(
i
,
COLUMNS
)
yi
,
xi
=
divmod
(
i
,
COLUMNS
)
...
@@ -211,7 +212,8 @@ class State:
...
@@ -211,7 +212,8 @@ class State:
if
self
.
groups
[
i
]
==
self
.
groups
[
j
]:
if
self
.
groups
[
i
]
==
self
.
groups
[
j
]:
return
abs
(
yj
-
yi
)
return
abs
(
yj
-
yi
)
return
abs
(
xj
-
xi
)
+
abs
(
yj
-
yi
)
*
2
-
1
return
abs
(
xj
-
xi
)
+
abs
(
yj
-
yi
)
*
2
-
1
+
\
(
self
.
nrows
-
yi
)
+
(
self
.
nrows
-
yj
)
colors
=
{}
colors
=
{}
for
i
,
block
in
enumerate
(
self
.
blocks
):
for
i
,
block
in
enumerate
(
self
.
blocks
):
...
...
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