netlogo

assign values to turtles by searching through CSV header row in Netlogo

人盡茶涼 提交于 2019-12-24 07:13:42
问题 I have 3 producers. Each has 200 consumers as turtles who have purchased laptops. All producers sell laptops. The laptops have 3 kinds of features : size of the screen, price, battery life. Each has some levels. For example battery life has 5 hours, 12 hours, 24 hours, 30 hours. Each producer has some information about how consumers have rated these items based on what they have experienced that is stored in a csv file. So the CSV file header is something like this : Consumer 12 13 13.5 14 14

Netlogo: create small-world network while running

﹥>﹥吖頭↗ 提交于 2019-12-24 07:05:36
问题 I'm trying to generate a small-world type of network (https://en.wikipedia.org/wiki/Small-world_network) in my Netlogo model which is created throughout the model itself; people get to know one another while the model is running. I know how to generate a small world model in Netlogo in the setup . But how do you generate a small world network on the go ? My code for generating a small world during the setup is as follows. breed [interlinks interlink] ;links between different breeds breed

How to make a random binary list of lenght 67

南笙酒味 提交于 2019-12-24 06:58:19
问题 This is my first post here (as is my first work with netlogo) so I'll try to be concise: I'm trying to write a list for my turtles like Epstein and Axtell did in GAS (p. 73). Until now I tried this with no results. to setup-culture-tags ;set variable let initial-culture-tags n-values 67 [ random 2 ] ;create a random binary list of 67 set culture-tags initial-culture-tags ; end After making the list I would like to classify these based on the number of 0s. For example "00011" would be "blue"

Can I use multiple reset-timer function in one procedure in NetLogo?

不羁岁月 提交于 2019-12-24 06:33:52
问题 I am trying to build 4 classrooms in Netlogo and students will be entering the 4 classrooms one by one according to their random entry-time. So in my go procedure, I will have to use multiple (2 times) reset-timer for the students to enter the 4 classrooms one by one. But the students of one classroom are all entering in 0 minutes. Why is this happening? to go reset-timer tick create-students-classroom move-students reset-timer move-studentsB reset-timer move-studentsC reset-timer move

Using Vectors in NetLogo

非 Y 不嫁゛ 提交于 2019-12-24 05:26:11
问题 How can you define add or subtract vectors in NetLogo. It doesn't seem to have any datatype pertaining to it. By vectors I here am talking in terms specifically velocity of a turtle. Are there any extensions in netlogo that support this, I can't find any. 回答1: I don't know of an extension that provides vectors. But the math involved to code it in NetLogo itself is generally not that complicated. So for example suppose you choose to represent a two-dimensional vector as a list of two numbers.

NetLogo wall collision - 'bounce' function

筅森魡賤 提交于 2019-12-24 05:15:10
问题 The NetLogo turtles keep going through the walls of the maze. How do I stop them from going through the walls and instead have them change direction? I'm grateful for any help. My code so far : breed [ defaults default ] defaults-own [ new-heading ] breed [squares1 square] breed [squares2 square] breed [squares3 square] globals [ score ] to setup-row [row colour segments] foreach segments [ if pycor = row * row-patches-width and (pxcor >= col-patches-width * (item 0 ?)) and (pxcor <= col

NetLogo GIS extension : how to have right xcor and ycor from turtles

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 04:52:13
问题 strange, a question which I thought I had responded and actually no! All my GIS datas are well load in netlogo ! The layers are well aligned but xcor and ycor of agents are false false in light of the real world coordinates (e.i. img). During sensibility analyse I whant than agents write their coordinated in a text file because I doesn't whant to deal with hundreds of shapefiles, so need to have the true GIS xcor and ycor in my agents. My code : set buildings gis:load-dataset "../data_gis

NetLogo read in file as list of characters

泪湿孤枕 提交于 2019-12-24 03:56:06
问题 I am new to NetLogo. I have a text file that has one row of values: ABC CDC BBC I am trying to read in the first line of that file as a list of characters (e.g. [A B C]), I have been trying to use file-read-line, but it creates a string "ABC" instead. observer> file-open "test.txt" observer> show file-read-line observer: "ABC" 回答1: You will need to convert each line from a string to a list. NetLogo has no primitive to do that directly, but it's relatively simple to write a reporter that does

NetLogo - applying values to patches within polygons

本小妞迷上赌 提交于 2019-12-24 03:32:53
问题 I have animals walk around and a line then connects all the locations that they walked to. The line forms a closed polygon. I also used the graphics extension to fill the polygon for visual purposes. But I don't know how to have all of the patches that fall within the polygon become the territory of the owner (i.e., the animal that formed the polygon). It is possible for patches to be owned by multiple animals. The code below illustrates overlapping polygons. I'd really appreciate any help on

How to remove several items from a unsorted list in Netlogo

a 夏天 提交于 2019-12-24 01:16:44
问题 so i'm a bit struggling with Lists in Netlogo, so basically i've two lists and i want to remove the items that are in List 1 from List 2, for example: List 1 : [8 6 9 7 1 3] List 2: [5 9 8] Resulting List : [6 7 1 3] I've tried the following code but it returns an empty list: if List 2 != [] [ foreach List 2 [ let p position ? List 1 if p = true [ set List 1 remove-item p List 1 ] ] ] Any ideas ? 回答1: A combination of member? and filter will get you there: let list1 [8 6 9 7 1 3] let list2 [5