Thanks!

21 views
Skip to first unread message

rasmus

unread,
Jun 2, 2011, 5:35:15 PM6/2/11
to garl...@googlegroups.com
I used GarlicSim for a minor simulation project. It works delightful! Thanks a bunch.

I did have one problem, but I might have been caused by not reading the document properly.

for simulation in xrange(0,sim):
    si = garlicsim.list_simulate(state,float('inf'))
    for i in xrange(0,200,20):
        income[simulation][i//20] = np.asarray([si[i+20].agents[j]['balance'] for j in xrange(len(si[i+20].agents))]).mean()
    simulation += 1

I experienced that sometimes the loop ran ahead of the simulation causing the loop to fail. It wasn't a problem when the CPU ran on max speed.

--Rasmus

cool-RR

unread,
Jun 3, 2011, 7:22:56 AM6/3/11
to garl...@googlegroups.com
Hey Rasmus,

I'm happy you liked GarlicSim. The thing that's most sorely missing in this project is more feedback from users. I'l be happy to hear which parts you liked in GarlicSim, which parts you didn't like, which parts you think should be improved, what more functionality you'd want to see, and any other thing that comes to mind. I'd also be happy to hear more about your simulation project, unless of course it's a confidential one.

Regarding your problem: Your code is a bit hard to understand. (For example, why do you increment `simulation` manually when the `for` loop is supposed to do it?) But, I see that you give `list_simulate` an `iterations` argument of `float('inf')`, so it stops only when your simpack raises `WorldEnded`. Since I don't know your simpack I can't know when it will raise `WorldEnded` and therefore I can't know how long your list of states `si` will be.

I refactored it a bit for you, maybe now it will be easier to debug:

for simulation in xrange(0, sim):
    si = garlicsim.list_simulate(state, float('inf'))
    for i in xrange(0, 10):
        income[simulation][i] = np.mean(
            [agent['balance'] for agent in si[20*i+20].agents]
        )

More information about the error would also help.


Ram.

Rasmus Pank Roulund

unread,
Jun 3, 2011, 8:52:12 AM6/3/11
to garl...@googlegroups.com
Hi Ram,

> I'm happy you liked GarlicSim. The thing that's most sorely missing in
> this project is more feedback from users.

Yeah it is pretty sparse, it seems.

> I'l be happy to hear which parts you liked in GarlicSim, which parts
> you didn't like, which parts you think should be improved, what
> more functionality you'd want to see, and any other thing that comes
> to mind.

Well first off, the use of Python is a big plus. The centralization
around the step function is quite nice, I must say.

What do I need more? Well, I didn't lack anything. My problems were
sorely theoretical, specifying 'acceptable' simplification of
rationality (in terms of game theory).

So I guess the what is mainly missing is documentation. But maybe I
wasn't looking throughly enough. I only checked the online
documentation now that I think of it.

> I'd also be happy to hear more about your simulation project, unless
> of course it's a confidential one.

I'll mail your personal mail for this end.


> Regarding your problem: Your code is a bit hard to understand. (For
> example, why do you increment `simulation` manually when the `for`
> loop is supposed to do it?) But, I see that you give `list_simulate`

> an `iterations` argument of `float ('inf')`, so it stops only when


> your simpack raises `WorldEnded`. Since I don't know your simpack I
> can't know when it will raise `WorldEnded` and therefore I can't know
> how long your list of states `si` will be.

I have a problem with n agents (with type p_i) who die after k
rounds. Thus, I want to pull out a value after every k round in order
see how the distribution of agents changes (i.e. different p_i values).

The problem is probably that I did not understand GarlicSim properly,
i.e. how to run in the foreground, i.e. run until WorldEnded and then
run the loop. But you'd know more about this.

> I refactored it a bit for you, maybe now it will be easier to debug:

Well, it worked out when my laptop was on power and hence my CPU ran on
full speed.

Cheers,
Rasmus

--
Sent from my Emacs

Reply all
Reply to author
Forward
0 new messages