Skip to content

Commit

Permalink
Extend simulation to run until some minimal budget is depleted.
Browse files Browse the repository at this point in the history
  • Loading branch information
daemontus committed Jun 4, 2024
1 parent 6eea992 commit 159bb3f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
7 changes: 4 additions & 3 deletions biobalm/_sd_attractors/attractor_candidates.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,9 @@ def compute_attractor_candidates(

# Here, we gradually increase the iteration count while
# the candidate set is being actively reduced. If the simulation
# cannot reduce any further states, we are done.
iterations = 1024
# cannot reduce any further states and exceeds the proposed budget,
# we are done.
iterations = 2 ** 10
while len(candidate_states) > 0:
if sd.config["debug"]:
print(
Expand All @@ -362,7 +363,7 @@ def compute_attractor_candidates(
simulation_seed=123,
)

if len(reduced) == len(candidate_states):
if len(reduced) == len(candidate_states) and (iterations * len(candidate_states)) > sd.config["minimum_simulation_budget"]:
candidate_states = reduced
break

Expand Down
1 change: 1 addition & 0 deletions biobalm/succession_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def default_config() -> SuccessionDiagramConfiguration:
"pint_goal_size_limit": 8_192,
"attractor_candidates_limit": 100_000,
"retained_set_optimization_threshold": 1_000,
"minimum_simulation_budget": 1_000_000,
}

@staticmethod
Expand Down
12 changes: 12 additions & 0 deletions biobalm/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,15 @@ class SuccessionDiagramConfiguration(TypedDict):
If there are more than this amount of attractor candidates, the attractor
detection process will try to optimize the retained set using ASP (if enabled).
"""

minimum_simulation_budget: int
"""
The minimum number of simulation steps that is guaranteed to be spent on eliminating
attractor candidate states.
Note that this is a budget that applies to all candidates collectively. So if the number
of candidates is larger, the number of steps per candidate is proportionally smaller.
However, this budget only applies when simulation has not been able to make progress
in the recent round. That is, if simulation has actively eliminated some candidates in
the recent round, it will still continue regardless of the budget limit.
"""

0 comments on commit 159bb3f

Please sign in to comment.