Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Andrew Childs
reversal-sort
Commits
65b853dc
Commit
65b853dc
authored
Feb 23, 2021
by
Hrishee Shastri
Browse files
remove debugged comments
parent
98e18fc2
Changes
1
Show whitespace changes
Inline
Side-by-side
SBR.py
View file @
65b853dc
...
...
@@ -89,10 +89,7 @@ def is_valid_permutation(permutation, start, end):
def
compress_reversals
(
revlist
,
permsize
):
timesteps
=
[]
for
rev
in
revlist
:
# print(rev, ' cost =', rev_cost(rev))
init_step
=
len
(
timesteps
)
# if rev.beg == 5 and rev.end == 7:
# print('Here')
for
step
in
timesteps
[::
-
1
]:
busy
=
False
for
i
in
range
(
rev
.
beg
,
rev
.
end
+
1
):
...
...
@@ -104,15 +101,11 @@ def compress_reversals(revlist, permsize):
init_step
-=
1
while
init_step
+
rev_cost
(
rev
)
-
1
>
len
(
timesteps
)
-
1
:
timesteps
.
append
([
0
]
*
permsize
)
# if init_step + rev_cost(rev) - 1 > len(timesteps) - 1:
# timesteps += [[0] * permsize] * (init_step + rev_cost(rev) - 1 - (len(timesteps) - 1))
for
i
in
range
(
init_step
,
init_step
+
rev_cost
(
rev
)):
# print('Affecting row', i)
for
j
in
range
(
rev
.
beg
,
rev
.
end
+
1
):
timesteps
[
i
][
j
]
=
1
# for t in range(len(timesteps)):
# print(t, '\t-->', timesteps[t])
# print()
return
len
(
timesteps
)
...
...
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