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

Planner: Divide by zero exception on timeMillisSpend on a fast computer

    XMLWordPrintable

Details

    Description

      In org.drools.planner.core.localsearch.DefaultLocalSearchSolver::solvingEnded, there is potentially a divide by zero that occurs on the line:

      long averageCalculateCountPerSecond = localSearchSolverScope.getCalculateCount() * 1000L / timeMillisSpend;

      if timeMillisSpend is zero. Although in theory the likelihood of this occurring in practically nothing, we have actually seen it occur on a POC project with long running Planner jobs. An appropriate guard should be added to this calculation to ensure that this error cannot occur.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: