Skip to content

How to manipulate an agent's specific attribute based on a condition in the model? #1681

Discussion options

You must be logged in to vote

I was able to create a dictionary with the key as the unique id of the agents and the value as the object name which looks like this:

<Abstract_crowdlogistics_model.Senders object at 0x7fd7dabe39d0>.

Now I am able to access Sender's attribute in a function that I defined in the Carrier agent class as shown below:

for i in self.model.Sender_population.keys():
if (self.model.Sender_population[i].Participation_status == "Y" and len(self.model.Sender_population[i].pickup_request_list)!= 0):
self.Potential_senders_to_match.append(i)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@PreetamKulkarni
Comment options

@PreetamKulkarni
Comment options

Answer selected by PreetamKulkarni
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants