Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

netlogo-users · NetLogo Users

The Yahoo! Groups Product Blog

Check it out!

Group Information

? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Messages

Advanced
Messages Help
Messages 5214 - 5243 of 16780   Oldest  |  < Older  |  Newer >  |  Newest Start Topic
Messages: Show Message Summaries Sort by Date ^  
#5214 From: "monster_economist" <monster_economist@...>
Date: Wed Nov 1, 2006 7:53 am
Subject: How to output turtle-only data in behavior space
monster_econ...
Send Email Send Email
 
I would like to output turtle-only data in behavior space is this
possible.  I have a cournot type model and I want to record each firms
output at each step.  But I get an error saying the variable of
interest is turtle only and that I can't use it in an observer
context.  Are there any work arounds for this?  ~Tim

#5215 From: "James Steiner" <gregortroll@...>
Date: Wed Nov 1, 2006 4:10 pm
Subject: Re: NetLogo Integration
askturtlezero
Send Email Send Email
 
Hi, Nathan!

Another way of doing that, without messing with APIs and additional
programming is to present the NetLogo models in a browser as java
applets. In that that mode, only the interface pane is
available--indeed, only the *content* of the interface pane is
available. The NetLogo user interface includes a function to generate
an HTML file to present the model in applet format for you. That file
includes a lot of information about itself, that you will probably
want to remove.

Then you can direct your subjects to open the html file, or, if you
put the applet file on your web server, you can direct them to a URL.

My web site, http://www.turtlezero.com, makes much use of the
run-models-as-an-applet feature.

(I also use PHP code I wrote that delves into the model files to
retrieve the applet dimensions and required version of NetLogo, and to
display the information and procedures pane information. I have, but
am not currently using, some home-grown PHP that interprets Wiki-style
markup in the information tab.)

Hope that helps!

~~James

On 10/31/06, incognitoinlatin <nskirvin@...> wrote:
> In the NetLogo controlling documentation, it mentions the existence of
> an API that allows the program to be integrated inside another Java
> app, with features such as hiding tabs. Does anyone know how to do this?
> This is useful for the research group I'm working with, as NetLogo
> simulations are briefly used for empirical analysis, but there is no
> time for teaching the language, and we do not wish students to be
> distracted by the "Procedures" tab or possibly modify the code, and
> then grow frustrated when the system does not work as it is specified to.
>
> Thanks, I searched for a topic on this subject but could not find one.
> -Nathan

~~James
_____________________
http://www.turtlezero.com

#5216 From: "sifu_008" <sifu_008@...>
Date: Wed Nov 1, 2006 4:43 pm
Subject: in-cone problem
sifu_008
Send Email Send Email
 
I am having a basic understanding problem with the in-cone primitive.
Please correct me if I am wrong.

Let's say I have 100 turtles initially in random location. Now what I
want is if there are any turtles which are in the vision of some other
turtle then those turtles which are being seen will change colour. For
example if turtle 1 can see turtle 2,3 and 4 then turtle 2, 3 and 4
will change colour. Please state whether the following code is alright:

   ask turtles [ask turtles in-cone radius angle with [self != myself]
   [set color green]]
where radius and angle are global variable taken from the slider.

Now when I use the above code ultimately all the turtles turn green.
This is because all the turtles are moving and therefore at some time
it comes under the vision of some other turtles and therefore turns
geen. Now what I want is if the turtle goes out of the vision i.e. if
at one time turtle 1 can no longer see turtle 2 then turtle 2 will
change into the original colour (white). How do I do this?
I tried with the following code but I am not sure whether it is right

ask turtles [ifelse any? turtles in-cone radius angle with [self !=
myself][set color green] [set color white]]

I have seen the "vision-cone example" in the model library but there
the turtles which change colours do not move but in this one all the
turtles are moving.

Please help

regards

sifat

#5217 From: "kubiciak" <kubiciak@...>
Date: Wed Nov 1, 2006 11:45 pm
Subject: Curve and Circle
kubiciak@...
Send Email Send Email
 
Could somebody help me??I want to draw curve or circle like patches,is
it possible in NETLOGO??? I was trying  draw circle like formula pxcor
= 19 cos(t)  + 20
pycor = 19 sin(t) -18      but cos (t) is wrong ,because cos expected
number no variable.You can help me also if you know some commands or
procedure for move turtles along curve or circle.
If you know answer on my question please contact me kubiciak@...

#5218 From: Jim Lyons <teacherjim42@...>
Date: Thu Nov 2, 2006 1:00 pm
Subject: Re: in-cone problem
jimlyons37
Send Email Send Email
 
Sifat,
You asked:
> I am having a basic understanding problem with the in-cone primitive.
> ... Now what I  want is if there are any turtles which are in the
> vision of
>  some other turtle then those turtles which are being seen will change
> colour.
> ...
>  Now what I want is if the turtle goes out of the vision i.e. if
>  at one time turtle 1 can no longer see turtle 2 then turtle 2 will
>  change into the original colour (white). How do I do this?
> ...
>  I have seen the "vision-cone example" in the model library but there
>  the turtles which change colours do not move but in this one all the
>  turtles are moving.

The same approach used in the vision-cone example should work whether
or not the turtles are moving. Every time through the main loop it
resets all the colors to "not seen", then uses in-cone from the one
that is looking to change the colors of the turtles that can be seen.
In your application, all the turtles are looking, so you have a lot
more work to do -- every turtle must run in-cone every time through the
main loop. Don't try this with 6000 turtles like the code example!

I tried this and it seems to work as you want:

to setup
    clear-all
    cct 100 [ set color gray  setxy random-xcor random-ycor ]
end

to go  ; observer, forever
    ask turtles [ rt 30  lt 30  fd .25 ]  ; wander
    ask turtles [ set color gray ]  ; reset color
    ask turtles  ; set colors of turtles seen by another turtle
    [ ask turtles in-cone 4 60 with [self != myself][ set color green ] ]
end

HTH,
Jim Lyons

#5219 From: "sifu_008" <sifu_008@...>
Date: Thu Nov 2, 2006 4:08 pm
Subject: breed problem
sifu_008
Send Email Send Email
 
I have got two different types of breeds...

if two breeds are close and not of the same type then
[ do something] that's exactly something I like to do

I tried the floowing...

to change-direction  ;; turtle procedure

let near-turtle min-one-of turtles [distance myself]
let mybreed breed-of myself
let the-other-breed breed-of near-turtle

if (mybreed != the-other-breed)
[
  ;; do something
]
end

but it gives the following error
error while white-agent 49 executing MYSELF in procedure CHANGE-
DIRECTION
called by procedure GO
no agent for MYSELF to refer to
(halted execution of go)

can anyone pls help me ... i can understand that there's something
wrong with the myself statement but what is really wrong that I have
made and how to cope with it

thanks in advance

regards
sifat

#5220 From: "James Steiner" <gregortroll@...>
Date: Thu Nov 2, 2006 4:44 pm
Subject: Re: breed problem
askturtlezero
Send Email Send Email
 
Hi Sifat!

You don't mean MYSELF. You mean SELF. Myself refers to some other
turtle, but in this context, there is no other turtle to refer to...
Myself is the turtle asking this turtle to do something... Such as in
[distance myself]  this turtle is asking the other turtles to check
the distance to this turtle... so MYSELF refers back to the original
turtle.

And since BREED-OF SELF = BREED, you don't need to use -OF anything for that.

Also, since this turtle is a turtle (!) and since the distance from
this turtle to itself is zero, when a turtle runs min-one-of turtles [
distance myself ], it will always return ITSELF!!

You need to exclude this turtle from the group that is examined.

So, you could write this:

;; turtle procedure
;; if the breed of the nearest turtle is not the same as your breed,
do something
let nearest min-one-of turtles with [ myself != self ] [ distance myself ]
ifelse breed-of nearest != breed
[ do_something ]
[ do_something_else ]


~~James
_____________________
http://www.turtlezero.com

On 11/2/06, sifu_008 <sifu_008@...> wrote:
> I have got two different types of breeds...
>
> if two breeds are close and not of the same type then
> [ do something] that's exactly something I like to do
>
> I tried the floowing...
>
> to change-direction  ;; turtle procedure
>
> let near-turtle min-one-of turtles [distance myself]
> let mybreed breed-of myself
> let the-other-breed breed-of near-turtle
>
> if (mybreed != the-other-breed)
> [
>  ;; do something
> ]
> end
>
> but it gives the following error
> error while white-agent 49 executing MYSELF in procedure CHANGE-
> DIRECTION
> called by procedure GO
> no agent for MYSELF to refer to
> (halted execution of go)
>
> can anyone pls help me ... i can understand that there's something
> wrong with the myself statement but what is really wrong that I have
> made and how to cope with it
>
> thanks in advance
>
> regards
> sifat

#5221 From: "Matt Parker" <mprk@...>
Date: Thu Nov 2, 2006 3:08 pm
Subject: Switch/Case Statement
parker20121
Send Email Send Email
 
If you're taking suggestions for improving the tool, I would request
adding a switch/case statement construct to the language. Perhaps this
wasn't provided in the original logo paradigm, but it would be a nice
addition in my mind.

#5222 From: Esther Verreau <everreau@...>
Date: Thu Nov 2, 2006 8:26 pm
Subject: Re: using an output box on clients in HubNet
estherverreau
Send Email Send Email
 
>
> So you're saying that I have to send my test string to a monitor and not to
> an output box, right?
>
> Interestingly, NetLogo 3.1.3 on my laptop let me create an output box on a
> client, but NetLogo 3.1.3 on my desktop has it greyed out. Same operating
> system, same processor.
>

Do you mean an input box? or an output area? (I know it's confusing)
either way I think in this situation a monitor makes the most sense. You
don't need an input box because there's no reason for the user to change
the value, and you don't need an output area because once the error goes
away there's no reason for the user to review the old error messages, they
only need to see the current information.

when you say it's grayed out you mean the widget is grayed out? or the
choice in the menu?  even though you could technically but an output area
on the client it won't really help you because there isn't any way to
address it (it doesn't have a name).  We haven't implemented it as a
hubnet client so I don't recommend using it.

hope this helps

esther

#5223 From: Jim Lyons <teacherjim42@...>
Date: Thu Nov 2, 2006 6:21 pm
Subject: Re: Switch/Case Statement
jimlyons37
Send Email Send Email
 
On Nov 2, 2006, at 10:08 AM, Matt Parker wrote:

> If you're taking suggestions for improving the tool, I would request
>  adding a switch/case statement construct to the language. Perhaps this
>  wasn't provided in the original logo paradigm, but it would be a nice
>  addition in my mind.

I used to wish for this too, but have gotten very comfortable with
using an if-else structure in the following format, which someone here
suggested a while back. I doubt there would be any performance
advantage to having an actual switch statement.

; switch on subtype
ifelse subtype = "A" [
    ; case A
][
ifelse subtype = "B" [
    ; case B
][
ifelse subtype = "C" [
    ; case C
][
    ; default case
]]]; end switch

I usually type out the outline first and then fill in the cases. The
bracket pairing feature of the script editor makes it easy to type the
right number of closing brackets. The comments and the visual structure
make it easy to see what's going on.

BTW, my experience is that the nice folks at CCL do take suggestions at
the feedback address.

Jim Lyons

#5224 From: "incognitoinlatin" <nskirvin@...>
Date: Thu Nov 2, 2006 7:44 pm
Subject: Re: NetLogo Integration
nskirvin@...
Send Email Send Email
 
Thanks, James! That's quite an impressive array of models you have at
your site.

I'm sorry, I should have mentioned this in the initial message, but
previously we were using applets to provide the "only the interface
tab" functionality. Problem is, our research so far has given us no
indication that the NetLogo applets can write to files, and we'd like
this ability for the purposes of offline analyzation of students'
actions, and also for dynamically tailoring the questions in a
quizzing environment. For instance, the system could ask the students
after a run of the simulation, "What happened?" and then have multiple
choice answers based on the actual performance of the simulation.

This is actually our primary reason for wanting to put the system in
some sort of Java controlling environment: to facilitate communication
between the simulation and our other educational programs.

If anyone knows of a way to allow the applets to write to a file, this
would be an equally feasible solution for us.

Thanks for your time!
-Nathan

--- In netlogo-users@yahoogroups.com, "James Steiner"
<gregortroll@...> wrote:
>
> Hi, Nathan!
>
> Another way of doing that, without messing with APIs and additional
> programming is to present the NetLogo models in a browser as java
> applets. In that that mode, only the interface pane is
> available--indeed, only the *content* of the interface pane is
> available. The NetLogo user interface includes a function to generate
> an HTML file to present the model in applet format for you. That file
> includes a lot of information about itself, that you will probably
> want to remove.
>
> Then you can direct your subjects to open the html file, or, if you
> put the applet file on your web server, you can direct them to a URL.
>
> My web site, http://www.turtlezero.com, makes much use of the
> run-models-as-an-applet feature.
>
> (I also use PHP code I wrote that delves into the model files to
> retrieve the applet dimensions and required version of NetLogo, and to
> display the information and procedures pane information. I have, but
> am not currently using, some home-grown PHP that interprets Wiki-style
> markup in the information tab.)
>
> Hope that helps!
>
> ~~James
>
> On 10/31/06, incognitoinlatin <nskirvin@...> wrote:
> > In the NetLogo controlling documentation, it mentions the existence of
> > an API that allows the program to be integrated inside another Java
> > app, with features such as hiding tabs. Does anyone know how to do
this?
> > This is useful for the research group I'm working with, as NetLogo
> > simulations are briefly used for empirical analysis, but there is no
> > time for teaching the language, and we do not wish students to be
> > distracted by the "Procedures" tab or possibly modify the code, and
> > then grow frustrated when the system does not work as it is
specified to.
> >
> > Thanks, I searched for a topic on this subject but could not find one.
> > -Nathan
>
> ~~James
> _____________________
> http://www.turtlezero.com
>

#5225 From: "James Steiner" <gregortroll@...>
Date: Thu Nov 2, 2006 8:31 pm
Subject: Re: Switch/Case Statement
askturtlezero
Send Email Send Email
 
Hi Matt!

There are definitely times I've wished for one too.

But not having it has more than once made me look at the task of
having to type out all those nested ifelse blocks, and inspired me to
find other solutions, that didn't involve ifelse blocks or switch
statements--of course, that's not always possible.

But anyway, near the closest you can get, when execution speed isn't
important, is this:

;; does the first match
    select-case x [
      [ 1   "do-case-1" ]
      [ 4   "do-case-2" ]
      [ "G" "do-case-3" ]
     ]
end

; The procedure goes like this:

to select-case [ value cases ]
    foreach cases
    [ if first ? = value [ run last ? stop ]
    ]
end

The big disadvantages are speed and that the code in the quotes is not
error-checked until run-time, which is why you would want to
encapsulate the code in procedures--once the procedure name is
decoded, the procedure runs full speed, and the code in the procedure
is already compiled and error-checked.

~~James
_____________________
http://www.turtlezero.com

On 11/2/06, Matt Parker <mprk@...> wrote:
> If you're taking suggestions for improving the tool, I would request
> adding a switch/case statement construct to the language. Perhaps this
> wasn't provided in the original logo paradigm, but it would be a nice
> addition in my mind.

#5226 From: "Matt Parker" <mprk@...>
Date: Fri Nov 3, 2006 2:24 pm
Subject: Re: Switch/Case Statement
parker20121
Send Email Send Email
 
--- In netlogo-users@yahoogroups.com, Jim Lyons <teacherjim42@...>
wrote:
>
> On Nov 2, 2006, at 10:08 AM, Matt Parker wrote:
>
> > If you're taking suggestions for improving the tool, I would
request
> >  adding a switch/case statement construct to the language.
Perhaps this
> >  wasn't provided in the original logo paradigm, but it would be a
nice
> >  addition in my mind.
>
> I used to wish for this too, but have gotten very comfortable with
> using an if-else structure in the following format, which someone
here
> suggested a while back. I doubt there would be any performance
> advantage to having an actual switch statement.
>
> ; switch on subtype
> ifelse subtype = "A" [
>    ; case A
> ][
> ifelse subtype = "B" [
>    ; case B
> ][
> ifelse subtype = "C" [
>    ; case C
> ][
>    ; default case
> ]]]; end switch
>
> I usually type out the outline first and then fill in the cases.
The
> bracket pairing feature of the script editor makes it easy to type
the
> right number of closing brackets. The comments and the visual
structure
> make it easy to see what's going on.
>
> BTW, my experience is that the nice folks at CCL do take
suggestions at
> the feedback address.
>
> Jim Lyons
>

Concerning performance. If the netlogo code is translated directly
into Java, compiled, and then run, it efficiency depends on the
values you are branching on in the switch statement. If they are
dense, the compiler creates a jump table, otherwise its performing a
binary search. If you have a lot of successive if statements, then I
think there would be an advantage from either of the case used by the
compiler. If its a small number of branching conditions, then it's
probably not that important.

#5227 From: "/dev/random" <max.diems@...>
Date: Fri Nov 3, 2006 2:16 pm
Subject: Colour chooser
gnt3366
Send Email Send Email
 
Is there a way to have colour choices in a chooser with colour names? I'm currently using the colour numbers and a textbox to show what they are. If there isn't a way I'd like confirmation of that.

--
Ten movies streaming across that, that internet, and what happens to your own personal internet? I just the other day got...an internet was sent by my staff at 10 o'clock in the morning on Friday, I got it yesterday. Why? [...] They want to deliver vast amounts of information over the Internet. And again, the Internet is not something you just dump something on. It's not a big truck. It's a series of tubes.
--That idiot, Ted Stevens

NOTICE:
The contents of this email and any attachments are confidential. It is
intended for the named recipient(s) only. If you have received this email
in error please notify the sender immediately and
do not disclose the contents to anyone or make copies.

#5228 From: "Matt Parker" <mprk@...>
Date: Fri Nov 3, 2006 2:30 pm
Subject: Re: Switch/Case Statement
parker20121
Send Email Send Email
 
--- In netlogo-users@yahoogroups.com, "James Steiner"
<gregortroll@...> wrote:
>
> Hi Matt!
>
> There are definitely times I've wished for one too.
>
> But not having it has more than once made me look at the task of
> having to type out all those nested ifelse blocks, and inspired me
to
> find other solutions, that didn't involve ifelse blocks or switch
> statements--of course, that's not always possible.
>
> But anyway, near the closest you can get, when execution speed isn't
> important, is this:
>
> ;; does the first match
>    select-case x [
>      [ 1   "do-case-1" ]
>      [ 4   "do-case-2" ]
>      [ "G" "do-case-3" ]
>     ]
> end
>
> ; The procedure goes like this:
>
> to select-case [ value cases ]
>    foreach cases
>    [ if first ? = value [ run last ? stop ]
>    ]
> end
>
> The big disadvantages are speed and that the code in the quotes is
not
> error-checked until run-time, which is why you would want to
> encapsulate the code in procedures--once the procedure name is
> decoded, the procedure runs full speed, and the code in the
procedure
> is already compiled and error-checked.
>
> ~~James
> _____________________
> http://www.turtlezero.com
>
> On 11/2/06, Matt Parker <mprk@...> wrote:
> > If you're taking suggestions for improving the tool, I would
request
> > adding a switch/case statement construct to the language. Perhaps
this
> > wasn't provided in the original logo paradigm, but it would be a
nice
> > addition in my mind.
>

Thanks for your's, and Jim's suggestions. Unfortunately, every ounce
of speed counts in my current implementation, but perhaps this will
help push me in another direction.

#5229 From: "James Steiner" <gregortroll@...>
Date: Fri Nov 3, 2006 4:57 pm
Subject: Re: Colour chooser
askturtlezero
Send Email Send Email
 
Hi, Max!


On 11/3/06, /dev/random <max.diems@...> wrote:
>
> Is there a way to have colour choices in a chooser with colour names?
> I'm currently using the colour numbers and a textbox to show what they are.
> If there isn't a way I'd like confirmation of that.

You can load a chooser with color names, in the form of strings. You have to treat them like strings, otherwise, they will be converted to numbers in the chooser (the color names are constants, rather than reporters, and they behave more like literal numbers).

Then, there are two ways to proceed.

One way, the most obvious but slowest, is to convert the strings back to numbers using run-result:

;; assume a chooser called "pick-color" containing:
;; "red" "orange" "brown" "yellow" "lime" "green" "sky" "blue"
set color run-result pick-color

The second, perhaps less obvious, way is to make a list of the same exact color name  as in the chooser, and also make a list of the corresponding color numbers (or expressions with named colors). You search the color names list for the color name string from the chooser. the index of the found name is used to select the color value from the color number list.

One advantage of this method is that you can include additional made-up named colors that don't have names in netlogo. The other advantage is that it runs 200 to 400 times faster than the first method. I checked. As you add more colors, average speed decreases, but it is still very, very fast.

;; assumes: chooser "choose-color" exists
;; assumes: choose-color contains: "red" "brick" "yellow" "lemon"
;; assumes: globals [ cnames cvalues ]
;; assumes: set
cnames  (list "red" "brick" "yellow" "lemon")
;; assumes: set cvalues (list  red (red - 2) yellow (yellow + 2))
to-report color-from-string [ string ]
   report item ( position choose-color cnames ) cvalues
end

It is so fast, sometimes it would convert 10,000 strings in less than 1 timer tick (~.016 seconds) -- I had to do a 100,000 string test to avoid div-by-zero errors when calculating the speed differences.

Hope this helps!

~~James
http://www.turtlezero.com
(JA-86)



#5230 From: "monster_economist" <monster_economist@...>
Date: Mon Nov 6, 2006 6:39 am
Subject: behavior space
monster_econ...
Send Email Send Email
 
Is it possible to output turtle only data to behavior space?  ~Tim

#5231 From: "cajunmikeb" <bienvenu@...>
Date: Mon Nov 6, 2006 3:55 pm
Subject: when a turtle gets to the right patch...
cajunmikeb
Send Email Send Email
 
Hi,

I'm having a procedure-scope problem, and need a pointer.
Objective:  when a turtle reaches a certain type of patch (by color),
the following things need to happen:
the specific patch needs to do some stuff (like, generate a new turtle
or something)
and, the turtle that just got there needs to kick off (die).

I am trying the following code (excerpts only):
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to move-messages
   ask turtles
   [
     if (direction? = 0) and (ycor < max-pycor)
     [
       set ycor (ycor + 1)
     ]
     ;; and other directions, edited out
     ;;  set my-patch patch-here
   ]
   set rcvd-msgs turtles with [pcolor = green]
end
to generate-message [generator]

   cct 1
   [
     set heading 0
     set direction? random 3.5
     ;;  show direction?
     if direction? = 0
     [
       setxy (pxcor-of generator) ((pycor-of generator) + 1)
     ]
     ;; and other headings too, edited out
     set speed msg-speed
     set color red
   ]
end
to go
   move-messages
   receive-messages
   let generator one-of nodes
   generate-message generator
end
;;;;;;;;;;;;;;;;;;;

the error message (in the procedures editor, not at runtime, says:
You can't use GENERATE-MESSAGE in a turtle context, because
GENERATE-MESSAGE is observer-only.

I can't find any discussion of procedure scoping.  is there something
posted somewhere?

thanks much
-Mike B

#5232 From: "freysein2005" <flo@...>
Date: Sun Nov 5, 2006 12:50 pm
Subject: Ranking - Turtle Id
freysein2005
Send Email Send Email
 
Hello,

ist there a way to sort/rank values of my turtles and give another
breed the Id's and not the values of the turtle.

Example:
  customers buy in different stores. after every purchase they
calculate their satisfaction factor of every store.
like this

customer 1[
     store 1 = 5 points
     store 2 = 3 points
     store 3 = 8 points
     store 4 = 7 points
]

customer 2[
     store 1 = 3 points
     store 2 = 4 points
     store 3 = 6 points
     store 4 = 7 points
]

the sorted values for customer 1 look like this: 3 5 7 8
for customer 2 look like this 3 4 6 7

know i want to know how to get a list or the values of the store ids
like 2 1 4 3 for customer 1 and 1 2 3 4 for customer 2.
I need to know what customer 1's favorit store and what customer 2's
favorit store is.

The answer is probabliy not so difficult but I am stuck again.
Please help me.

Florian

#5233 From: "James Steiner" <gregortroll@...>
Date: Mon Nov 6, 2006 6:12 pm
Subject: Re: Ranking - Turtle Id
askturtlezero
Send Email Send Email
 
Hi, Florian!

If the list contains the stores, then the solution is fairly easy:

;; stort the list of stores by "satisfaction"
ask customers
[ set store-list ;; the destination of the sorted result
        sort-by ;; the sort-by primitive
       [ satisfaction-of ?1 >= satisfaction-of ?2 ] ;; the sort criteria
       store-list ;; the list to sort
]

;; now the customers can still access the stores in the list:
ask customers
[ show (word "My favorite store is " (first store-list) ) ]

Output Example:
customer 1: My favorite store is store 15
customer 2: My favorite store is store 21

Hope that helps!

~~James
http://www.turtlezero.com
(JA-86)


On 11/5/06, freysein2005 <flo@...> wrote:
> Hello,
>
> ist there a way to sort/rank values of my turtles and give another
> breed the Id's and not the values of the turtle.
>
> Example:
>  customers buy in different stores. after every purchase they
> calculate their satisfaction factor of every store.
> like this
>
> customer 1[
>     store 1 = 5 points
>     store 2 = 3 points
>     store 3 = 8 points
>     store 4 = 7 points
> ]
>
> customer 2[
>     store 1 = 3 points
>     store 2 = 4 points
>     store 3 = 6 points
>     store 4 = 7 points
> ]
>
> the sorted values for customer 1 look like this: 3 5 7 8
> for customer 2 look like this 3 4 6 7
>
> know i want to know how to get a list or the values of the store ids
> like 2 1 4 3 for customer 1 and 1 2 3 4 for customer 2.
> I need to know what customer 1's favorit store and what customer 2's
> favorit store is.
>
> The answer is probabliy not so difficult but I am stuck again.
> Please help me.
>
> Florian

#5234 From: "cajunmikeb" <bienvenu@...>
Date: Mon Nov 6, 2006 6:11 pm
Subject: Re: Patches Question
cajunmikeb
Send Email Send Email
 
This is great, a partial answer to my problem.  What I then need to
know how to do is get those patches (where a turtle is about to die)
to do something -- like change color, or generate a new turtle.  Any
ideas?
thanks
-Mike
--- In netlogo-users@yahoogroups.com, Andrei <andrei@...> wrote:
>
>
> On Apr 2, 2005, at 8:33 AM, Tyler Helton wrote:
>
> > Is there a way to clear only the turtles that lie
> > on a certain colored patch, but not those on different colored
> > patches?
>
> Yes. For example:
>
>  ask turtles with [ pcolor = green ] [ die ]
>
> will remove all the turtles on green patches. (This takes advantage of
> the fact that you can refer to patch variables in a turtle context;
> what gets reported is the value of that variable for the patch that the
> turtle is on.)
>
> --
> Andrei Scheinkman
> Center for Connected Learning and Computer-Based Modeling
> Northwestern University, ccl.northwestern.edu/netlogo
>

#5235 From: "James Steiner" <gregortroll@...>
Date: Mon Nov 6, 2006 6:35 pm
Subject: New Models on Turtle Zero-November
askturtlezero
Send Email Send Email
 
Hi All!

There are three new models this month on TurtleZero.com:

"Locomotion"--an exploration of bipedal locomotion patterns

http://www.turtlezero.com/models/models.php?model=locomotion-5f

"Mechanical Movement"--a simple example of a mechanical linkage

http://www.turtlezero.com/models/models.php?model=mechanical-movement

"Minos' Plumber"--Connect the pipes in the Minotaur's Labyrinth

http://www.turtlezero.com/models/models.php?model=minos-plumber_2


~~James
http://www.turtlezero.com
(JA-86)

#5236 From: "James Steiner" <gregortroll@...>
Date: Mon Nov 6, 2006 6:04 pm
Subject: Re: when a turtle gets to the right patch...
askturtlezero
Send Email Send Email
 
Hey... that means 2 things:

1. the generate message procedure contains code that can only be run
by the observer (that is, that turtles are NOT allowed to run it)

2. at some point in your code, a turtle is trying to run the generate
message procedure.

I don't see that here, perhaps it happens in your receive-message procedure?

In any case, CCT is the likely culprit. Create-custom-turtles (CCT)
can only be run by the observer. Turtles have to use HATCH to make
more turtles and patches have to use SPROUT.

In receive-messages, you can ask the received messages to deliver the
message to the patch and die

The ask the patches to handle the messages...

ask rcvd-messages
[ set patch-inbox lput message patch-inbox
   ;; message is a turtle-variable
   ;; patch-inbox is a patch variable
   ask patch-here
   [ handle-patch-inbox ]
   die
]

This can accomodate a patch getting two messages at the same time.

Hope this helps!

~~James
http://www.turtlezero.com
(JA-86)

On 11/6/06, cajunmikeb <bienvenu@...> wrote:
> Hi,
>
> I'm having a procedure-scope problem, and need a pointer.
> Objective:  when a turtle reaches a certain type of patch (by color),
> the following things need to happen:
> the specific patch needs to do some stuff (like, generate a new turtle
> or something)
> and, the turtle that just got there needs to kick off (die).
>
> I am trying the following code (excerpts only):
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> to move-messages
>   ask turtles
>   [
>     if (direction? = 0) and (ycor < max-pycor)
>     [
>       set ycor (ycor + 1)
>     ]
>     ;; and other directions, edited out
>     ;;  set my-patch patch-here
>   ]
>   set rcvd-msgs turtles with [pcolor = green]
> end
> to generate-message [generator]
>
>   cct 1
>   [
>     set heading 0
>     set direction? random 3.5
>     ;;  show direction?
>     if direction? = 0
>     [
>       setxy (pxcor-of generator) ((pycor-of generator) + 1)
>     ]
>     ;; and other headings too, edited out
>     set speed msg-speed
>     set color red
>   ]
> end
> to go
>   move-messages
>   receive-messages
>   let generator one-of nodes
>   generate-message generator
> end
> ;;;;;;;;;;;;;;;;;;;
>
> the error message (in the procedures editor, not at runtime, says:
> You can't use GENERATE-MESSAGE in a turtle context, because
> GENERATE-MESSAGE is observer-only.
>
> I can't find any discussion of procedure scoping.  is there something
> posted somewhere?
>
> thanks much
> -Mike B

#5237 From: Esther Verreau <everreau@...>
Date: Mon Nov 6, 2006 10:13 pm
Subject: Re: behavior space
estherverreau
Send Email Send Email
 
On Mon, 6 Nov 2006, monster_economist wrote:

> Is it possible to output turtle only data to behavior space?  ~Tim
>

sure.  what you probably need and are missing is value-from and
values-from.

http://ccl.northwestern.edu/netlogo/docs/dictionary.html#value-from
http://ccl.northwestern.edu/netlogo/docs/dictionary.html#values-from

which return values from an agent or an agentset.  One thing to keep in
mind though, is that the values from agentsets will be returned in random
order.  (since agentsets are in random order)  if you want them in a
particular order you are going to need to use sort and map. Something
like
this:

map [ color-of ? ] sort turtles

which will return a list of the values of colore for each turtle
in ascending who number order.

Of course if you want the mean or sum of numbers this won't matter.

does this make sense?

esther

#5238 From: Jim Lyons <teacherjim42@...>
Date: Tue Nov 7, 2006 12:15 am
Subject: Re: Colour chooser
jimlyons37
Send Email Send Email
 
On 11/3/06, /dev/random <max.diems@...> wrote:
  >
  > Is there a way to have colour choices in a chooser with colour names?
  > I'm currently using the colour numbers and a textbox to show what
they are.
  > If there isn't a way I'd like confirmation of that.

James Steiner replied:

> You can load a chooser with color names, in the form of strings. You
> have to treat them like strings, otherwise, they will be converted to
> numbers in the chooser (the color names are constants, rather than
> reporters, and they behave more like literal numbers).
>
> Then, there are two ways to proceed.
>
> One way, the most obvious but slowest, is to convert the strings back
> to numbers using run-result:
>
> ;; assume a chooser called "pick-color" containing:
> ;; "red" "orange" "brown" "yellow" "lime" "green" "sky" "blue"
> set color run-result pick-color

In this case, where all the choices are NetLogo color names, you can
also use read-from-string:

set color read-from-string pick-color

This should be faster than run-result, but I didn't check. :^)

Jim Lyons

#5239 From: "cajunmikeb" <bienvenu@...>
Date: Tue Nov 7, 2006 5:00 pm
Subject: Re: when a turtle gets to the right patch...
cajunmikeb
Send Email Send Email
 
Sweet!! Already implemented your suggestions and it works!! Thanks,
this allows me to get on with the real purpose of the model.

Are there additional training things on the web, or courses one can
attend?
thanks again, cheers
-Mike

--- In netlogo-users@yahoogroups.com, "cajunmikeb" <bienvenu@...> wrote:
>
> Hi,
>
> I'm having a procedure-scope problem, and need a pointer.
> Objective:  when a turtle reaches a certain type of patch (by color),
> the following things need to happen:
> the specific patch needs to do some stuff (like, generate a new turtle
> or something)
> and, the turtle that just got there needs to kick off (die).
>
> I am trying the following code (excerpts only):
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> to move-messages
>   ask turtles
>   [
>     if (direction? = 0) and (ycor < max-pycor)
>     [
>       set ycor (ycor + 1)
>     ]
>     ;; and other directions, edited out
>     ;;  set my-patch patch-here
>   ]
>   set rcvd-msgs turtles with [pcolor = green]
> end
> to generate-message [generator]
>
>   cct 1
>   [
>     set heading 0
>     set direction? random 3.5
>     ;;  show direction?
>     if direction? = 0
>     [
>       setxy (pxcor-of generator) ((pycor-of generator) + 1)
>     ]
>     ;; and other headings too, edited out
>     set speed msg-speed
>     set color red
>   ]
> end
> to go
>   move-messages
>   receive-messages
>   let generator one-of nodes
>   generate-message generator
> end
> ;;;;;;;;;;;;;;;;;;;
>
> the error message (in the procedures editor, not at runtime, says:
> You can't use GENERATE-MESSAGE in a turtle context, because
> GENERATE-MESSAGE is observer-only.
>
> I can't find any discussion of procedure scoping.  is there something
> posted somewhere?
>
> thanks much
> -Mike B
>

#5240 From: "freysein2005" <flo@...>
Date: Tue Nov 7, 2006 5:52 pm
Subject: Re: Ranking - Turtle Id
freysein2005
Send Email Send Email
 
Thank you James,

but I still got a problem. I calculate values like this:

my customers have a individual purchase list, with this list they
are purchasing in the stores. now every store should tell how many
items are available in the store. The store were the customer gets
the most should be ranked as best store.

My problem is that i get the numbers but in a list like this
[[6 4 6 3 4] [11 7 10 6 8] [12 8 10 7 9] [2 0 4 0 0]]
as follows
store 2 = [6 4 6 3 4]
store 0 = [11 7 10 6 8]
and so on...
customer 1 could buy 4 items in store 2 customer 1 could buy 6 items
in store 2 and so on

I think I got a fundamental problem here

My  Code looks like this:
to assign-mlist-p [customer-m-list]
       ask stores [

      set mstore-mnum lput get-available-musictitles get-musiclist-
probability customer-m-list store-xmin store-k 0 mstore-mnum
        ]
       end
to purchase-in-store

ask customers [
       assign-mlist-p mlist
]

;;get-available-musictitles [exspects a list of probabilities, Costs
per item (0 in this case) and reports the amount available]
;;get-musiclist-probability [exspects customer purchase (list), xmin
(value), k (value) and reports a list of probabilities)]

Thanks for helping me...


Florian

--- In netlogo-users@yahoogroups.com, "James Steiner"
<gregortroll@...> wrote:
>
> Hi, Florian!
>
> If the list contains the stores, then the solution is fairly easy:
>
> ;; stort the list of stores by "satisfaction"
> ask customers
> [ set store-list ;; the destination of the sorted result
>        sort-by ;; the sort-by primitive
>       [ satisfaction-of ?1 >= satisfaction-of ?2 ] ;; the sort
criteria
>       store-list ;; the list to sort
> ]
>
> ;; now the customers can still access the stores in the list:
> ask customers
> [ show (word "My favorite store is " (first store-list) ) ]
>
> Output Example:
> customer 1: My favorite store is store 15
> customer 2: My favorite store is store 21
>
> Hope that helps!
>
> ~~James
> http://www.turtlezero.com
> (JA-86)
>
>
> On 11/5/06, freysein2005 <flo@...> wrote:
> > Hello,
> >
> > ist there a way to sort/rank values of my turtles and give
another
> > breed the Id's and not the values of the turtle.
> >
> > Example:
> >  customers buy in different stores. after every purchase they
> > calculate their satisfaction factor of every store.
> > like this
> >
> > customer 1[
> >     store 1 = 5 points
> >     store 2 = 3 points
> >     store 3 = 8 points
> >     store 4 = 7 points
> > ]
> >
> > customer 2[
> >     store 1 = 3 points
> >     store 2 = 4 points
> >     store 3 = 6 points
> >     store 4 = 7 points
> > ]
> >
> > the sorted values for customer 1 look like this: 3 5 7 8
> > for customer 2 look like this 3 4 6 7
> >
> > know i want to know how to get a list or the values of the store
ids
> > like 2 1 4 3 for customer 1 and 1 2 3 4 for customer 2.
> > I need to know what customer 1's favorit store and what customer
2's
> > favorit store is.
> >
> > The answer is probabliy not so difficult but I am stuck again.
> > Please help me.
> >
> > Florian
>

#5241 From: "freysein2005" <flo@...>
Date: Tue Nov 7, 2006 6:25 pm
Subject: Turtle list
freysein2005
Send Email Send Email
 
how can I setup a list of all turtles (Turtle Id) of one breed????

Thanks

Florian

#5242 From: "James Steiner" <gregortroll@...>
Date: Tue Nov 7, 2006 6:24 pm
Subject: Re: Colour chooser
askturtlezero
Send Email Send Email
 
On 11/6/06, Jim Lyons <teacherjim42@...> wrote:
> In this case, where all the choices are NetLogo color names, you can
> also use read-from-string:
>
> set color read-from-string pick-color
>
> This should be faster than run-result, but I didn't check. :^)
>
> Jim Lyons

Wow. Good idea--I totally overlooked read-from-string!

Read-from-string for this is about 35 times faster than run-result--pretty good!
The list lookup method is about 10 times faster than read-from-string.

~~James
http://www.turtlezero.com
(JA-86)

On 11/6/06, Jim Lyons <teacherjim42@...> wrote:
> On 11/3/06, /dev/random <max.diems@...> wrote:
>  >
>  > Is there a way to have colour choices in a chooser with colour names?
>  > I'm currently using the colour numbers and a textbox to show what
> they are.
>  > If there isn't a way I'd like confirmation of that.
>
> James Steiner replied:
>
> > You can load a chooser with color names, in the form of strings. You
> > have to treat them like strings, otherwise, they will be converted to
> > numbers in the chooser (the color names are constants, rather than
> > reporters, and they behave more like literal numbers).
> >
> > Then, there are two ways to proceed.
> >
> > One way, the most obvious but slowest, is to convert the strings back
> > to numbers using run-result:
> >
> > ;; assume a chooser called "pick-color" containing:
> > ;; "red" "orange" "brown" "yellow" "lime" "green" "sky" "blue"
> > set color run-result pick-color
>
> In this case, where all the choices are NetLogo color names, you can
> also use read-from-string:
>
> set color read-from-string pick-color
>
> This should be faster than run-result, but I didn't check. :^)
>
> Jim Lyons

#5243 From: Esther Verreau <everreau@...>
Date: Tue Nov 7, 2006 4:58 pm
Subject: Re: Re: Patches Question
estherverreau
Send Email Send Email
 
Hi Mike -

On Mon, 6 Nov 2006, cajunmikeb wrote:

> This is great, a partial answer to my problem.  What I then need to
> know how to do is get those patches (where a turtle is about to die)
> to do something -- like change color, or generate a new turtle.  Any
> ideas?

sure.  just ask them to do something before you ask them to die, like
this:

ask turtles with [ pcolor = green ]
   [
     set pcolor blue     ;; change the color of the patch I am on
     ;; make a copy of myself and ask that turtle to set it's color to green
     hatch 1 [ set color green ]
     die
  ]

if you want to ask patches instead you could also do this

ask patches with [ pcolor = green and any? turtles-here ]
[
   set pcolor blue
   ask turtles-here
   [
    hatch 1 [ set color green ]
    die
   ]
]

I hope this helps

esther


> thanks
> -Mike
> --- In netlogo-users@yahoogroups.com, Andrei <andrei@...> wrote:
> >
> >
> > On Apr 2, 2005, at 8:33 AM, Tyler Helton wrote:
> >
> > > Is there a way to clear only the turtles that lie
> > > on a certain colored patch, but not those on different colored
> > > patches?
> >
> > Yes. For example:
> >
> >  ask turtles with [ pcolor = green ] [ die ]
> >
> > will remove all the turtles on green patches. (This takes advantage of
> > the fact that you can refer to patch variables in a turtle context;
> > what gets reported is the value of that variable for the patch that the
> > turtle is on.)
> >
> > --
> > Andrei Scheinkman
> > Center for Connected Learning and Computer-Based Modeling
> > Northwestern University, ccl.northwestern.edu/netlogo
> >
>
>
>
>
>

Messages 5214 - 5243 of 16780   Oldest  |  < Older  |  Newer >  |  Newest Start Topic
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help