Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor update_all_cells #338

Conversation

drbergman
Copy link
Collaborator

@drbergman drbergman commented Nov 24, 2024

This is responsive to issue #320

  • fix bug in neighbor list
    • phagocytosis and fusion could result in removal of a cell
    • but the neighbor list was not updated
  • resolve interactions after phenotype updates
    • this allows the update velocity step to update the neighbors list one time
    • does move interactions before several steps:
      • gradient computation
      • evaluate interactions (so fewer interactions to evaluate)
      • custom rule
      • update velocity
      • springs
  • do not allow spontaneous spring detachments caused by attack (now a separate pr in disallow random detachment from attack #340 )
  • refactor how timing is done for simplicity

- fix bug in neighbor list
    - phagocytosis and fusion could result in removal of a cell
    - but the neighbor list was not updated
- resolve interactions after phenotype updates
    - this allows the update velocity step to update the neighbors list one time
    - does move interactions before several steps:
        - gradient computation
        - evaluate interactions (so fewer interactions to evaluate)
        - custom rule
        - update velocity
        - springs
- do not allow spontaneous spring detachments caused by attack
- refactor how timing is done for simplicity
@heberlr heberlr self-requested a review December 2, 2024 16:09
for( int i=0; i < (*all_cells).size(); i++ )
{
Cell* pC = (*all_cells)[i];
standard_cell_cell_interactions(pC,pC->phenotype,time_since_last_mechanics);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to discuss this change in call order further, as it will impact phagocytosis, attack, and fusion. I noticed it also relates to other PRs (#340 and #341). This change might introduce too many side effects.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, very happy to discuss more. By side effects, do you mean unintended behavior and/or errors? Or do you mean changes from how it ran before?

If we find this to be a long discussion, I would prefer to get a quick fix for this bug while we keep working on a longterm fix. Perhaps something like (the highly inefficient) #339?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean unintended behavior (like in PR #340 ), as the attach and detach dynamics were working fine in the previous release. I feel that by making this call order change, we might introduce these issues and possibly others we haven’t considered yet. Does that make sense?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that makes sense. To be clear, #340 and #341 are built off the dev branch / previous release (1.14.0), not this fix. Their point of origin is how we implemented changes in 1.14.0. This fix does not change the existence of those behaviors.

@heberlr heberlr self-requested a review December 5, 2024 17:07
@MathCancer
Copy link
Owner

I don't think the correct fix to a bug is to reorder operations to avoid the bug.

@drbergman
Copy link
Collaborator Author

Another option that @rheiland worked out was to update the delete_cell() function to have it also update neighbors the same way it already handles updating spring attachments

@MathCancer
Copy link
Owner

I do think we need to say: if lingering neighbors after cell deletion is the problem, then the correct fix is to correct those neighbor lists at the time of cell deletion.

(This is what we did in spring links. We just do the same for neighbor lists now.)

If A is neighbor to (B,C,D), then B, C and D are also neighbors to A. When A is deleted, remove A from the neighbor lists of B, D and D

@drbergman
Copy link
Collaborator Author

Here was where @rheiland documented this fix: #320 (comment)

My main reason for not opting for this solution is that we do not enforce that the neighbors is a symmetric relationship. The implementation of standard_update_cell_velocity produces a symmetric relationship (by its reliance on add_potentials), but we do not impose this restriction on user-defined update_velocity functions

@drbergman
Copy link
Collaborator Author

another fix is being formulated...

@drbergman drbergman closed this Dec 5, 2024
@drbergman drbergman deleted the fix-neighbors-phagocytosis-bug branch December 12, 2024 21:30
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.

3 participants