Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.99 KB | None | 0 0
  1. /***
  2. * Name: stressmap
  3. * Author: Florentino, Matheus Diniz Alencar, Victor Alexandre, Vinicius Borges Alencar
  4. * Description: Projeto de Mapa de Stress para disciplina de Sistemas Multiagentes, INF, UFG - 2019/1
  5. * Tags: stress, map, class, classroom, teacher, students
  6. ***/
  7.  
  8. model stressmap
  9.  
  10. /* Definição de modelo para o projeto */
  11. global {
  12. int grid_height <- 10;
  13. int grid_width <- 9;
  14. int nb_students <- 40;
  15.  
  16. float holding_exams_proba <- 0.25;
  17. bool holding_exams <- false;
  18.  
  19. // stressors factors
  20. float exams_stress <- 0.49;
  21. float career_stress <- 0.1283;
  22. float family_stress <- 0.0954;
  23. float economic_stress <- 0.1186;
  24. float homework_stress <- 0.0329;
  25. float teacher_stress <- 0.0296;
  26. float relationships_stress <- 0.0493;
  27.  
  28. float is_holding_conversation <- 0.1;
  29.  
  30. init {
  31. loop i from: 0 to: grid_height - 1 {
  32. loop j from: 0 to: grid_width - 1 {
  33. if(i > 1 and (j mod 2 = 0)) {
  34. seats grid_seat <- seats grid_at {j, i};
  35. create student with:(location: grid_seat.location);
  36. } else if(i = 0 and j = 4) {
  37. seats grid_seat <- seats grid_at {j, i};
  38. create teacher with:(location: grid_seat.location);
  39. }
  40. }
  41. }
  42. }
  43. }
  44.  
  45. grid seats width: grid_width height: grid_height {
  46.  
  47. }
  48.  
  49. species student {
  50. float stress <- 0.0;
  51. float tend_to_stress <- rnd(1.0); // probabilidade de estressar, tipo um peso pra saber o quanto um fator é efetivo
  52. float stressor <- rnd(1.0); // como melhorar o calculo de stressor?
  53.  
  54. rgb relaxed <- #green;
  55. rgb minor_stress <- #orange;
  56. rgb mild_stress <- #red;
  57.  
  58. aspect base {
  59. // muda a cor dependendo do nível de stress
  60. draw circle(3.0) color: stress <= 2.0 and stress >= 1 ? minor_stress : (stress < 1.0 ? relaxed : mild_stress);
  61. // draw "S" at: location + {-1.5, 1.5, 0} color: #black font: font("SansSerif",28,#italic) perspective: false ;
  62. draw string(stress) color: #black;
  63. }
  64.  
  65. // conversa entre indivíduos
  66. reflex hold_conversation when: flip(is_holding_conversation) {
  67. student partner <- one_of(student);
  68. if(flip(partner.stressor)) {
  69. stress <- stress * (1 + partner.stressor);
  70. }
  71. }
  72.  
  73. reflex during_exams when: flip(exams_stress) {// usar a mesma probabilidade ou criar uma outra situação?
  74. stress <- stress + (exams_stress * tend_to_stress);
  75. }
  76.  
  77. reflex under_career_stress when: flip(career_stress) {// usar a mesma probabilidade ou criar uma outra situação?
  78. stress <- stress + (career_stress * tend_to_stress);
  79. }
  80.  
  81. reflex under_family_stress when: flip(family_stress) {// usar a mesma probabilidade ou criar uma outra situação?
  82. stress <- stress + (family_stress * tend_to_stress);
  83. }
  84.  
  85. reflex under_homework_stress when: flip(homework_stress) {// usar a mesma probabilidade ou criar uma outra situação?
  86. stress <- stress + (homework_stress * tend_to_stress);
  87. }
  88.  
  89. reflex under_teacher_stress when: flip(teacher_stress) {// usar a mesma probabilidade ou criar uma outra situação?
  90. stress <- stress + (teacher_stress * tend_to_stress);
  91. }
  92.  
  93. reflex under_relationships_stress when: flip(relationships_stress) {// usar a mesma probabilidade ou criar uma outra situação?
  94. stress <- stress + (relationships_stress * tend_to_stress);
  95. }
  96.  
  97. reflex under_economic_stress when: flip(economic_stress) {// usar a mesma probabilidade ou criar uma outra situação?
  98. stress <- stress + (economic_stress * tend_to_stress);
  99. }
  100.  
  101. // para balancear e diminuir o stress
  102. reflex relax when: flip(1 - tend_to_stress) {
  103. stress <- stress - (tend_to_stress * 0.5);
  104. }
  105.  
  106. }
  107.  
  108. species teacher {
  109. aspect base {
  110. draw triangle(6.0) color: #red ;
  111. draw "T" at: location + {-1.5, 1.5, 0} color: #black font: font("SansSerif",28,#italic) perspective: false ;
  112. }
  113. }
  114.  
  115. experiment lesson type: gui {
  116.  
  117. output {
  118. display classroom {
  119. grid seats lines: #black;
  120. species student aspect: base;
  121. species teacher aspect: base;
  122. }
  123.  
  124. monitor "Overall stress" value: student sum_of(each.stress);
  125. monitor "Tend_to_stress" value: one_of(student).tend_to_stress;
  126. }
  127.  
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement