Skip to content

Commit

Permalink
minor fix to to-string routine for game plans
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasWeise committed Sep 9, 2023
1 parent 093711b commit 584889a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion moptipyapps/ttp/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def base_setup(instance: Instance) -> tuple[Permutations, Execution]:
"""
ge: Final[GameEncoding] = GameEncoding(instance)
perms: Final[Permutations] = ge.search_space()
return (perms, Execution().set_max_fes(16_777_216).set_log_improvements(
return (perms, Execution().set_max_fes(1000000000).set_log_improvements(
True).set_objective(Errors(instance)).set_search_space(perms)
.set_solution_space(GamePlanSpace(instance)).set_encoding(
GameEncoding(instance)))
Expand Down
19 changes: 15 additions & 4 deletions moptipyapps/ttp/game_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ def __str__(self):
"""
Convert the game plan to a compact string.
The first line of the output is a flattened version of this matrix
with the values being separated by `;`. Then we place an empty line.
We then put a more easy-to-read representation and follow the pattern
given at https://robinxval.ugent.be/RobinX/travelRepo.php, which is
based upon the notation by Easton et al. Here, first, a row with the
team names separated by spaces is generated. Then, each row contains
the opponents of these teams, again separated by spaces. If an
opponent plays at their home, this is denoted by an `@`.
If a team has no scheduled opponent, then this is denoted as `-`.
:return: the compact string
"""
csv: Final[str] = CSV_SEPARATOR
Expand Down Expand Up @@ -67,11 +78,11 @@ def __str__(self):
for d in row:
sio.write(sep)
if d < 0:
idx = -d - 1
sio.write("@")
sio.write(f"@{teams[-d - 1]}")
elif d > 0:
sio.write(teams[d - 1])
else:
idx = d - 1
sio.write(teams[idx])
sio.write("-")
sep = " "

return sio.getvalue()
2 changes: 1 addition & 1 deletion moptipyapps/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""An internal file with the version of the `moptipyapps` package."""
from typing import Final

__version__: Final[str] = "0.8.22"
__version__: Final[str] = "0.8.23"

0 comments on commit 584889a

Please sign in to comment.