Search code examples
anylogic

How to add value to a variable of type Other>double[] in anylogic?


I am trying to calculate the 90th percentile value of a data. In order to so, I have created a variable of type Other> double[].

And I am trying to populate the list using variable.add(time()-agent.downEndTime); But this is not working. The error returned is enter image description here

Once I am able to do so, I plan to sort the list in ascending order, and calculate the 90th percentile value based on the size of the list.

enter image description here


Solution

  • You should use an arraylist instead of an array... use a collections object from the agent palette of type ArrayList with element type double.

    Then you can do the downwardtime.add();

    then to sort, depending on whether you want ascending or descending:

    Collections.sort(downwardtime);
    

    or

    Collections.sort(downwardtime, Collections.reverseOrder());