Search code examples
anylogic

CustomDistribution cannot be resolved to a type


I am studying the Distribution Center Model Cloud in Anylogic. But the first problem I am encountering is,

  1. Description: CustomDistribution cannot be resolved to a type. Location: Distribution Center/Main/discrete - Function The CustomDistribtuion is used in a function

    int[] vals = new int[palletTypesNum+1]; for (int i = 0; i <= palletTypesNum; i++) vals[i] = i;

    CustomDistribution distribution = new CustomDistribution(vals, weights, new java.util.Random());

    return (int)distribution.get(); enter image description here

What I have Tried???

  1. I have tried using enter image description here
  2. I have also tried to import the following,import com.anylogic.engine.markup.CustomDistribution;in the import section

Solution

  • Well, you need to use the constructors that code-complete shows you, either continuous, discrete or "options".

    To learn how to use the constructors specifically, check the help: https://anylogic.help/advanced/functions/custom-distribution.html#creating-a-custom-distribution-programmatically