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

Restart a simulation from where it stopped #55

Open
idontgetoutmuch opened this issue Oct 20, 2020 · 4 comments
Open

Restart a simulation from where it stopped #55

idontgetoutmuch opened this issue Oct 20, 2020 · 4 comments

Comments

@idontgetoutmuch
Copy link

In http://www.mathcancer.org/blog/saving-multicellds-data-from-biofvm/ I see

Future releases of BioFVM will support reading MultiCellDS snapshots (for model initialization).

I'd like to be able to restart a simulation from where it stopped. Is this now possible?

I found this: https://github.com/idontgetoutmuch/PhysiCell/blob/master/BioFVM/BioFVM_MultiCellDS.h#L191-L200

which suggests that I will have to implement read_BioFVM_to_MultiCellDS_xml_pugi myself?

@MathCancer
Copy link
Owner

Hi! This is on my radar now for perhaps 1.10.1.

@idontgetoutmuch
Copy link
Author

@MathCancer from the point of view of inference, I have a function with this type

Particles (a, d) ->
(a -> m a) ->
(a -> b) ->
(b -> b -> d) ->
b ->
m (Particles (a, d))

Here a is the state of the simulation and d is a double indicating how likely this particular state is. b is what you are allowed to observe, e.g., the diameter of the tumour. Particles just means you have a collection of states and their respective weights (the samples are historically called particles).

The idea is you start with a set of guesses (samples) and then use a parameter, the function a -> m a, to update the state to the time at which the next observation is available. In PhysiCell terms this means starting PhysiCell with a known state and then returning the new state (which is then used as the old state for the next step). The m denotes that PhysiCell is stochastic (actually it means more but that would detract).

The parameter a -> b (which is a function) takes the state and returns a measurement. The parameter b -> b -> d is the likelihood of the predicted observation given the actual observation. b is the actual observation.

Finally the function returns a new set of states and weights (unnormalised probabilities) and the whole process can be repeated.

I am in the middle of writing a blog post on how all this works. I might post a draft here when it's actually readable as it might help illuminate what is required.

  1. Would it be possible to have a C function that takes the current PhysiCell state and returns the new state?
  2. Can multiple PhysiCell simulations be run in parallel?

@adriannejnner FYI

@MathCancer
Copy link
Owner

Hello, I wanted to follow up / touch base.

This is in fact on our radar, and we are inching towards a full read, and this is an area that a hackathon team worked on at ws2022. (We should check in with them ... )

I don't envision writing a run_physicell( ) function around main at this time, but I can definitely see where it woudl be helpful for the scenarios you point out!! I'm concerned that the memory model may make this very difficult ot do in practice without some significant and careful software engineering. So I'm inclined to tiptoe for now ...

@idontgetoutmuch
Copy link
Author

Great to know it is still on your radar. I have an intern working on ABMs in Haskell and I am working on a probabilistic programming language (in Haskell). One of the things we can now do is track processes in real time using particle filtering. One of the applications for this was adjusting treatments for patients.

I don't have any immediate requirement to run complex biological models but sometimes customers pop up unexpectedly.

It would be interesting to know where the hackathon team got to. Perhaps they have a summary or presentation?

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

No branches or pull requests

2 participants