Uploaded image for project: 'OptaPlanner'
  1. OptaPlanner
  2. PLANNER-295

Nearby selection with linear or parabolic distribution 100 but only 5 entities should not have a very low probability for the last entity

XMLWordPrintable

      Currently the pseudo code works like this:

      int sizeMaximum = 100;
      int n = 5;
      int m = sizeMaximum <= n ? sizeMaximum : n; // So m = 5
      double p = random.nextDouble();
      int next = (int)(m * (1.0 - Math.sqrt(1.0 - p)));
      

      This means that the probably of next being 4 (the highest possible number) is far less than if n would be 10, which is again far less than if n would be 50.

      This, in turn, implies that the probability of next begin 0 (the lowest possible number) is a lot higher than if n would be 10, etc.

        1. PLANNER-295.png
          14 kB
          Geoffrey De Smet

              rsynek@redhat.com Radovan Synek (Inactive)
              gdesmet@redhat.com Geoffrey De Smet (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: