--
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platfor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gama-platform/7b6e0dd1-9a38-4784-921a-213bc616a677%40googlegroups.com.
Hi,Let consider you have a species :species people {int my_attr;}If you have now the grid species plot, you can use the sum_of operator to compute the sum of an attribute value over a list / species of agents:grid plot {reflex computation {int value -> (people inside self) sum_of (each.my_attr);}}CheersBenoit
Le mer. 11 déc. 2019 à 13:24, J Smart <JayeNe...@gmail.com> a écrit :
Hi,--Lets say that I have a species that have a random value attribute. These species are located on a grid, and there can be multiple agents from species on a single cell of the grid.I want each grid cell to calculate the sum of the species attribute.How do I do this? Is it something to do with loops or iterations?I found how to make a list of the species inside the grid celllist<species> species_inside -> {species inside self};but I'm not sure how to calculate the sum of the attribute of the species within the grid cell.Thanks so much for your help,J
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-p...@googlegroups.com.
Hi,Let consider you have a species :species people {int my_attr;}If you have now the grid species plot, you can use the sum_of operator to compute the sum of an attribute value over a list / species of agents:grid plot {reflex computation {int value -> (people inside self) sum_of (each.my_attr);}}CheersBenoit
Le mer. 11 déc. 2019 à 13:24, J Smart <JayeNe...@gmail.com> a écrit :
Hi,--Lets say that I have a species that have a random value attribute. These species are located on a grid, and there can be multiple agents from species on a single cell of the grid.I want each grid cell to calculate the sum of the species attribute.How do I do this? Is it something to do with loops or iterations?I found how to make a list of the species inside the grid celllist<species> species_inside -> {species inside self};but I'm not sure how to calculate the sum of the attribute of the species within the grid cell.Thanks so much for your help,J
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-p...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platfor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gama-platform/8a964f17-fbac-4c1d-aa1f-132cd22357ba%40googlegroups.com.
grid plot width: 6 height: 6 {
int value;
reflex computation {
int value <- (people inside self) sum_of (each.my_attr);
}
}
This declaration of value shadows the declaration of an attribute of plot
grid plot width: 6 height: 6 {
int value;
reflex computation {
value <- (people inside self) sum_of (each.my_attr);
}
}
To view this discussion on the web visit https://groups.google.com/d/msgid/gama-platform/CAGjKVYoTiMF%3DH5oyt%2BDFoLcX0FiCj91jcPwp7y2znnS17anw%2BQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gama-platform/CAD4GtYGTWD4Xvv0u07dK%2BBgQLiRcC0_B%2BsovVGO_PKg7gh%3DcHg%40mail.gmail.com.