ysaikai / LFABM

An agent-based model of local food systems
0 stars 0 forks source link

Cash balance #3

Open ysaikai opened 8 years ago

ysaikai commented 8 years ago

For some reason, the update of cash balance (L.369 main.py) fails erratically. It seems to me literally erratic. When it happens, I terminate the process in the console and re-run it (i.e. main.py, schedule.py, and reload http:localhost:8888). This does not necessarily fix it, but sometimes do. I have no idea what is going on...

elansegarra commented 8 years ago

It seems like mesa (or perhaps the visualizer) is getting ahead of itself or is not completely flushing old data. This abnormality could be related to why hitting the reset button does not completely update everything.

ysaikai commented 8 years ago

It seems the 'reset flow' (from Javascript to def reset_model() in ModularVisualization.py) tries to do what it is supposed to. I do not think Mesa itself stores any data beyond the temporary process. My guess is the culprit is what Mesa import, esp. tornado. We may ask the developers.

ysaikai commented 8 years ago

Does giving -B option (e.g. python -B ./server.py) works? In my environment, it is not perfect but appears to do. But, we still have the 'reset issue'; i.e. when keep resetting, it gradually reduces the number of survivors. See the log file.

ysaikai commented 8 years ago

The cause of dwindling survivors seems to be a failure of initializing the prices. L.70 main.py, we set them equal to 2, but as we keep resetting, it seems Step1 prices start with something increasingly smaller than 2. hmm...

elansegarra commented 8 years ago

Looking through the log you sent, it appears that when the model is reset, suppliers that had died in the previous world start with prices equal to the price they had in the period when they died in the previous incarnation. This would lead toward smaller and smaller initial prices and thus smaller and smaller prices over time (especially since they have no opportunity to ever raise them). Given that you set prices based off of the initialized model price vector (in L. 152) I don't know why this would be happening...

On Tue, Apr 12, 2016 at 11:33 PM, Yuji Saikai notifications@github.com wrote:

The cause of dwindling survivors seems to be a failure of initializing the prices. L.70 main.py, we set them equal to 2, but as we keep resetting, it seems Step1 prices start with something increasingly smaller than 2. hmm...

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/ysaikai/LFABM/issues/3#issuecomment-209222312

ysaikai commented 8 years ago

I have got, thus far, the best statistic. When the anomaly happens, close and relaunch the shell. This fixes it so far 100%. It seems like due to the Python interpreter. We are closing in.