Skip to content

fix: allow FixedAgent removal via public cell setter#3467

Closed
hillhack wants to merge 3 commits intomesa:mainfrom
hillhack:fix/fixed-agent-removal-bug
Closed

fix: allow FixedAgent removal via public cell setter#3467
hillhack wants to merge 3 commits intomesa:mainfrom
hillhack:fix/fixed-agent-removal-bug

Conversation

@hillhack
Copy link
Copy Markdown

@hillhack hillhack commented Mar 7, 2026

Fix

Closes: #3466

The cleanup logic was moved out of the remove() method and into the cell property descriptor, where it properly belongs.

Previously, FixedAgent.remove() had to bypass the public cell API and modify private state directly. This created fragile behavior and inconsistent removal logic.

With this fix:

  • The property descriptor now correctly handles cleanup.
  • FixedAgent no longer needs to manually modify private attributes.
  • Clearing an agent’s cell works consistently through the public API.

Without this change, any attempt to manually clear a FixedAgent’s cell outside of the remove() method would still trigger ValueError crashes.

@hillhack hillhack force-pushed the fix/fixed-agent-removal-bug branch 2 times, most recently from b0fbc03 to 0012341 Compare March 7, 2026 02:44
@hillhack hillhack force-pushed the fix/fixed-agent-removal-bug branch from 07b1708 to 95448d4 Compare March 7, 2026 02:49
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 7, 2026

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small 🔵 +1.8% [+1.3%, +2.2%] 🔵 -0.2% [-0.4%, +0.1%]
BoltzmannWealth large 🔵 +0.1% [-1.0%, +1.1%] 🔵 -0.6% [-2.8%, +1.6%]
Schelling small 🔴 +3.6% [+3.1%, +4.1%] 🔵 +1.8% [+1.5%, +2.2%]
Schelling large 🔵 -0.4% [-0.8%, -0.0%] 🔵 +0.9% [-1.3%, +3.5%]
WolfSheep small 🔴 +3.9% [+3.4%, +4.3%] 🔵 +1.6% [+1.3%, +1.9%]
WolfSheep large 🔵 +0.3% [-0.2%, +0.7%] 🔵 +0.4% [-0.5%, +1.4%]
SugarscapeG1mt small 🔵 +2.3% [+1.7%, +3.0%] 🔵 +1.3% [+0.8%, +1.8%]
SugarscapeG1mt large 🔵 +2.9% [+1.4%, +4.0%] 🔵 +0.3% [-0.3%, +1.0%]
BoidFlockers small 🔵 +2.1% [+1.8%, +2.3%] 🔵 -1.6% [-1.8%, -1.5%]
BoidFlockers large 🔵 +3.2% [+2.6%, +4.1%] 🔵 -1.4% [-1.7%, -1.2%]

@quaquel
Copy link
Copy Markdown
Member

quaquel commented Mar 10, 2026

We have discussed this issue in detail. I remain unconvinced by the need for this so I am closing this PR.

@quaquel quaquel closed this Mar 10, 2026
@hillhack hillhack deleted the fix/fixed-agent-removal-bug branch March 11, 2026 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: FixedAgent.remove Blocked by Setter

2 participants