I'm new to AnyLogic and I am trying to create a custom network...but i don't get to succeed in this task :(
Agents have a parameter "AgeClass", that is an int from 0 to 14, according to their age.
Then I have a variable "network" that contains the mean number of links between age class.
What I want is every agent to create link with other agent according to the matrix.
I don't get how I can say to an agent "connect to another agent with AgeClass = 3"
I thought something like this (to put in the "on startup block" or in an event inside the agent type):
int i = AgeClass \\ this is the AgeClass of the agent who is executing the code
for( int j=0; j<network[i].length; j++ ) { \\ in this way I go through all the age classes
for ( int k=0; k<poisson(network[i] [j]); k++) { \\ for every j I get the mean # of link
connectTo(????);
}
}
Instead of ???? i want to say "connect to another agent with AgeClass = j" ...is there a way thorugh?
Thanks for the support!!!