Skip to content

Commit

Permalink
gops_params_override option
Browse files Browse the repository at this point in the history
  • Loading branch information
kngwyu committed Sep 12, 2024
1 parent e8abc45 commit b81744b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions experiments/cf_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ def evolve(
env_override: str = "",
birth_override: str = "",
hazard_override: str = "",
gops_params_override: str = "",
logdir: Path = Path("./log"),
log_mode: LogMode = LogMode.REWARD_LOG_STATE,
log_interval: int = 1000,
Expand All @@ -424,6 +425,7 @@ def evolve(
cfconfig.apply_override(env_override)
bdconfig.apply_birth_override(birth_override)
bdconfig.apply_hazard_override(hazard_override)
gopsconfig.apply_params_override(gops_params_override)

# Load models
birth_fn, hazard_fn = bdconfig.load_models()
Expand Down
6 changes: 6 additions & 0 deletions src/emevo/exp_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ def load_model(self) -> gops.Mutation | gops.Crossover:
params[k] = v
return _load_cls(self.path)(**params)

def apply_params_override(self, override: str) -> None:
if 0 < len(override):
override_dict = json.loads(override)
for key, value in override_dict.items():
self.params[key] = value


@chex.dataclass
class Log:
Expand Down

0 comments on commit b81744b

Please sign in to comment.