Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improved reproducability for non-louvain methods #61

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions simpleoptions/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def set_options(self, new_options: List["BaseOption"], append: bool = False) ->

self._option_availability_maps = {}
for state in self.get_state_space():
for option in self._options:
for option in sorted(self._options, key=lambda x: str(x)): # TODO: temporary fix for repeatability
if option.initiation(state):
self._option_availability_maps[state] = self._option_availability_maps.get(state, list())
self._option_availability_maps[state].append(option)
Expand All @@ -196,7 +196,7 @@ def set_exploration_options(self, new_options: List["BaseOption"], append: bool

self._exploration_option_availability_maps = {}
for state in self.get_state_space():
for exploration_option in self.exploration_options:
for exploration_option in sorted(self.exploration_options, key=lambda x: str(x)): # TODO: temporary fix for repeatability
if exploration_option.initiation(state):
self._exploration_option_availability_maps[state] = self._exploration_option_availability_maps.get(
state, list()
Expand Down
2 changes: 1 addition & 1 deletion simpleoptions/implementations/betweenness.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def generate_options(
stg.nodes[state][f"{option.subgoal} Policy"] = str(option.policy(state))
elif state == option.subgoal:
stg.nodes[state][f"{option.subgoal} Policy"] = "GOAL"
nx.write_gexf(stg, "betweenness_test.gexf", prettyprint=True)
# nx.write_gexf(stg, "betweenness_test.gexf", prettyprint=True)

if return_subgoals:
return options, subgoals
Expand Down
2 changes: 1 addition & 1 deletion simpleoptions/implementations/diffusion_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def generate_options(
stg.nodes[state][f"{option.subgoal} Policy"] = str(option.policy(state))
elif state == option.subgoal:
stg.nodes[state][f"{option.subgoal} Policy"] = "GOAL"
nx.write_gexf(stg, "diffusion_test.gexf", prettyprint=True)
# nx.write_gexf(stg, "diffusion_test.gexf", prettyprint=True)

if return_subgoals:
return options, subgoals
Expand Down
2 changes: 1 addition & 1 deletion simpleoptions/implementations/eigenoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def _generate_from_laplacian(self, env: BaseEnvironment, debug: bool = False):
print(f"PVF {eigenoption.pvf_id} Values")
if state in eigenoption.primitive_policy:
stg.nodes[state][f"PVF {eigenoption.pvf_id} Policy"] = str(eigenoption.policy(state))
nx.write_gexf(stg, "eigen_test.gexf", prettyprint=True)
# nx.write_gexf(stg, "eigen_test.gexf", prettyprint=True)

return eigenoptions, pvfs

Expand Down