open to change model

10 views
Skip to first unread message

howard...@gmail.com

unread,
Jun 7, 2011, 10:43:27 AM6/7/11
to The Modelling4All Project
hello,

i am having trouble understanding why this model only has agents
interacting with patches at the centre:

http://m.modelling4all.org/m/?frozen=WNcd10cuEY08g3a9jZ7M67&MforAllModel=1

any ideas?

regards, howard

Ken Kahn

unread,
Jun 7, 2011, 4:12:34 PM6/7/11
to modell...@googlegroups.com
Hi.

All the people are at the centre and patches-here then returns the patch at the centre for all the people.

Best,

-ken


--
You received this message because you are subscribed to the Google Groups "The Modelling4All Project" group.
To post to this group, send email to modell...@googlegroups.com.
To unsubscribe from this group, send email to modelling4al...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/modelling4all?hl=en.


Ken Kahn

unread,
Jun 7, 2011, 4:19:11 PM6/7/11
to modell...@googlegroups.com
Also

objects-here with [kind = "patches"]

returns the single object which is the prototype named 'patches'. This has nothing to do with the NetLogo agentset named 'patches'.

Best,

-ken

howard...@gmail.com

unread,
Jun 8, 2011, 5:53:24 AM6/8/11
to The Modelling4All Project
I got it working by separating the two things I wanted to do in this
one behaviour:

http://m.modelling4all.org/m/?frozen=0CQaae32Kuf8IrfzZQsE7g&MforAllModel=1

e.g. one MB to add-behaviours-to "self" (to gain energy from patches)
and another to "patch-here" (to lose energy as an agent passes over
the patch).

this is neat but the discrepancy with netlogo primitives of the same
name might confuse.

many thanks, howard

On Jun 7, 9:19 pm, Ken Kahn <toont...@gmail.com> wrote:
> Also
>
> objects-here with [kind = "patches"]
>
> returns the single object which is the prototype named 'patches'. This has
> nothing to do with the NetLogo agentset named 'patches'.
>
> Best,
>
> -ken
>
> On 7 June 2011 21:12, Ken Kahn <toont...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi.
>
> > All the people are at the centre and patches-here then returns the patch at
> > the centre for all the people.
>
> > Best,
>
> > -ken
>
> > On 7 June 2011 15:43, howard.no...@gmail.com <howard.no...@gmail.com>wrote:
>
> >> hello,
>
> >> i am having trouble understanding why this model only has agents
> >> interacting with patches at the centre:
>
> >>http://m.modelling4all.org/m/?frozen=WNcd10cuEY08g3a9jZ7M67&MforAllMo...

howard...@gmail.com

unread,
Jun 8, 2011, 7:02:04 AM6/8/11
to The Modelling4All Project
Now I have a similar issue with making the taking of energy from
patches conditional. I only want agents to take energy if energy-of-
patch > 0.

In NetLogo I would do this something like: if [pxcor] of patch-here <
0 [fd 1] OR if [energy-of-patch] of patch-here < 0 [add-behaviour-to
patch here to lose energy]

as in: http://m.modelling4all.org/p/en/MB.4/ADD-BEHAVIOURS-TO.html#changes=CFoRueSxCw2MXWX7i9tR47

but this approach throws errors. How should I be doing this in the BC?

Many thanks, Howard

On Jun 8, 10:53 am, "howard.no...@gmail.com" <howard.no...@gmail.com>
wrote:
> I got it working by separating the two things I wanted to do in this
> one behaviour:
>
> http://m.modelling4all.org/m/?frozen=0CQaae32Kuf8IrfzZQsE7g&MforAllMo...

howard...@gmail.com

unread,
Jun 15, 2011, 5:54:51 AM6/15/11
to The Modelling4All Project
hello again,

I do not understand the error with this model:

http://m.modelling4all.org/m/?frozen=LaIC2uJu9PY-JW9HE6HJ56&MforAllModel=1

I think it is something to do with the scheduling of the 'agent buys
land' micro-behaviour. In NL the error is in the common behaviour tab
throwing the run time error:

error while object 3 running ASK in procedure PROCEDURE (C:\Documents
and Settings\howardn\Desktop\modelling
\common_behaviour_composer_v12.nls)
called by procedure START-TICK (C:\Documents and Settings\howardn
\Desktop\modelling\common_behaviour_composer_v12.nls)
called by procedure GO-UNTIL (C:\Documents and Settings\howardn
\Desktop\modelling\common_behaviour_composer_v12.nls)
called by procedure SETUP (C:\Documents and Settings\howardn\Desktop
\modelling\common_behaviour_composer_v12.nls)
ASK expected input to be an agent or agentset but got the TRUE/FALSE
false instead.
(halted running of SETUP)



On Jun 8, 12:02 pm, "howard.no...@gmail.com" <howard.no...@gmail.com>
wrote:
> Now I have a similar issue with making the taking of energy from
> patches conditional. I only want agents to take energy if energy-of-
> patch > 0.
>
> In NetLogo I would do this something like: if [pxcor] of patch-here <
> 0 [fd 1] OR if [energy-of-patch] of patch-here < 0 [add-behaviour-to
> patch here to lose energy]
>
> as in:http://m.modelling4all.org/p/en/MB.4/ADD-BEHAVIOURS-TO.html#changes=C...

Ken Kahn

unread,
Jun 15, 2011, 7:31:22 AM6/15/11
to modell...@googlegroups.com
Perhaps due to some bug in the new support for scheduling enhancements your 'agent buys land' has

do-every my-assets >= 200 ..

where do-every expects a number. do-every 1 ... fixes the problem.

If you have the history (session=...) URL I might be able to figure out why it had  my-assets >= 200 for the repeat count.

Issue 545 is to enhance the error message in this case so it is clear what is wrong.

Thanks for reporting this.

Best,

-ken

Howard Noble

unread,
Jun 15, 2011, 7:43:30 AM6/15/11
to modell...@googlegroups.com
can you get to the history using:


at first i put "if" into that box, then realised i was duplicating the do-if statement. i noticed that even after deleting it, it was being cached somehow. maybe this is related?

howard...@gmail.com

unread,
Jun 20, 2011, 11:13:10 AM6/20/11
to The Modelling4All Project
hello,

I would like to replicate this program in the BC:

to setup
ca
cro 10
ask turtles [ fd random 10 set color random 255]
end

to go
let x first [color] of turtles with-max [color]
ask turtles [
set color 61 + ( ( ( color / x ) * 80 ) / 10 )
]
end

i created a new prototype called 'parameters' and put an update
parameter MB on it. then i try to set the color of agents as above:
http://m.modelling4all.org/m/?frozen=I9S8BeKTzwtchzEOzGAJ5f&MforAllModel=1

is this a preferred way to go about this approach to setting color?
any idea why am i getting list empty error?



On Jun 15, 12:43 pm, Howard Noble <howard.no...@gmail.com> wrote:
> can you get to the history using:
>
> http://m.modelling4all.org/m/?copy=-frfneS1HY1xv472ysnN48&MforAllModel=1
>
> at first i put "if" into that box, then realised i was duplicating the do-if
> statement. i noticed that even after deleting it, it was being cached
> somehow. maybe this is related?
>
>
>
>
>
>
>
> On Wed, Jun 15, 2011 at 12:31 PM, Ken Kahn <toont...@gmail.com> wrote:
> > Perhaps due to some bug in the new support for scheduling enhancements your
> > 'agent buys land' has
>
> > do-every my-assets >= 200 ..
>
> > where do-every expects a number. do-every 1 ... fixes the problem.
>
> > If you have the history (session=...) URL I might be able to figure out why
> > it had  my-assets >= 200 for the repeat count.
>
> > Issue 545 is to enhance the error message in this case so it is clear what
> > is wrong.
>
> > Thanks for reporting this.
>
> > Best,
>
> > -ken
>
> > On 15 June 2011 10:54, howard.no...@gmail.com <howard.no...@gmail.com>wrote:
>
> >> hello again,
>
> >> I do not understand the error with this model:
>
> >>http://m.modelling4all.org/m/?frozen=LaIC2uJu9PY-JW9HE6HJ56&MforAllMo...

Ken Kahn

unread,
Jun 20, 2011, 1:39:27 PM6/20/11
to modell...@googlegroups.com
Hi.

