Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Automatic creation of variables based on matrix data

kestlerhawkkestlerhawk Member Posts: 2
Hello All,

i'm interested in ACE simulation and using java to do so.

based on the research i'm doing, i have to create 1000+ agents that are all similar in build with only their internal variable values different.

so this is easy enough until there are a few hundred variables to create, initialize, and cross check.

what i'm interested in doing is automating this process as follows:

instead of, for example, using the following code to create a bounded normal distribution across all the agents:

[color=Blue]final Normal visionNormal = RandomHelper.createNormal( AgentConstants.AGENT_VISION_MEAN, AgentConstants.AGENT_VISION_SD);

int vision = 0;
while (vision > 5.0 || vision < 0) {

vision = visionNormal.nextInt();



i would like to make an automatic function that would take this matrix entry:

i.e. matrix entry:

[ int (variable type) vision (variable name) normal (distribution type) 0 (min) 5 (max) etc... ]

would be used to create the above code parametrically.

the trick i'm facing is how to convert the string int and double values in the entry into code to produce the required variable in the class.

So how do i corollate matrix[0][0] as the variable type, matrix[0][1] into the variable name, etc... and then be able to access the variable as would be possible if i used the initial set of code i provided.

kind regards, and thank you for your support in advance.


Sign In or Register to comment.