NetLogo / models

NetLogo Models Library
106 stars 95 forks source link

Ising info tab not consistent with the code #204

Closed ToonTalk closed 8 years ago

ToonTalk commented 8 years ago

Info tab says

This model makes 1000 attempted flips in every iteration of the GO loop. It codes this as repeat 1000 [ update ].

while the code is

repeat 1000 [ ask one-of patches [ update ] ]

The info tab discusses what I would have thought is a better way to code this

ask patches [ update ]

or maybe better

ask n-of 1000 patches [update]

In either case I don't see why the code and Info tab do

tick-advance 1000 ;; use tick-advance, as we are updating 1000 patches at a time update-plots ;; unlike tick, tick-advance doesn't update the plots, so we need to do so explicitly

rather than

tick.

Maybe I misunderstand the physics regarding what can happen in a tick but I would expect any number of flips so why advance the tick counter by 1000?

SethTisue commented 8 years ago

I would expect any number of flips so why advance the tick counter by 1000

so that the number of ticks indicates the actual number of flips. doing 1000 flips at a time is an efficiency hack, so I don't think it makes sense to have it show up in the results of the model — and the value of the tick counter is a result.

perhaps the model settings should be changed so that the tick counter reads "flips" instead of "ticks", to emphasize the correspondence.

ToonTalk commented 8 years ago

Actually it is the number of calls to update which conditionally flip.

Why not think of ticks as time even iin this model?

SethTisue commented 8 years ago

Actually it is the number of calls to update which conditionally flip

ah, good point. I withdraw the suggestion.

nicolaspayette commented 8 years ago

Info tab says

This model makes 1000 attempted flips in every iteration of the GO loop. It codes this as repeat 1000 [ update ].

while the code is repeat 1000 [ ask one-of patches [ update ] ]

Good catch. I changed it ( e7621b0).

Actually it is the number of calls to update which conditionally flip

Well, maybe we can tweak Seth's suggestion and use "attempted flicks" instead (3d15f34).

Why not think of ticks as time even in this model?

The fact that there is 1000 attempted flicks per tick is a performance hack and has no correspondence with anything in the original Ising model (or the world, for that matter). The number 1000 is somewhat arbitrary: it could also have been 500 or 2000. The "attempted flicks" counter, at least, corresponds to steps in the original Metropolis–Hastings algorithm that the model implements.

That being said, I agree that the current situation is a bit confusing. There were internal discussions about it, a few updates and a failed attempt to clarify it. Right now, we don't know how to make it run fast enough without the hack.

But maybe we could do a better job of explaining the situation in the info tab. I'll give it a try. (Suggestions welcome...)

nicolaspayette commented 8 years ago

The info tab currently says:

If we called tick at the end, then the tick counter would advance only once for every 1000 attempted flips and the Ising model measures the magnetization at every attempted flip. We therefore use tick-advance primitive to advance the NetLogo clock and sync it up with the traditional Ising model.

Maybe I'm cursed with prior knowledge, but that seems clear to me (especially when combined with the newly named "attempted flips" counter on top of the view). I'm always open to ideas for improvement, but I think it's OK like this.

ToonTalk commented 8 years ago

Perhaps adding a sentence that ticks aren't representing time is needed. Unless you think everyone will notice the new label for ticks. Though some people read the Info Tab first.

nicolaspayette commented 8 years ago

ticks aren't representing time

Well, I guess it depends how you see it: I think they do represent time: time steps in the algorithm (as is the case for most models). What they don't represent (as opposed to most models) is the number of display updates that the user has seen.

I'm afraid that saying they don't represent time would be misleading, but I'm not sure how we could make things clear from both points of view.

ToonTalk commented 8 years ago

But unlike almost all models there doesn't seem to be a relationship between the time steps of the algorithm and the passage of time in the physical phenomenon being modelled.

SethTisue commented 8 years ago

But unlike almost all models there doesn't seem to be a relationship between the time steps of the algorithm and the passage of time in the physical phenomenon being modelled

There isn't? I don't understand what you mean.

nicolaspayette commented 8 years ago

I have tentatively added the following paragraph (bf8c654):

In real world materials, many flips can happen at once. In our idealized model, each step in the algorithm corresponds to an attempted flip, not to the passage of time as it would occur in the physical world.

Comments?

ToonTalk commented 8 years ago

Good. That's what I was getting at

nicolaspayette commented 8 years ago

:+1: :-)