The “node” property


I’m getting a couple (good) questions about how to compute the node ID (in the IPD graph) for a particular agent. Some of you have discerned that the node ID seems to be equal to the agent’s unique_id minus 1. You can’t count on this, though, since Mesa leaves open the possibility that it will assign unique_ids differently.

This is what the .node property is for (see lines 266-268 of base.py). If you have your hands on an instance of IPDAgent (including any subclass) called, say, “a“, you can simply do:

    ...  a.node  ...

to get its correct node ID.


Leave a Reply

Your email address will not be published. Required fields are marked *