From 5781ab59938c7752d4202223ef598484bf332170 Mon Sep 17 00:00:00 2001 From: Ryan Spangler Date: Tue, 26 Nov 2024 15:09:51 -0800 Subject: [PATCH] added the mass to the bridge between the environment and the grow_divide agent --- .../experiments/growth_division.py | 2 +- process_bigraph/tests.py | 23 +++++++++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/process_bigraph/experiments/growth_division.py b/process_bigraph/experiments/growth_division.py index 17c3d6f..634c508 100644 --- a/process_bigraph/experiments/growth_division.py +++ b/process_bigraph/experiments/growth_division.py @@ -161,7 +161,7 @@ def grow_divide_agent(config=None, state=None, path=None): state) composite = generate_bridge({ - 'inputs': {}, + 'inputs': {'mass': ['mass']}, 'outputs': agent_schema}, grow_divide_state) diff --git a/process_bigraph/tests.py b/process_bigraph/tests.py index 961581b..660b619 100644 --- a/process_bigraph/tests.py +++ b/process_bigraph/tests.py @@ -557,7 +557,8 @@ def test_grow_divide(core): grow_divide = grow_divide_agent( {'grow': {'rate': 0.03}}, - {'mass': initial_mass}, + {}, + # {'mass': initial_mass}, ['environment', '0']) environment = { @@ -567,14 +568,26 @@ def test_grow_divide(core): 'grow_divide': grow_divide}}} composite = Composite({ - 'state': environment}, + 'state': environment, + 'bridge': { + 'inputs': { + 'environment': ['environment']}}}, core=core) - updates = composite.update( - {}, + import ipdb; ipdb.set_trace() + + updates = composite.update({ + 'environment': { + '0': { + 'mass': 1.1}}}, 100.0) - assert '0_0_0_0_0' in composite.state['environment'] + import ipdb; ipdb.set_trace() + + # TODO: mass is not synchronized between inside and outside the composite? + + assert '0_0_0_0_1' in composite.state['environment'] + assert composite.state['environment']['0_0_0_0_1']['mass'] == composite.state['environment']['0_0_0_0_1']['grow_divide']['instance'].state['mass'] def test_gillespie_composite(core):