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

Planning variables of primitive types (int, long, ...)'s initialized check must not do a null check (they will never be null) for CH, ES, etc.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Do
    • Icon: Minor Minor
    • 7.0.0.Final
    • 6.3.0.CR2
    • optaplanner-core
    • None
    • NEW
    • NEW

      Construction Heuristics only initialize a planning variable if it's null. Otherwise they leave it as is.
      This behavior is undesirable for primitive types, as they are never null, so CH's don't touch them by default (although that's overridable through the reinitializefilter in @PlanningVariable).

      If then later Local Search comes around and it finds it easier to leave those vars alone, them might fall out of the valid range, for example IntValueRange 2 to 30 and an int defaults to 0.

      Proposals:

      • Treat int 0 and long 0L as null, so threat them as uninitialized. That's not good for repeated planning if 0 is in the value range.
      • Treat any primitive type value as uninitialized. That's not good for repeated planning.
      • Fail fast or warn if primitive value types are used.
      • Info log a message for each variable already initialized at startup. Or for how many in total are already initialized

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

              Created:
              Updated:
              Resolved: