Student Group Connections
Model was written in NetLogo 6.0.3
•
Viewed 150 times
•
Downloaded 8 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
globals [ category-count student-to-watch successful-popular-students successful-unpopular-students popular-student-count unpopular-student-count ] breed [ students student ] breed [ clubs club ] undirected-link-breed [social-links social-link] extensions [Nw] students-own [ sociability percieved-skill highest-rank club-list class category skill popular? unpopular? ] clubs-own [ rank member-count open-spots max-members category ] to setup create-initial-students ask students [ create-network ] ;set popular? and unpopular? tags for students with most and least links respectively ;This is used later to track liklihood of success for different types of students ask one-of students with [class = 0 and count link-neighbors = max [count link-neighbors] of students with [class = 0]] [set popular? true] ask one-of students with [class = 0 and count link-neighbors = min [count link-neighbors] of students with [class = 0]] [set unpopular? true] set-clubs populate-clubs ask students [ generate-club-links ] move-turtles ask links [set hidden? true] plot-skill-vs-rank reset-ticks end to create-initial-students clear-all ;;Set global constants set category-count 5 set successful-popular-students 0 set successful-unpopular-students 0 set popular-student-count 0 set unpopular-student-count 0 ;Create 4 years of students with a attributes create-students student-count / 4 [ set class 0 ] create-students student-count / 4 [ set class 1 ] create-students student-count / 4 [ set class 2 ] create-students student-count / 4 [ set class 3 ] ask students [ set heading 0 set skill random-float 10 set category random category-count set highest-rank 0 set club-list [] set sociability random-float 1 ] end to create-network ; Trutle Procedure ask n-of random 5 other students with [class = [class] of myself] [ ;Create links with people in the same class create-social-link-with myself [hide-link] ] ask n-of ((random 2) + 1) other students with [class != [class] of myself] [ ;Create less links with people in other classes create-social-link-with myself [hide-link] ] end ;This function creates the clubs to set-clubs ;Observer Procedure ;create clubs for each category let club-count 30 let x 0 while [ x < category-count ] [ let y 0 while [y < club-count] [ create-clubs 1 [ ifelse random-float 1 < .10 [set rank 4] [set rank random 4] ; set rank of club (only 10 percent of clubs should be highest rank) set max-members ((random 20) + 5) ;Set club range 5 - 24 set open-spots max-members set member-count 0 set category x set color red set hidden? true ] set y y + 1 ] set x x + 1 ] end ;This function randomly assigns students to different clubs in their preferred category to populate-clubs ask clubs with [member-count < max-members] [ if any? students with [category = [category] of myself] [ let c max-members - member-count ask n-of c other students with [category = [category] of myself] [ ask myself [set member-count member-count + 1] if class != 3 [ ask myself [set open-spots open-spots - 1]] set club-list lput myself club-list if [rank] of myself > highest-rank [ set highest-rank [rank] of myself] ] ] ] end ;This function generates links with members in the same category and in the same club, based on percentages set in the interface to generate-club-links ;Turtle Procedure let cat category let student-list get-clubmates club-list let category-list other students with [category = cat and club-list != []] ask category-list [ if random-float 1 < propensity-to-befriend-groupmates [create-social-link-with myself] ;Generate links based on propensity-to-befriend-groupmates for those who share a club category ] foreach student-list [ [agentset] -> ask agentset [ if random-float 1 < propensity-to-befriend-clubmates [create-social-link-with myself] ;Generate links based on propensity-to-befriend-clubmates for those who are in the same club ] ] end ;for all clubs that have open spots (number of seniors that are about to graduate) pick new members to fill their spots ;Students apply to clubs that are in their category with a rank equal to or higher than their higest rank club ;Students with highest percieved skill make it to the club to select-new-students ;Observer Procedure ask clubs with [open-spots > 0] [ ;Students who know someone in the club can apply (do not need to be in the same category let recruited-students [link-neighbors] of students with [member? myself club-list] with [class != 3 and not member? myself club-list and length club-list < 6] ;Students will apply to clubs in their category if the club is greater than or equal to their higest-rank club ;6 clubs is the max amount of clubs someone can be in at once let applicants students with [category = [category] of myself and not member? myself club-list and highest-rank <= [rank] of myself and class != 3 and length club-list < 6] let possible-students turtle-set sentence recruited-students applicants if possible-students != NOBODY [ let top-applicants pick-top-applicants possible-students self open-spots ask top-applicants [ set club-list lput myself club-list ask myself [set open-spots open-spots - 1] if [rank] of myself > highest-rank [ set highest-rank [rank] of myself] ] ] ] end ;; returns a list of applicants sorted by a calculated "percieved skill" to-report pick-top-applicants [applicants cl number] ask applicants [ ifelse not third-party-selection-committee? [ let link-count count link-neighbors with [member? cl club-list] set percieved-skill link-count * link-count set percieved-skill percieved-skill + skill set percieved-skill percieved-skill + highest-rank set percieved-skill percieved-skill + length club-list set percieved-skill percieved-skill - (class * 3) ; if unpopular? = true [show self show percieved-skill] ] [ set percieved-skill skill ] ] ifelse number > count applicants [ report turtle-set sort-on [ (- percieved-skill)] applicants] [report turtle-set sublist sort-on [ (- percieved-skill)] applicants 0 number] end ;Moves turtles on the screen based on what clubs they are in and how many connections they have to move-turtles ask students [ setxy min-pxcor min-pycor foreach club-list [[cl] -> set heading 0 fd 1 * [rank] of cl ] set heading 90 fd count link-neighbors ] end ;Tick ;Represents a year to go remove-seniors add-year generate-freshman generate-new-social-links select-new-students ask students [ generate-club-links ] plot-skill-vs-rank move-turtles plot-popular-students ask links [set hidden? true] ; ask students with [unpopular? = true] [show club-list] tick end ;Remove Seniors from the pool of students to remove-seniors ask students with [class = 3] [ die ;The students graduate (but coming from an outgoing senior, whats the difference?) ] end ;Add a year to each student, update clubs that have outgoing seniors to add-year ask students[ set class class + 1 ] ;Clubs that have seniors now have open spots for an incoming class ask students with [class = 3] [ foreach club-list [[cl] -> ; show cl ask cl [ set open-spots open-spots + 1 ] ] ] end ;;Generate a new set of freshman to generate-freshman create-students student-count / 4 [ setxy min-pxcor min-pycor ; set label who set class 0 set heading 0 set skill random-float 10 set category random 5 set club-list [] set sociability random-float 1 ;Generate links to some other people in the class ask n-of random 5 other students with [class = 0] [ create-social-link-with myself ] ;Generate links with some people in other classes ask n-of ((random 2) + 1) other students with [class != 0] [ create-social-link-with myself ] ] ;Record a popular student and unpopular student for data purposes ask one-of students with [class = 0 and count link-neighbors = max [count link-neighbors] of students with [class = 0]] [set popular? true ] ask one-of students with [class = 0 and count link-neighbors = min [count link-neighbors] of students with [class = 0]] [set unpopular? true ] end ;;Generate some new friends and lose some new friends based sociability and propensity-to-lose-friends, respectively to generate-new-social-links ; Observer Procedure ask students [ ask n-of ((random 3) + 1) other students with [not member? myself link-neighbors] [ if random-float 1 < sociability [create-social-link-with myself] ] ask n-of random 3 links [ if random-float 1 < propensity-to-lose-friends [ask self [die]] ] ] end ;;This reports a list of students who are in clubs listed in the input to-report get-clubmates [arr] let final-list [] foreach arr [ [cl] -> set final-list sentence final-list other students with [ member? cl club-list] ] report final-list end ;Some students are assigned popular? and unpopular? attributes when they are first created based on how many (random) links they create ;When they are about to graduate the model records if they had success based on if they are in a high ranking club ;Students who are in a rank 4 club are considered successful to plot-popular-students if ticks > 6 [ ;It takes some time for the model to stabalize because initial clubs selections are randomly assigned ;This is done so the data isnt skewed ask students with [popular? = true and class = 3] [ ; show self if highest-rank = 4 [ set successful-popular-students successful-popular-students + 1 ] set popular-student-count popular-student-count + 1 ] ask students with [unpopular? = true and class = 3] [ ; show self if highest-rank = 4 [ set successful-unpopular-students successful-unpopular-students + 1 ] set unpopular-student-count unpopular-student-count + 1 ] ] end ;This function reports the global-clustering-coefficient to-report global-clustering-coefficient let closed-triplets sum [ nw:clustering-coefficient * count my-links * (count my-links - 1) ] of turtles let triplets sum [ count my-links * (count my-links - 1) ] of turtles report closed-triplets / triplets end ;This procedure generates the High Rank Student Skill Level plot ;and the Degree Vs. Highest rank plot to plot-skill-vs-rank set-current-plot "High Rank Student Skill Level" clear-plot set-current-plot-pen "test" ask students with [club-list != []] [ plotxy skill highest-rank ] set-current-plot "Degree Vs. Highest Rank" clear-plot set-current-plot-pen "test" ask students with [club-list != []] [ plotxy count link-neighbors highest-rank ] end
There is only one version of this model, created almost 6 years ago by Alex Cohen.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Student Group Connections.png | preview | Preview for 'Student Group Connections' | almost 6 years ago, by Alex Cohen | Download |
This model does not have any ancestors.
This model does not have any descendants.