AB-CE / abce

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

Error with unequal numbers of agents #97

Closed jonsce closed 6 years ago

jonsce commented 6 years ago

Hi, I am somewhat new to agent based modelling and I am currently looking for good libraries. During my research I found your library which looks very useful so far. I played around with the example "2sectors". When I change the numbers of households and firms to an unequal number e.g. 2 households and 1 firm, I get the following Error:

Traceback (most recent call last): File "P:\workspace\AgentBased\src\twosectors\start.py", line 40, in main(simulation_parameters) File "P:\workspace\AgentBased\src\twosectors\start.py", line 30, in main firms.buy_inputs() File "", line 1, in File "C:\Anaconda2-64\envs\PetchemGlobalModel\lib\site-packages\abce\group.py", line 40, in execute_serial self.groups, command, [], args, kwargs) File "C:\Anaconda2-64\envs\PetchemGlobalModel\lib\site-packages\abce\processorgroup.py", line 59, in execute self.put_messages_in_pigeonbox(messages) File "C:\Anaconda2-64\envs\PetchemGlobalModel\lib\site-packages\abce\processorgroup.py", line 99, in put_messages_in_pigeonbox self.agents[group][id // self.num_managers].inbox.append(message) IndexError: list index out of range

I do not know if my changes make sense from a modelling perspective but I assume it should not cause an error.

DavoudTaghawiNejad commented 6 years ago

Hi,

I think in the model household 1 bis from firm 1, which does not exist, hence the error

jonsce commented 6 years ago

Hi,

yeah, I found the problem. Thanks for your help! Sorry for the false alarm.

Best, Jonathan

2017-09-14 14:56 GMT+02:00 Davoud Taghawi-Nejad notifications@github.com:

Hi,

I think in the model household 1 bis from firm 1, which does not exist, hence the error

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/AB-CE/abce/issues/97#issuecomment-329473097, or mute the thread https://github.com/notifications/unsubscribe-auth/AeeiWhIzNgopbhk7sYl-dkBiHoFks_jhks5siSJkgaJpZM4PXc-y .

jonsce commented 6 years ago

Hi Davoud,

I have another question. For the problem that I want to model it is important that I can model different transportation times and costs. Do you think this is possible to model with your library?

Thanks! Jonathan

2017-09-14 15:26 GMT+02:00 Jonathan Scelle jonathan.scelle@gmail.com:

Hi,

yeah, I found the problem. Thanks for your help! Sorry for the false alarm.

Best, Jonathan

2017-09-14 14:56 GMT+02:00 Davoud Taghawi-Nejad notifications@github.com :

Hi,

I think in the model household 1 bis from firm 1, which does not exist, hence the error

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/AB-CE/abce/issues/97#issuecomment-329473097, or mute the thread https://github.com/notifications/unsubscribe-auth/AeeiWhIzNgopbhk7sYl-dkBiHoFks_jhks5siSJkgaJpZM4PXc-y .