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

Nearby selector drops the first entity/value instead of the origin entity

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 7.0.0.Final, 7.38.0.Final
    • Fix Version/s: None
    • Component/s: optaplanner-core
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      1. Apply first.diff to 7.38.0.Final
      2. Run the vehicle routing example with any problem (I recommend cvrp-32customers.xml as it uses all vehicles normally)
      => the first vehicle is not assigned

      1. Apply second.diff to 7.38.0.Final
      2.. Run the vehicle routing example on cvrp-reproducer.xml
      => The problem remains uninitialized as the only vehicle had been filtered out

      Show
      1. Apply first.diff to 7.38.0.Final 2. Run the vehicle routing example with any problem (I recommend cvrp-32customers.xml as it uses all vehicles normally) => the first vehicle is not assigned 1. Apply second.diff to 7.38.0.Final 2.. Run the vehicle routing example on cvrp-reproducer.xml => The problem remains uninitialized as the only vehicle had been filtered out
    • Docs QE Status:
      NEW
    • QE Status:
      NEW

      Description

      The NearbyEntityValueSelector drops the first (nearest) value if the value class.isAssignableFrom(entity class) is true. I guess the purpose of this behavior is to remove the origin entity itself from the values.
      The problem is if a NearbyDistanceMeter returns 0 for values other than the origin entity, the order of the values depends on the order of valueRangeProviderRefs, and the first value is not guaranteed to be the origin entity. This could result some values may remain unused, for example when every move is nearby selected.
      I attached two reproducers for the vehicle routing example. Both has a CH with nearby selection, the first is an example problem with a customer and a vehicle at the same location, the second is a slightly modified distance meter which ruins any problem.
      The easiest workaround is to change the order of the valueRangeProviderRefs on previousStandstill.

        Gliffy Diagrams

          Attachments

          1. first.diff
            3 kB
          2. second.diff
            3 kB

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                firesharker Balint Fabry
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: