Bug 346732 - FiniteDifference splits time steps when values go negative
Summary: FiniteDifference splits time steps when values go negative
Status: RESOLVED FIXED
Alias: None
Product: STEM
Classification: Technology
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P1 major (vote)
Target Milestone: 1.1.2   Edit
Assignee: Christian Thoens CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-20 12:29 EDT by Christian Thoens CLA
Modified: 2012-01-23 14:48 EST (History)
2 users (show)

See Also:


Attachments
Patch for the time step splitting (28.70 KB, patch)
2011-05-20 12:29 EDT, Christian Thoens CLA
sedlund: iplog+
Details | Diff
Bug fixed from previous patch (32.43 KB, patch)
2011-05-20 15:36 EDT, Christian Thoens CLA
sedlund: iplog+
Details | Diff
Bugs in previous patch fixed (31.30 KB, patch)
2011-05-20 18:07 EDT, Christian Thoens CLA
sedlund: iplog+
Details | Diff
Avoid stack when because of recursion (814.58 KB, patch)
2011-05-25 13:01 EDT, Christian Thoens CLA
sedlund: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Thoens CLA 2011-05-20 12:29:39 EDT
Created attachment 196234 [details]
Patch for the time step splitting

If a value is negative after performing a time step, a smaller time step is performed. Afterwards an additional step for the remaining time is done. If a value is negative again, the this time step is split again and so on.
Comment 1 Christian Thoens CLA 2011-05-20 15:36:00 EDT
Created attachment 196250 [details]
Bug fixed from previous patch
Comment 2 Christian Thoens CLA 2011-05-20 18:07:35 EDT
Created attachment 196256 [details]
Bugs in previous patch fixed
Comment 3 Stefan Edlund CLA 2011-05-24 18:00:14 EDT
Assign to Chris
Comment 4 Christian Thoens CLA 2011-05-25 13:01:30 EDT
Created attachment 196577 [details]
Avoid stack when because of recursion

If a value is only slightly negative, the time step is not split anymore. The delta is just adjusted so that the values becomes zero. The time step is only split if a value below a certain threshold occurs. Right now the threshold is set to -0.1.
Comment 5 Christian Thoens CLA 2011-05-31 19:49:42 EDT
when a values goes negative the time step is split into several smaller timesteps
Comment 6 Christian Thoens CLA 2011-06-23 19:35:10 EDT
Stack overflow still occurs
Comment 7 Matthew Davis CLA 2011-06-23 20:32:29 EDT
Reopening.

Seeing an exception when using the finite difference solver on two or more simulations of the same scenario running in parallel.  This seems to occur at an indeterminate step in the simulation.

Exception seen:

java.lang.NumberFormatException: empty String
   at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:992)
   at java.lang.Double.parseDouble(Double.java:510)
   at org.eclipse.stem.solvers.fd.impl.FiniteDifferenceImpl.recursiveStep(FiniteDifferenceImpl.java:154)
   at org.eclipse.stem.solvers.fd.impl.FiniteDifferenceImpl.step(FiniteDifferenceImpl.java:111)
   at org.eclipse.stem.core.scenario.impl.ScenarioImpl.step(ScenarioImpl.java:391)
   at org.eclipse.stem.jobs.simulation.Simulation.run(Simulation.java:283)
   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)


Steps to reproduce:

- Select a scenario in the project explorer
- Click Run
- Go back to project explorer, select the same scenario again
- Click run again
- Workbench will eventually throw an error about running the job and generate the above exception
Comment 8 James Kaufman CLA 2011-08-19 14:09:32 EDT
Changing priority to P1 and severity to Major.
This bug is in the release and happens fairly regularly with the Dengue Fever model
Please see Matt's comments above.

The solver is getting an empty string and trying to great a could from it.

see FiniteDifferenceImpl line 154
for (FdJob j : jobs) {
			factor = Math.min(factor, Double.parseDouble(j.getResult().getMessage()));
}

The empty strings are created in FdJob on lines 59 and 65.
Comment 9 Stefan Edlund CLA 2011-12-05 14:33:28 EST
Christian Thoens fixed this before he left.