DEFINE-PARAMETER is for defining parameters -- you should be using UPDATE-PARAMETER. DEFINE-PARAMETER runs before any other setup --- the other agents haven't been created yet.

It doesn't make sense to repeatedly do DEFINE-PARAMETER -- Issue 553 addresses this.

Also since you divide by the-max-cash you need to be sure it is never zero.


fixes these problems. (But sometimes the-max-cash gets set to zero since everyone's my-cash is zero.)

Best,

-ken

howard...@gmail.com

unread,
Aug 17, 2011, 12:29:45 PM8/17/11
to The Modelling4All Project
I can't work out why the histogram behaviour isn't working here:

http://m.modelling4all.org/m/?frozen=-C4O20-pv3MMwcBrN84o7f&MforAllModel=1

any ideas? also i can't see why replacing all-of-kind or something
equivalent doesn't work but all-individuals does?

with all-individuals the histogram seems to plot as expected at the
start but not afters (adding do repeatedly doesn't make a difference).

thanks, howard

On Jun 20, 6:39 pm, Ken Kahn <toont...@gmail.com> wrote:
> Hi.
>
> DEFINE-PARAMETER is for defining parameters -- you should be using
> UPDATE-PARAMETER. DEFINE-PARAMETER runs before any other setup --- the other
> agents haven't been created yet.
>
> It doesn't make sense to repeatedly do DEFINE-PARAMETER -- Issue 553
> addresses this.
>
> Also since you divide by the-max-cash you need to be sure it is never zero.
>
> http://m.modelling4all.org/m/?frozen=KyyEA0BlGi5S90guu7ML7d&MforAllMo...
>
> fixes these problems. (But sometimes the-max-cash gets set to zero since
> everyone's my-cash is zero.)
>
> Best,
>
> -ken
>
> On 20 June 2011 16:13, howard.no...@gmail.com <howard.no...@gmail.com>wrote:
>
>
>
>
>
>
>
> > hello,
>
> > I would like to replicate this program in the BC:
>
> > to setup
> >  ca
> >  cro 10
> >  ask turtles [ fd random 10 set color random 255]
> > end
>
> > to go
> >  let x first [color] of turtles with-max [color]
> >  ask turtles [
> >    set color 61 +  ( ( ( color / x ) * 80 ) / 10 )
> >  ]
> > end
>
> > i created a new prototype called 'parameters' and put an update
> > parameter MB on it. then i try to set the color of agents as above:
> >http://m.modelling4all.org/m/?frozen=I9S8BeKTzwtchzEOzGAJ5f&MforAllMo...

Ken Kahn

unread,
Aug 18, 2011, 6:03:19 PM8/18/11
to modell...@googlegroups.com
Hi.

Turns out there is a bug in the parsing of the histogram
micro-behaviour code. See Issue 579:

http://code.google.com/p/modelling4all/issues/detail?id=579

Will work on it soon.

Best,

-ken

howard...@gmail.com

unread,
Sep 12, 2011, 11:09:59 AM9/12/11
to The Modelling4All project
hello again,

i can't work out why my agents don't face the patches they've decided
to move to:
http://m.modelling4all.org/m/?frozen=7X9EU0cmZ6uMMSMFiaIM58&MforAllModel=1
i think i am doing something equivalent to this in NL (where they do
turn):

turtles-own [ a ]

to setup
ca
cro 10 [ fd random 12 set size 2]
ask patches [ set pcolor random 20 ]
end

to go
ask turtles [
set a max-one-of patches in-radius 8 [ pcolor ]
face a
fd 1]
end

I think this is the equivalent in the BC:
http://m.modelling4all.org/m/?frozen=2yq9S047WH-oFqSQYdHj79&MforAllModel=1

where agents still don't turn to face their desired heading.

thanks, howard

On Aug 18, 11:03 pm, Ken Kahn <toont...@gmail.com> wrote:
> Hi.
>
> Turns out there is a bug in the parsing of the histogram
> micro-behaviour code. See Issue 579:
>
> http://code.google.com/p/modelling4all/issues/detail?id=579
>
> Will work on it soon.
>
> Best,
>
> -ken
>
> On 18/08/2011, howard.no...@gmail.com <howard.no...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I can't work out why the histogram behaviour isn't working here:
>
> >http://m.modelling4all.org/m/?frozen=-C4O20-pv3MMwcBrN84o7f&MforAllMo...

Ken Kahn

unread,
Sep 12, 2011, 8:48:24 PM9/12/11
to modell...@googlegroups.com
Hi.

It should all work fine if you use the micro-behaviours like JUMP-FORWARD and TURN-TOWARDS-ANOTHER.

The problem is that the BehaviourComposer has its own attributes for heading and position and they are used at the end of each cycle to update the position and heading of agents. So 'fd' and 'face' work but are then clobbered micro-seconds later.

Best,

-ken

--
You received this message because you are subscribed to the Google Groups "The Modelling4All project" group.

howard...@gmail.com

unread,
Sep 13, 2011, 11:40:44 AM9/13/11
to The Modelling4All project
I changed the code to use turn towards another:

http://m.modelling4all.org/m/?frozen=2sFCzKKL0LWHFim9TwPI45&MforAllModel=1

but i think this only works for models where you want an agent to turn
towards an agent.
i want my agents to turn towards a preferred patch.

any ideas?

On Sep 13, 1:48 am, Ken Kahn <toont...@gmail.com> wrote:
> Hi.
>
> It should all work fine if you use the micro-behaviours like JUMP-FORWARD
> and TURN-TOWARDS-ANOTHER.
>
> The problem is that the BehaviourComposer has its own attributes for heading
> and position and they are used at the end of each cycle to update the
> position and heading of agents. So 'fd' and 'face' work but are then
> clobbered micro-seconds later.
>
> Best,
>
> -ken
>
> On 13 September 2011 00:09, howard.no...@gmail.com
> <howard.no...@gmail.com>wrote:
>
>
>
>
>
>
>
> > hello again,
>
> > i can't work out why my agents don't face the patches they've decided
> > to move to:
> >http://m.modelling4all.org/m/?frozen=7X9EU0cmZ6uMMSMFiaIM58&MforAllMo...
> > i think i am doing something equivalent to this in NL (where they do
> > turn):
>
> > turtles-own [ a ]
>
> > to setup
> >  ca
> >  cro 10 [ fd random 12 set size 2]
> >  ask patches [ set pcolor random 20 ]
> > end
>
> > to go
> >  ask turtles [
> >    set a max-one-of patches in-radius 8 [ pcolor ]
> >    face a
> >    fd 1]
> > end
>
> > I think this is the equivalent in the BC:
> >http://m.modelling4all.org/m/?frozen=2yq9S047WH-oFqSQYdHj79&MforAllMo...
> ...
>
> read more »

Ken Kahn

unread,
Sep 13, 2011, 8:08:57 PM9/13/11
to modell...@googlegroups.com
The next release of TURN-TOWARDS-ANOTHER will work with patches just fine.

In the meanwhile you can use TURN-TOWARDS-GOAL and use [pxcor] of patch [pycor] of patch for the coordinates.

-ken

You received this message because you are subscribed to the Google Groups "The Modelling4All project" group.

howard...@gmail.com

unread,
Sep 15, 2011, 9:36:37 AM9/15/11
to The Modelling4All project
hey again,

i'd like to use the histogram again - is there a workaround for the
bug we found earlier?

http://m.modelling4all.org/m/?frozen=6uVMteL-AyeCPhSIByJj67&MforAllModel=1

thanks, howard

On Sep 14, 1:08 am, Ken Kahn <toont...@gmail.com> wrote:
> The next release of TURN-TOWARDS-ANOTHER will work with patches just fine.
>
> In the meanwhile you can use TURN-TOWARDS-GOAL and use [pxcor] of patch
> [pycor] of patch for the coordinates.
>
> -ken
>
> On 14 September 2011 00:40, howard.no...@gmail.com
> <howard.no...@gmail.com>wrote:
>
>
>
>
>
>
>
> > I changed the code to use turn towards another:
>
> >http://m.modelling4all.org/m/?frozen=2sFCzKKL0LWHFim9TwPI45&MforAllMo...
> ...
>
> read more »

Ken Kahn

unread,
Sep 15, 2011, 7:17:44 PM9/15/11
to modell...@googlegroups.com
Hi.

There is a problem interpreting the legend. If you just remove the part that says:

"label" "red"

then it should work. But without any legends.

The bug is now Issue 584.

Best,

-ken

> ...
>
> read more »

Howard Noble

unread,
Sep 16, 2011, 4:49:43 AM9/16/11
to modell...@googlegroups.com
great that worked.

is there a way to get at the position coordinates for the buttons, view and other UI components. I'd like to remove a lot of the white space from the default layout i.e. something like the NL attached.
> --
> You received this message because you are subscribed to the Google Groups "The Modelling4All project" group.
> To post to this group, send email to modell...@googlegroups.com.
> To unsubscribe from this group, send email to modelling4al...@googlegroups.com <modelling4all%2Bunsu...@googlegroups.com>.
0a5Pw032j2IMbx9icvhU7f.nlogo

Ken Kahn

unread,
Sep 16, 2011, 5:34:41 AM9/16/11
to modell...@googlegroups.com
Hi.

Perhaps you attached the wrong model. No white space removed that I noticed (and it had an error - a spurious ]).

There is a 'fake' parameter called

the-default-buttons-should-not-be-added

which if set to true will not add the setup/go/pause buttons. You can then add them using ADD-BUTTON or ADD-NETLOGO-BUTTON (but see Issue 586) and place them where ever you want. SET-WORLD-LOCATION can be used to move the main view of the model.

Best,

-ken

To unsubscribe from this group, send email to modelling4al...@googlegroups.com.

howard...@gmail.com

unread,
Sep 16, 2011, 6:54:34 AM9/16/11
to The Modelling4All project
I noticed I had a bug in this code:

if [ pcolor ] of patch-here > 61 [
if any? other all-individuals in-radius 3 [
let g [ my-greed ] of one-of other all-individuals in-radius 3
set my-greed g
ask patch-here [ set energy-of-patch energy-of-patch - g ]
set my-energy my-energy + my-greed ]
]

(http://m.modelling4all.org/m/?
frozen=bd9W8uJ5U0HbxONaAAHM67&MforAllModel=1)

because i was using "objects" instead of "all-individuals" - this
meant "the fifty" agents were setting my-greed to 0 when they
interacted with something at the centre of the view (I think?). i
don't think this should happen because the invisible agents shouldn't
have an attribute called my-greed. or is this more to do with
interacting with agents just before they die?

anyway my comment would be that "all-individuals" in this code seems a
little odd - maybe just 'individuals' would be nicer.

there is a general coding requirement here: how to interact with a
specific number of agents i.e. how to insert an "AND" into a statement
like if any? objects with [kind = "xzy" and kind = "123" etc

On Sep 16, 10:34 am, Ken Kahn <toont...@gmail.com> wrote:
> Hi.
>
> Perhaps you attached the wrong model. No white space removed that I noticed
> (and it had an error - a spurious ]).
>
> There is a 'fake' parameter called
>
> the-default-buttons-should-not-be-added
>
> which if set to true will not add the setup/go/pause buttons. You can then
> add them using ADD-BUTTON or ADD-NETLOGO-BUTTON (but see Issue 586) and
> place them where ever you want. SET-WORLD-LOCATION can be used to move the
> main view of the model.
>
> Best,
>
> -ken
>
> On 16 September 2011 16:49, Howard Noble <howard.no...@gmail.com> wrote:
>
>
>
>
>
>
>
> > great that worked.
>
> > is there a way to get at the position coordinates for the buttons, view and
> > other UI components. I'd like to remove a lot of the white space from the
> > default layout i.e. something like the NL attached.
>
> > On Friday, September 16, 2011, Ken Kahn <toont...@gmail.com> wrote:
> > > Hi.
> > > There is a problem interpreting the legend. If you just remove the part
> > that says:
> > > "label" "red"
> > > then it should work. But without any legends.
> > > The bug is now Issue 584.
> > > Best,
> > > -ken
>
> > > On 15 September 2011 21:36, howard.no...@gmail.com <
> > howard.no...@gmail.com> wrote:
>
> > > hey again,
>
> > > i'd like to use the histogram again - is there a workaround for the
> > > bug we found earlier?
>
> >http://m.modelling4all.org/m/?frozen=6uVMteL-AyeCPhSIByJj67&MforAllMo...
Reply all
Reply to author
Forward
0 new messages