⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aaa---retention.nlogo

📁 NETLOGO
💻 NLOGO
📖 第 1 页 / 共 3 页
字号:
breeds [ student ]globals [  yearly-budget                    ;the amount of money the university has for operating costs a year  years-in-operation               ;the number of years the college has been open  withdrawn-students               ;the total number of student that have withdrawn from the college  graduated                        ;number of students that have graduated   target-new-class-size            ;desired size for the new freshman class   admitted                         ;number of students admitted in an academic year  freshmen                         ;number of freshmen in university  sophmores                        ;number of sophmores in university  juniors                          ;number of juniors in university  seniors                          ;number of seniors in university  seniors-leaving                  ;number of seniors graduating at the end of the year  current-school-population        ;the current number of students at the university  spaces-available                 ;the number of spaces that are available for new students to be admitted  housing-left?                    ;value that shows if there is any housing left for students to apply for  beds-left                        ;number of rooms that are available for students to apply for  housing-taken                    ;number of rooms that are taken by students  high-aid                         ;amount of financial aid available to high income students  mid-aid                          ;amount of financial aid available to middle income students  low-aid                          ;amount of financial aid available to low income students  aid-left?                        ;is there financial aid left?  aid-taken                        ;how much financial aid has been used  work-study-taken                 ;how much work study has been taken  work-left?                       ;is there work study positions left?  quarter                          ;the current school quarter  end-of-year?                     ;is this the end of the school year?  first-year-open?                 ;is this the university's first year open?]student-own [  financial-background             ;financial background of a student and his/her family  family-support                   ;how much family support or encouragement do students have to pursue college  academic-preparedness            ;how prepared academically is the student for university level work        family-education                 ;education levels attained by the student's family  sex                              ;student's sex  housing?                         ;does the student have housing  satisfaction                     ;level of satisfaction the student has while attending the university  funded?                          ;does the student have financial aid  work-study?                      ;does the student have work study  class                            ;keeps track of the level in school the student has attained: fresh, soph, junior, senior  ]to create-college   ca  ask patches [ set pcolor green ]  set-default-shape student "circle"  set target-new-class-size (.50 * hs-grads)  set high-aid 6000.00 / 1000000.00  set mid-aid 7000.00 / 1000000.00   set low-aid 9000.00 / 1000000.00  set beds-left total-beds  set quarter 0  set housing-taken 0  set seniors-leaving 0  set current-school-population 0  set end-of-year? false  set first-year-open? true    ;setting up the view to show the college  ;    green patches: high school graduates (l) and college graduates(r)  ;    gradient of blue (l-r): freshman, sophmore, junior, senior  ask patches with [pxcor = ( - screen-edge-x) and pycor < 2] [set pcolor green]  ask patches with [pxcor = ( - screen-edge-x + 1) and pycor < 2] [set pcolor green]  ask patches with [pxcor = ( - screen-edge-x + 1) and pycor < 2] [set pcolor 108]  ask patches with [pxcor = ( - screen-edge-x + 2) and pycor < 2] [set pcolor 107]  ask patches with [pxcor = ( - screen-edge-x + 3) and pycor < 2] [set pcolor 106]  ask patches with [pxcor = ( - screen-edge-x + 4) and pycor < 2] [set pcolor 105]  ask patches with [pxcor = ( - screen-edge-x + 5) and pycor < 2] [set pcolor green]endto create-students  ; creates a population of potential university enrollees  create-custom-student hs-grads [    set family-support random-one-of [3 2 1]                        ; 3 = full, 2 = some, 1 = none    set financial-background random-one-of [3 2 1]                  ; 3 = high, 2 = mid, 1 = low    set family-education random-one-of [4 3 2 1]                    ; 4 = grad school 3 = undergrad, 2 = high school, 1 = none    set academic-preparedness random-one-of [3 2 1]                 ; 3 = high, 2 = mid, 1 = low    set housing? false                                              ; whether student has room and board    set funded? false                                               ; whether student has financial aid    set work-study? false                                           ; whether student has work study;    set satisfaction random-one-of [6 5 4 3 2 1 0 ]                ; level of satisfaction with their college experience    set class "none"                                                ; class    set size .035    set color random-one-of [black white red yellow brown]          ; racial categories    set sex random-one-of ["f" "m"]    setxy (- screen-edge-x)  random-float 3.0    fd random-float .4    set heading 90  ]  update-external-satisfaction                                      ; update satisfaction based on external influencesend; to start the model running - repeatedly admits, matriculates, ; graduates, and withdraws students from the universityto start-educating  ifelse current-school-population = 0                              ; get first round of students into college    [      admit-students       plot-diversity      get-resources      set quarter quarter + 1   ]   [     ifelse quarter > 4      [        update-internal-satisfaction       plot-satisfaction       matriculate        set seniors-leaving 0       set years-in-operation years-in-operation + 1       create-students       update-pop-globals       plot-diversity        set admitted 0        set aid-taken 0       set work-study-taken 0       admit-students        plot-diversity        get-resources       set quarter 1      ]       [         set quarter quarter + 1     ]         ]end; admit students to the universityto admit-students  ; qualified-students: number of high school grads that are academically qualified for admission  let qualified-students (count student with [class = "none" and academic-preparedness >= min-prepared-level])      ifelse qualified-students > target-new-class-size   [    if target-new-class-size > max-students - current-school-population [ set target-new-class-size (max-students - current-school-population) * .75]    ask random-n-of target-new-class-size student with [class = "none" and academic-preparedness >= min-prepared-level]    [      set class "freshman"      fd 1      set admitted admitted + 1      ]  ]  [    ask random-n-of qualified-students student with [class = "none" and academic-preparedness >= min-prepared-level]    [      set class "freshman"      fd 1      set admitted admitted + 1      ]  ]  ; non qualified students go away  ask student with [class = "none" ] [ die ]  ; update the current student population at the university  set current-school-population (count student )  plot-admitted  update-pop-globalsend; assign freshman housing.  the only time to get housing is freshman year.to get-housing  let housed-students count student with [housing?]                                    ;how many students have housing already  set housing-left? beds-left > 0                                                      ;if there are any beds left there is housing available  let looking-for-housing? any? student with [not housing? and class = "freshman"]     ;are there any freshman that haven't gotten housing yet?  while [housing-left? and looking-for-housing?]                                       ;if we have roomless freshman and beds left assign housing to random freshman  [      ask random-one-of student with [class = "freshman" and not housing?]      [           set housing? true           set housing-taken housing-taken + 1          set beds-left beds-left - 1      ]          ;; update housing variables before going back to while    set housing-left? beds-left > 0                                      set looking-for-housing? any? student with [not housing? and class = "freshman"]  ]end; give financial aid to studentsto get-aid  update-aid-values                                                        while [aid-left? and any? student with [not funded?]]                                 ; while there is aid available and students without any  [    ; if there is not enough aid left to give the smallest financial aid award    ; stop the awarding process    ifelse yearly-financial-aid-available - aid-taken < low-aid     [       stop    ]    [    ask random-one-of student with [not funded?] [ set funded? true ]  ]    update-aid-values  ]end; assign students work study --- similar to get-aidto get-workstudy  set work-study-taken (count student with [work-study? ]) * 3500.00  set work-left? work-study-taken < yearly-work-study-available  while [work-left? and any? student with [not work-study?]]  [      ifelse yearly-work-study-available - work-study-taken < 3500.00  [ stop ]      [        ask random-one-of student with [not work-study?]        [             set work-study? true         ]      ]  set work-study-taken (count student with [work-study? ]) * 3500.00  set work-left? work-study-taken < yearly-work-study-available  ]end; advance or withdraw students from the university based on their; level of satisfactionto matriculate  ask student with [satisfaction >= 5]   [    ifelse class = "senior"    [       set seniors-leaving seniors-leaving + 1       set graduated graduated + 1       ; move out of housing if you have it      if housing?       [         set housing? false         set housing-taken housing-taken - 1        set beds-left beds-left + 1        set housing-left? beds-left > 0                                                      ;if there are any beds left there is housing available      ]        die    ]    [      ; all other levels advance      ifelse class = "freshman"      [  set class "sophmore" set satisfaction satisfaction + 2 ]      [        ifelse class = "sophmore"        [            set class "junior"  set satisfaction satisfaction + 2         ]        [  set class "senior"  set satisfaction satisfaction + 2 ]          ]      fd 1    ]  ]  plot-withdrawals  set withdrawn-students (count student with [satisfaction < 5])                        ; update value of number of withdrawing students  ; if not satisfied, move out of housing if you have it and leave the university  ask student with [satisfaction < 5]   [     if housing? [      set housing? false       set housing-taken housing-taken - 1      set beds-left beds-left + 1      set housing-left? beds-left > 0                                                      ;if there are any beds left there is housing available    ]    die  ]  ; update school population  set current-school-population (count student)  plot-diversity   set housing-taken (count student with [housing?])  set beds-left (total-beds - housing-taken)end; updates the amount of each type of financial aid award that has been given out; then it updates the value to determine whether there is still aid availableto update-aid-values  let h-aid-used (count student with [funded? and financial-background = 3]) * high-aid  let m-aid-used (count student with [funded? and financial-background = 2]) * high-aid  let l-aid-used (count student with [funded? and financial-background = 1]) * high-aid  set aid-taken (h-aid-used + m-aid-used + l-aid-used)  set aid-left? aid-taken < yearly-financial-aid-availableend; looks at the external influences on each student such as family backround, financial support, and preparedness.; if the student is above average or average in each influence, they gain 2 or 1 point respectively.; if they are below average they lose a point.to update-external-satisfaction  ask student [    let plus-pts 0    let race color    ifelse family-support = 3 [ set plus-pts plus-pts + 2 ][  ifelse family-support = 2 [ set plus-pts plus-pts + 1 ][ set plus-pts plus-pts - 1 ]]    ifelse financial-background = 3 [ set plus-pts plus-pts + 2 ][  ifelse financial-background = 2 [ set plus-pts plus-pts + 1 ][ set plus-pts plus-pts - 1 ]]    ifelse family-education = 3 [ set plus-pts plus-pts + 2 ][  ifelse family-education = 2 [ set plus-pts plus-pts + 1 ][ set plus-pts plus-pts - 1 ]]    ifelse  academic-preparedness = 3 [ set plus-pts plus-pts + 2 ][  ifelse academic-preparedness = 2 [ set plus-pts plus-pts + 1 ][ set plus-pts plus-pts - 1 ]]    set satisfaction satisfaction + plus-pts  ]end; looks at the internal influences on each student such as access to funding, housing, and work study, as it relates to the; ability to have these factors balanced out by external influences.; if the student is above average or average in each influence, they gain 2 or 1 point respectively.; if they are below average they lose a point.  The overall student population similarity to the turtle is also; evaluated here, and if it is below 15%, the student will lose a point.  otherwise they gain pointsto update-internal-satisfaction  ask student [    let plus-pts 0    let race color    ifelse housing? [ set plus-pts plus-pts + 1 ][ if financial-background < 2 and not funded? and not work-study? [ set plus-pts plus-pts - 1] ]    ifelse funded? [ set plus-pts plus-pts + 1 ][ if financial-background < 2 and not housing? and not work-study? [ set plus-pts plus-pts - 1] ]     ifelse work-study? [set plus-pts plus-pts + 1][ if financial-background < 2 and not housing? and not funded? [ set plus-pts plus-pts - 1] ]     ifelse current-school-population / (count student with [color = race]) < 7  [ set plus-pts plus-pts + 2 ][  ifelse current-school-population / (count student with [color = race]) = 5 [ set plus-pts plus-pts + 1 ][ set plus-pts plus-pts - 1 ]]      set satisfaction satisfaction + plus-pts  ]end; calls all functions that allocate school resources to the studentsto get-resources   get-housing  get-aid  get-workstudyend; update the interface plotsto update-plots  plot-diversity  plot-withdrawals  plot-admitted  plot-satisfactionend; update the number of students in each classto update-pop-globals  set freshmen (count student with [class = "freshman"])  set sophmores (count student with [class = "sophmore"])  set juniors (count student with [class = "junior"])  set seniors (count student with [class = "senior"])end; plot the total number of students from each race in the universityto plot-diversity  set-current-plot "student population by race"  set-current-plot-pen "Black"  plot-pen-reset  plotxy 15 (count student with [color = black and class != "none"])  set-current-plot-pen "White"    plot-pen-reset  plotxy 30 (count student with [color = white and class != "none"])  set-current-plot-pen "Latino/Hispanic"    plot-pen-reset  plotxy 45 (count student with [color = brown and class != "none"])  set-current-plot-pen "Asian/Pacific Islander"    plot-pen-reset  plotxy 60 (count student with [color = yellow and class != "none"])  set-current-plot-pen "Native American"      plot-pen-reset  plotxy 75 (count student with [color = red and class != "none"])end; plot the number of students withdrawing per year from each raceto plot-withdrawals  set-current-plot "withdrawing per year"  set-current-plot-pen "Black"  plot (count student with [color = black and satisfaction < 3])  set-current-plot-pen "White"  plot (count student with [color = white and satisfaction < 3])  set-current-plot-pen "Latino/Hispanic"  plot (count student with [color = brown and satisfaction < 3])  set-current-plot-pen "Asian/Pacific Islander"  plot (count student with [color = yellow and satisfaction < 3])  set-current-plot-pen "Native American"    plot (count student with [color = red and satisfaction < 3])end; plot the number of students admitted per year from each raceto plot-admitted  set-current-plot "Admitted Per Year"  set-current-plot-pen "Black"  plot (count student with [color = black and class = "freshman"])  set-current-plot-pen "White"  plot (count student with [color = white and class = "freshman"])  set-current-plot-pen "Latino/Hispanic"  plot (count student with [color = brown and class = "freshman"])  set-current-plot-pen "Asian/Pacific Islander"  plot (count student with [color = yellow and class = "freshman"])  set-current-plot-pen "Native American"    plot (count student with [color = red and class = "freshman"])end; plot the average satisfaction level per year for students from each raceto plot-satisfaction  set-current-plot "Average Satisfaction per year"  set-current-plot-pen "Black"  plot mean values-from student with [color = black] [satisfaction] ;(count student with [color = black and class = "freshman"])  set-current-plot-pen "White"  plot mean values-from student with [color = white] [satisfaction] ;(count student with [color = white and class = "freshman"])  set-current-plot-pen "Latino/Hispanic"  plot mean values-from student with [color = brown] [satisfaction] ;(count student with [color = brown and class = "freshman"])  set-current-plot-pen "Asian/Pacific Islander"  plot mean values-from student with [color = yellow] [satisfaction] ;(count student with [color = yellow and class = "freshman"])  set-current-plot-pen "Native American"    plot mean values-from student with [color = red] [satisfaction] ;(count student with [color = red and class = "freshman"])end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -