Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***
- * Name: stressmap
- * Author: Florentino, Matheus Diniz Alencar, Victor Alexandre, Vinicius Borges Alencar
- * Description: Projeto de Mapa de Stress para disciplina de Sistemas Multiagentes, INF, UFG - 2019/1
- * Tags: stress, map, class, classroom, teacher, students
- ***/
- model stressmap
- /* Definição de modelo para o projeto */
- global {
- int grid_height <- 10;
- int grid_width <- 9;
- int nb_students <- 40;
- float holding_exams_proba <- 0.25;
- bool holding_exams <- false;
- // stressors factors
- float exams_stress <- 0.49;
- float career_stress <- 0.1283;
- float family_stress <- 0.0954;
- float economic_stress <- 0.1186;
- float homework_stress <- 0.0329;
- float teacher_stress <- 0.0296;
- float relationships_stress <- 0.0493;
- float is_holding_conversation <- 0.1;
- init {
- loop i from: 0 to: grid_height - 1 {
- loop j from: 0 to: grid_width - 1 {
- if(i > 1 and (j mod 2 = 0)) {
- seats grid_seat <- seats grid_at {j, i};
- create student with:(location: grid_seat.location);
- } else if(i = 0 and j = 4) {
- seats grid_seat <- seats grid_at {j, i};
- create teacher with:(location: grid_seat.location);
- }
- }
- }
- }
- }
- grid seats width: grid_width height: grid_height {
- }
- species student {
- float stress <- 0.0;
- float tend_to_stress <- rnd(1.0); // probabilidade de estressar, tipo um peso pra saber o quanto um fator é efetivo
- float stressor <- rnd(1.0); // como melhorar o calculo de stressor?
- rgb relaxed <- #green;
- rgb minor_stress <- #orange;
- rgb mild_stress <- #red;
- aspect base {
- // muda a cor dependendo do nível de stress
- draw circle(3.0) color: stress <= 2.0 and stress >= 1 ? minor_stress : (stress < 1.0 ? relaxed : mild_stress);
- // draw "S" at: location + {-1.5, 1.5, 0} color: #black font: font("SansSerif",28,#italic) perspective: false ;
- draw string(stress) color: #black;
- }
- // conversa entre indivíduos
- reflex hold_conversation when: flip(is_holding_conversation) {
- student partner <- one_of(student);
- if(flip(partner.stressor)) {
- stress <- stress * (1 + partner.stressor);
- }
- }
- reflex during_exams when: flip(exams_stress) {// usar a mesma probabilidade ou criar uma outra situação?
- stress <- stress + (exams_stress * tend_to_stress);
- }
- reflex under_career_stress when: flip(career_stress) {// usar a mesma probabilidade ou criar uma outra situação?
- stress <- stress + (career_stress * tend_to_stress);
- }
- reflex under_family_stress when: flip(family_stress) {// usar a mesma probabilidade ou criar uma outra situação?
- stress <- stress + (family_stress * tend_to_stress);
- }
- reflex under_homework_stress when: flip(homework_stress) {// usar a mesma probabilidade ou criar uma outra situação?
- stress <- stress + (homework_stress * tend_to_stress);
- }
- reflex under_teacher_stress when: flip(teacher_stress) {// usar a mesma probabilidade ou criar uma outra situação?
- stress <- stress + (teacher_stress * tend_to_stress);
- }
- reflex under_relationships_stress when: flip(relationships_stress) {// usar a mesma probabilidade ou criar uma outra situação?
- stress <- stress + (relationships_stress * tend_to_stress);
- }
- reflex under_economic_stress when: flip(economic_stress) {// usar a mesma probabilidade ou criar uma outra situação?
- stress <- stress + (economic_stress * tend_to_stress);
- }
- // para balancear e diminuir o stress
- reflex relax when: flip(1 - tend_to_stress) {
- stress <- stress - (tend_to_stress * 0.5);
- }
- }
- species teacher {
- aspect base {
- draw triangle(6.0) color: #red ;
- draw "T" at: location + {-1.5, 1.5, 0} color: #black font: font("SansSerif",28,#italic) perspective: false ;
- }
- }
- experiment lesson type: gui {
- output {
- display classroom {
- grid seats lines: #black;
- species student aspect: base;
- species teacher aspect: base;
- }
- monitor "Overall stress" value: student sum_of(each.stress);
- monitor "Tend_to_stress" value: one_of(student).tend_to_stress;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement