AutomatedProcessImprovement / Prosimos

Prosimos Simulation Engine (CLI)
8 stars 4 forks source link

Some batch tests fail occasionally #67

Open david-chapela opened 1 year ago

david-chapela commented 1 year ago

Description of the problem

I think there might be some bugs in edge cases for batch processing. The test test_range_correct_distance_between_batches_and_inside (here) fails some of the runs. The main issue is:

Guess of the reason behind it

I don't know the implementation, but I imagine this is some problem with the batch rules not being fulfilled at the point where there are no more activities pending to be executed, and the simulation ending without processing those pending batches.

If I remember correctly, we established some criteria like:

  1. For rules based on "size": If there are pending batches (unfulfilled rule), but there are no more activities to process (impossible to fulfill rule), throw the batches.
  2. For rules based on time: Just wait until the time rule is fulfilled (it will be at some point) and throw the batches there.

I guess what is happening is that Prosimos is running out of activities to process before the rule or the criteria 2. are fulfilled. Then, it ends the simulation. In the attached example, this last D is supposed to be executed at 2022-10-01 01:55:16.376778+03:00 (or later if more Ds arrive). However, the last processed activity ends at 2022-10-01 00:05:27.240190+03:00 and no more activities are registered.

david-chapela commented 1 year ago

@orlenyslp, in case you want to try it, I just directly run the simulation using the process_model.bpmn and parameters.json attached to the issue (without running the test case).

I have to run it multiple times, but I've found one simulation where the last D is executed alone (so it is not a problem of the batch being executed with only one activity). However, in this case, the other traces ended while the last trace was starting, so the last trace was executed one event after the other (D is even waiting 3h as it should).

It took me around 10-15 runs, but I got the same error (event log).

I think the problem might be only when:

  1. Prosimos processes an activity and enables the batched activity, which is now waiting for its rule to be fulfilled.
  2. Then, Prosimos starts processing activities from other traces, unrelated to the batched activity.
  3. Then, no more activities can be processed, and Prosimos ends the simulation.
  4. The batched activity was waiting, but the simulation finished.