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

Performance bottleneck: do not default EntitySelectors to cacheType STEP if the entity count is stable

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Critical Critical
    • 6.1.0.Beta1
    • 5.5.0.Final, 6.0.1.Final
    • optaplanner-core
    • None

      For most use cases (including all examples in 6.0) the number of entities is stable during planning. For those use cases, the entity selectors should not default to cacheType STEP, but PHASE instead.

      For cases with a large dataset (at least 10k entities), for fast-stepping algorithms (LA, SA), this can heavily affect the average calculate count per second.

      benchmark machineReassignment stepLimit
      dataset: model_b_8.txt (50K entities)
      logLevel: info
      
      
      LA maximumStepCount 100000: old way (STEP cache)
      2014-02-12 11:56:21,169 [pool-2-thread-1] INFO  Solving ended: time spend (242314), best score (0hard/-12997504249soft), average calculate count per second (2845).
      
      LA maximumStepCount 100000: with PHASE cache
      2014-02-12 11:51:41,911 [pool-2-thread-1] INFO  Solving ended: time spend (33062), best score (0hard/-12997504249soft), average calculate count per second (20855).
      => 633% faster!!!
      
      
      TS maximumStepCount 10000: old way (STEP cache)
      2014-02-12 13:23:28,226 [pool-2-thread-1] INFO  Solving ended: time spend (361940), best score (0hard/-1214638137soft), average calculate count per second (55271).
      
      TS maximumStepCount 10000: with PHASE cache
      2014-02-12 13:29:50,181 [pool-2-thread-1] INFO  Solving ended: time spend (334319), best score (0hard/-1214638137soft), average calculate count per second (59837).
      => 8% faster
      

      The workaround is simple, just force cacheType PHASE manually:

        <localSearch>
          <unionMoveSelector>
            <changeMoveSelector>
              <entitySelector>
                <cacheType>PHASE</cacheType>
              </entitySelector>
            </changeMoveSelector>
            <swapMoveSelector>
              <entitySelector>
                <cacheType>PHASE</cacheType>
              </entitySelector>
            </swapMoveSelector>
          </unionMoveSelector>
         ...
        </localSearch>
      

              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: