0

For defining the behaviour of my agents, I created a state chart in which when a user likes a comment, the variable "likes" is changed as follows :

Likes=Likes+1;

It should show me at the end the sum of likes. In order to depict this sum , as it is not a statistics, I cannot use a bar chart or anything for it. What if I define this in statistics:

Name : Totalallikes 
Type:Sum
expressions: item.Likes

Does it make sense? Or I am summing the likes twice this way?
Thank you

user7335938
  • 33
  • 1
  • 4
  • sounds like your "likes" variable is summing likes for individual agents while your statistic is summing likes across all agents, right? Not sure what the problem is, can you explain better and add screenshots? – Benjamin Jan 09 '17 at 12:20
  • To analyze how popular a product is,determined some posts about two features , and the number of likes is important.Each time a post is liked the variable totalLikeA or totalLikeB is added by 1. On day one for feature A, it is zero, changes to 1, next day 2, and finally changes to 100. The same thing happens for product B. 0, 1,2,...80.Now the totallikesA should be 50 and the total likes of B should be 80.To depict them, I created statistics of type sum.The question is that "item.totallikesA" would show 50 or 5050 (1+2+3...+100). I think it would show the second number as it is summing twice! – user7335938 Jan 12 '17 at 17:05
  • sorry mate, this is still quiet unclear. I suggest you edit your initial questions, add screenshots and a concise description of your model structure and statistics. As I said before: your statistics sum across your entire agent population constantly, while your variable MyAgent.totalLikesA (and ...B) are increased for each individual agent whenever the adding-code is called. – Benjamin Jan 12 '17 at 18:37

1 Answers1

0

I believe your variable should already contain the sum, there's no need to create a Statistic or sum them up any more or else as you say, you would be summing them up twice.

Flexecute
  • 106
  • 1
  • 6