feat(#113): DemoAgent group cohesion + encounter behaviour#5
Open
rebelmachina wants to merge 3 commits intomainfrom
Open
feat(#113): DemoAgent group cohesion + encounter behaviour#5rebelmachina wants to merge 3 commits intomainfrom
rebelmachina wants to merge 3 commits intomainfrom
Conversation
…n + encounter behaviour Add group_id: Option<Uuid> to DemoAgent (None = ungrouped = current behaviour). Add GroupState and EncounterTracker structs. Add create_grouped_agents(), compute_group_states(), tick_grouped_agents(): - 60% cohesion toward group centroid, 40% personal random direction - Deterministic encounter triggers steer groups toward each other All existing APIs (create_demo_agents, tick_demo_agents, agents_to_entries) are unchanged. arcane-cluster-demo binary builds and works identically. Fix required-features on arcane-swarm, arcane-spacetime-sim, arcane-swarm-sdk bins (were incorrectly compiled without their feature gates). Remove spacetimedb-persist from always-on arcane-infra features — move it into spacetime-sim feature to avoid unconditional OpenSSL dep. Tests A, B, C: cohesion reduces spread, encounter steers groups together, ungrouped agents unaffected by tick_grouped_agents. Closes #113. Part of epic #112. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… (Test E) Add clustering_sim.rs with run_sim(SimConfig) -> SimResult: builds WorldStateView directly from agent positions + party assignments each evaluation tick, calls model.compute_entity_assignments() to get desired cluster assignments, and computes group fragmentation from those. Agents start round-robin across zones (each group split at start, fragmentation = 1.0) — AffinityEngine drives to 0.0 via party signals in the first evaluation window; RulesEngine stays at 1.0 throughout. Binary arcane-clustering-sim supports --model rules|affinity and --compare (interleaved JSON output for both models). Test E: affinity_outperforms_rules_on_group_scenario asserts affinity final_fragmentation < 0.1 and rules > 0.9, and verifies affinity < rules at every eval checkpoint. Also fix: - EntityStateEntry now uses ::new() constructor (four-bucket fields added) - arcane-cluster-demo: pass None simulation arg to run_cluster_loop - workspace.package.license for arcane-wire workspace inheritance - Update submodule to feat/demo-group-behaviour (includes party_assignments) Closes #115. Part of epic #112. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ll 5 experiments converge cooldown_ticks=50 in AffinityConfig counts evaluation cycles, so 50 × eval_interval=10 = 500 sim ticks of lockout — longer than the 300-tick window. Groups that made a sub-optimal first migration were frozen for the rest of the run. Fix: sim uses cooldown_ticks=5 (50 sim ticks), letting groups that need a second convergence pass re-migrate by tick 60. Production default is unchanged. Experiment 4 changed from agents=40/group_size=10 to agents=36/group_size=9: the 3/3/2/2 split with group_size=10 could produce a stable 5/5 oscillation depending on hash order; the 3/2/2/2 split with group_size=9 has an unambiguous majority zone and converges in one step. Also adds scripts and docs that were previously untracked (plot_clustering.py, run_clustering_experiments.sh, CLUSTERING_EXPERIMENTS.md). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of epic brainy-bots/arcane#112. Closes brainy-bots/arcane#113, brainy-bots/arcane#115.
Summary
#113 — DemoAgent group behaviour:
group_id: Option<Uuid>added (None= ungrouped = identical behaviour)GroupState,EncounterTrackernew typescreate_grouped_agents(),compute_group_states(),tick_grouped_agents()#115 — arcane-clustering-sim binary + Test E:
clustering_sim.rswithrun_sim(SimConfig) -> SimResultcompute_entity_assignments()→ measures desired fragmentationarcane-clustering-sim --model rules|affinity --compareBug fixes in this PR:
EntityStateEntry::new()constructor (four-bucket fields added in updated arcane)run_cluster_loopnow takes 6 args — addedNonesimulation argworkspace.package.licensefor arcane-wire inheritance fixrequired-featuresonarcane-swarm,arcane-spacetime-sim,arcane-swarm-sdkspacetimedb-persistfrom always-on tospacetime-simfeature (removes unconditional OpenSSL dep)feat/demo-group-behaviour(includes party_assignments from arcane #116)Test plan
4 tests pass: A (cohesion), B (encounter), C (backwards compat), E (affinity vs rules).