Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-1297

multistep integrator start failure triggers NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.5
    • 3.6
    • None
    • None

    Description

      Multistep ODE integrators like Adams-Bashforth and Adams-Moulton require a starter procedure.
      If the starter integrator is not configured properly, it will not create the necessary number of initial points and the multistep integrator will not be initialized correctly. This results in NullPointErException when the scaling array is referenced later on.

      The following test case (with an intentionally wrong starter configuration) shows the problem.

      @Test
      public void testStartFailure() {
      
           TestProblem1 pb = new TestProblem1();
            double minStep = 0.0001 * (pb.getFinalTime() - pb.getInitialTime());
            double maxStep = pb.getFinalTime() - pb.getInitialTime();
            double scalAbsoluteTolerance = 1.0e-6;
            double scalRelativeTolerance = 1.0e-7;
      
            MultistepIntegrator integ =
                new AdamsBashforthIntegrator(4, minStep, maxStep,
                                                                  scalAbsoluteTolerance,
                                                                  scalRelativeTolerance);
            integ.setStarterIntegrator(new DormandPrince853Integrator(0.2 * (pb.getFinalTime() - pb.getInitialTime()),
                                                                      pb.getFinalTime() - pb.getInitialTime(),
                                                                      0.1, 0.1));
            TestProblemHandler handler = new TestProblemHandler(pb, integ);
            integ.addStepHandler(handler);
            integ.integrate(pb,
                                   pb.getInitialTime(), pb.getInitialState(),
                                   pb.getFinalTime(), new double[pb.getDimension()]);
      
          }
      

      Failure to start the integrator should be detected and an appropriate exception should be triggered.

      Attachments

        Activity

          People

            luc Luc Maisonobe
            luc Luc Maisonobe
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: