0

My simulation is of farms. Farmer agents own the farms and farms are created from a random number of patches around the agent that then "belong to" the farmer.

Each patch owns a Rate of Production variable (random number up to 50).

How do I then assign a value to an agent-owned variable that sums the RoP for each patch in the farm and makes that the farmer's total RoP? Something like... ask farm to [ set farm-RoP ... to the sum of all patches RoP in-radius ]. I am unsure of how to create the syntax.

Thank you, in advance, for any help anyone can provide!

Melonie Richey
  • 65
  • 1
  • 1
  • 7
  • could you please show us the code that creates the farms from a random number of patches and then assigns that farm (group of patches) to a farmer? you will want code something like `ask farmers [ set my-RoP sum [RoP] of my-farm] ]` – JenB Oct 29 '18 at 10:14
  • Thank you! That worked! set farm-RoP sum [ RoP ] of patches in-radius farm-size – Melonie Richey Oct 30 '18 at 11:53
  • if you are using `in-radius` to set your farms, you need to be careful that the same patch is not assigned to multiple farms – JenB Oct 30 '18 at 13:25

0 Answers0