Page 1 of 1

Function: choose

Posted: Thu Oct 26, 2023 6:45 am
by cobleg
I am currently developing a household formation model. This contains two actions: creating households dynamically; and reassigning them to a new region. This is intended to model migration flows. At present, the household decision to migrate is based on Gross State Product (GSP) growth. If less than zero, migrate. The region to migrate to is currently determined by "next region" which is similar to the cow movement between pastures in one of the Ventity demonstration/exercise models.

Instead of this way of migrating, I would like households to choose based on the best opportunity, i.e. the region with the highest GSP growth. Can you please advise how I can implement that in Ventity.

I have attached my model to this message for context.

Re: Function: choose

Posted: Thu Oct 26, 2023 1:04 pm
by tomfid
Generically, I'd say the HH decides to migrate, then runs a Process List action to evaluate possible target regions. These are sorted by GSP or some more general measure of attractiveness. You limit processing to one iteration, and the HH changes its location attribute to match the leading candidate.

If they have to create a relationship entity between HH and region, they can trigger a create action to do that. Usually this takes a cascade of two: HH triggers action in region to initiate the move, region triggers back to HH to execute the move. This way the execute action has the HH as the invoker and the region as the parent.

Re: Function: choose

Posted: Sat Oct 28, 2023 1:29 am
by cobleg
Thank you very much. I have created a simpler test model that implements your guidance (see attachment). I'm seeking confirmation that this is the best way to implement your guidance. Also, if it is, hopefully will help others. I'd appreciate any other applications that process lists can be used for. It seems powerful albeit somewhat abstract.

Re: Function: choose

Posted: Tue Oct 31, 2023 12:33 am
by cobleg
Following up on this thread, I have implemented the remainder of the migration model. I have defined three actions:
1. A create action named: Create households.
2. Process List action named: identify the best region. This ranks regions by total output and records the highest-ranking region in the attribute: best region.
3. A command action named: migrate. This updates the household's region attribute and reallocates households located in under-performing regions.

The Household entity type is the parent and invoker of actions 1 and 3. The Regions entity type is the invoker and parent of action 2.

I think I may have implemented this differently to your guidance. Just wondering if you could provide any guidance on whether this is the best way to implement it or if an alternative setup would be better.

Re: Function: choose

Posted: Thu Nov 16, 2023 5:13 pm
by tomfid
I think there's an efficiency issue here. Because the 'identify' and 'update' triggers are in the Region entity, they're executing multiple times - i.e. every region is identifying the best region.

I can think of a couple alternatives.

- Move the trigger to a singleton entity like the Model. Putting it in the Region[] collection would be preferable for compartmentalizing things, but I can't remember if that works.

- Don't use an action. Instead, use an aggregate to compute the maximum(output) in the Region[] and then have each Region entity test whether its output matches the max.

- If individual households have distinct utility functions (i.e. distinct criteria for choosing a region), the household could trigger its own process list to make the choice.