Skip to content

Conversation

@pohaoc2
Copy link
Contributor

@pohaoc2 pohaoc2 commented Apr 28, 2025

Summary

Introduce a new ic tag for parameters to enforce constant initial conditions for cellular properties, while ensuring that parameters for daughter cells continue to be drawn from a distribution.

Changes

  • Create a new distribution - DegenerateDistribution, which always returns the same value
  • Draw a constant value from DegenerateDistribution for parent cell agents' parameters
  • Draw values from other distributions defined in the input xml file for daughter agents' parameters

Examples

In the input .xml file, we can set a ic tag for population.parameter.

  1. Initialize all cells with constant volume = 50.0
<population.parameter id="CELL_VOLUME" value="NORMAL(MU=2250,SIGMA=200)" ic="50"/>
  1. Initialize all cells volume with the expected value of the distribution (only for NORMAL distribution)
<population.parameter id="CELL_VOLUME" value="NORMAL(MU=2250,SIGMA=200)" ic="MU"/>
  1. Initialize all cells volume with the MIN value of the distribution (only for UNIFORM distribution)
<population.parameter id="CELL_VOLUME" value="UNIFORM(MIN=2000,MAX=3000)" ic="MIN"/>
  1. Initialize all cells volume with the NaN value of the distribution if the ic tag does not match the distribution
<population.parameter id="CELL_VOLUME" value="UNIFORM(MIN=2000,MAX=3000)" ic="MU"/>

Comments

I overrided the parseParameter by introducing a new argument - MiniBox ics instead of modify the original one.

Estimated size: Small to Medium
Resolve #177.

@pohaoc2 pohaoc2 added package: patch Related to the patch implementation package: core Related to the core package category: agent Related to the agent subpackages category: util Related to the util subpackages size: medium Estimated size of issue or PR is medium labels Apr 28, 2025
@pohaoc2 pohaoc2 self-assigned this Apr 28, 2025
@allison-li-1016
Copy link
Contributor

allison-li-1016 commented Apr 29, 2025

Wouldn't the daughter cells also inherit the DegenerateDistribution? Maybe Im wrong, but Im of the understanding that the daughter cell inherits the parent cell's parameters in convert() for CellFactories in the proliferation module, so the parent cell's distribution for that parameter will always get passed on.

@allison-li-1016
Copy link
Contributor

Wouldn't the daughter cells also inherit the DegenerateDistribution? Maybe Im wrong, but Im of the understanding that the daughter cell inherits the parent cell's parameters in convert() for CellFactories in the proliferation module, so the parent cell's distribution for that parameter will always get passed on.

Just to make sure I understand the code correctly, does line 45 in the parameters class make sure that the daughter cells get the original distribution?

if (distribution instanceof DegenerateDistribution) { distribution = popParameters.getDistribution(key, random);

Copy link
Member

@cainja cainja left a comment

Choose a reason for hiding this comment

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

Should degenerate distributions be added as an accessible distribution option from the input xml? If so, we should update minibox with the degenerate distribution.

population.put("CAR_ANTIGENS", 0);
population.put("SELF_TARGETS", 0);
doReturn(population).when(factoryMock).getParameters(anyInt());
Parameters parameters = new Parameters(population, null, randomMock);
Copy link
Member

Choose a reason for hiding this comment

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

So this is the important test - you need to make sure the daughter cells inherit the original distribution and not the degenerate distribution. This is how this happens in PatchModuleProliferation:

CellContainer newContainer = cell.make(newID, State.UNDEFINED, random);
Parameters newParameters = cell.getParameters();
PatchCell newCell =
        (PatchCell)
                newContainer.convert(
                        sim.getCellFactory(),
                        newLocation,
                        random,
                        newParameters);

This test isn't actually testing how new cells are created, which is related to @allison-li-1016's question.

@cainja cainja marked this pull request as draft June 9, 2025 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: agent Related to the agent subpackages category: util Related to the util subpackages package: core Related to the core package package: patch Related to the patch implementation size: medium Estimated size of issue or PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add initial condition tag for parameter

4 participants