mining.genetic: reduce the genetic miner's runtime and default settings #39

Open
opened 2026-10-06 13:51:12 +00:00 by ffrauenberger · 0 comments
Owner

Severity: improvement (high: the defaults make a run take long on real logs)

Where

  • app/mining_algorithms/genetic_mining.py:42-49, :337-416, :623-684, :744-779
  • app/converters/petri_net_converter.py:331-482

Problem

  • The defaults are population_size = 500 and max_generations = 100, i.e. up to 50,000 fitness evaluations.
  • Each evaluation replays every trace variant with a pure-Python token game (PetriNetToolkit.simulate_trace, including a recursive _ensure_token).
  • _clone_individual drops _petri_net, so every child rebuilds its Petri net from scratch, even unchanged clones.
  • _crossover starts with parent1 == parent2, a deep dict comparison that includes the cached Petri net dictionaries.
  • _update_related_activities scans all I/O sets several times per mutation.
  • Everything runs synchronously in the Streamlit session thread.

Related: #31, #54.

Fix

  • Use more realistic defaults (e.g. 100 × 50) and show an estimated runtime
  • Cache fitness by a canonical hash of (I, O); only rebuild the Petri net if crossover or mutation changed something
  • Vectorize or compile the replay (numpy marking vectors), or run evaluation in a ProcessPoolExecutor

from issues/PERF-003-genetic-miner-cost-and-defaults.md (code analysis of commit 6bcc646, 2026-10-03)

**Severity:** improvement (high: the defaults make a run take long on real logs) ## Where - `app/mining_algorithms/genetic_mining.py:42-49`, `:337-416`, `:623-684`, `:744-779` - `app/converters/petri_net_converter.py:331-482` ## Problem - The defaults are `population_size = 500` and `max_generations = 100`, i.e. up to **50,000** fitness evaluations. - Each evaluation replays every trace variant with a pure-Python token game (`PetriNetToolkit.simulate_trace`, including a recursive `_ensure_token`). - `_clone_individual` drops `_petri_net`, so every child rebuilds its Petri net from scratch, even unchanged clones. - `_crossover` starts with `parent1 == parent2`, a deep dict comparison that includes the cached Petri net dictionaries. - `_update_related_activities` scans all I/O sets several times per mutation. - Everything runs synchronously in the Streamlit session thread. Related: #31, #54. ## Fix - Use more realistic defaults (e.g. 100 × 50) and show an estimated runtime - Cache fitness by a canonical hash of `(I, O)`; only rebuild the Petri net if crossover or mutation changed something - Vectorize or compile the replay (numpy marking vectors), or run evaluation in a `ProcessPoolExecutor` --- from `issues/PERF-003-genetic-miner-cost-and-defaults.md` (code analysis of commit 6bcc646, 2026-10-03)
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ffrauenberger/ProcessIntel#39
No description provided.