AB-CE / abce

Agent-based computational Economics, the Python library that makes AB modelling easier
http://abce.readthedocs.io
181 stars 62 forks source link

is there link agent like the one in Netlogo? #183

Closed Westlife1002 closed 4 years ago

Westlife1002 commented 5 years ago

I used Netlogo a lot and I found it is not constraining anything I want to build. However, I am interested to learn Python based ABS. One of the key question is if there is a agent type as link (directed or undirected) and supports the related primitive commands (methods)? (see https://ccl.northwestern.edu/netlogo/docs/dictionary.html#linkgroup)

rht commented 5 years ago

@Westlife1002 I suppose you could manually make an agent with link_from, and link_to attributes.

class LinkedAgent:
    def __init__(self, *args, **kwargs):
        self.link_from = []
        self.link_to = []
    def link_to(self, target):
        self.link_to.append(target)
        target.link_from.append(self)
rht commented 4 years ago

Marked as resolved. Let me know if it is otherwise.