Hello KNIME Community,
I need some help. I’ve tried to create a KNIME flow in order to dynamically batch bags into trips. The idea is if certain logic is followed, an employee can pick up all bags in the same location regardless of the order id, but only if it is within the same location and meets a time requirement. I might be over complicating this, but I have tried multiple iterations and have not arrived at anything remote to what I need for my project.
The logic is below:
Logic Test:
Step 1: Sort ‘Bag Located Sections’ to make sure all similar sections are batched together.
Step 2: Calculate difference between Customer On The Way Time Stamp and Customer Arrived Time Stamp.
Step 3: Look at second order to see if it is between ‘Customer On The Way Time Stamp’ and ‘Customer Arrived Time Stamp’ of first order, if it is, then it is considered a child; otherwise parent. This is what the batching process is.
Step 4: Since the second order ‘Customer On The Way Time Stamp’ is between the first order ‘Customer On The Way Time Stamp’ and ‘Customer Arrived Time Stamp’ then Time Diff is empty
Step 5: If there is a parent and child then then order 1 and order 2 ‘Bags Located Sections’ are batched to create 1 trip, otherwise 2 trips.
Step 6: Batching only occurs if step 1-5 are true. Next part is to make sure that ‘Duration Per Bag Loc Section’ is less than Parent ‘Time Diff’. In this example, since order 1 and order 2 are batched, the total time for each section is FRONT1 = 2 minutes. So if Parent (2 Mins) and Child (2 mins) that is 4 Minutes, and it <= to Time Diff of parent (4 Mins), then this is successfully batched.
Attached is the sample data:
Example Data KNIME.xlsx (11.2 KB)
Output Example:
hi @etorres182
attached is my workflow to validate the batches and the parent/child groups.
fyi, i added one row of data to your sample data just to validate the logic.
KNIME_batching.knwf (453.8 KB)

apologize if it doesn’t meet your expectations.
happy knimining!
rgds
1 Like
Hi @marzukim,
Thank you so much for looking into my issue. Yes, this is basically what I needed. I had a chance to review the entire model and have made a few changes. The issue I am struggling with is adding logic for when batching should happen based on the below:
- Are There Overlaps?
Enough time to retrieve both (all) orders
• 2 minutes per order with only FRONT#, 1 minute if SIDE# or BACK# only, 3 minutes if the order has FRONT# & SIDE# or BACK#, 4 minutes with all 4.
• Customer 1: FRONT#1 and SIDE#1 (3 minutes)
• Customer 2: FRONT#2 (2 minutes)
• Customer 3: BACK (1 minute)
• Total Time needed: 6 minutes
• Start at 2nd Customer OMW notification
• X minutes between last customer Customer On The Way notification ts and Customer Arrived between all customers
I have added a validation part because I was having a hard time validating the below:
Step 3: Look at second order to see if it is between ‘Customer On The Way Time Stamp’ and ‘Customer Arrived Time Stamp’ of first order, if it is, then it is considered a child; otherwise parent. This is what the batching process is. The idea is that we are looking at consecutive orders to see if they meet the requirements to be batched together based on the requirements mentioned.
I am attaching the updated KNIME flow:
KNIME_batchingV2.knwf (289.4 KB)
hi etorres ,
i’m glad that workflow provides some direction for you to proceed. just to let you know, i’m not an expert in batching scenarios, but I will give it my best effort with my limited time.
just for info, in my workflow logic the parent/child and batched/unbatched relationships are calculated based on the grouping of your order numbers. based on your previous sample data (V1), i’m assuming that the parent/group order number has 3 batches (1181,5181,9181) . this is the tricky part: validating the number of batches.
referring to the V2 version (your real table data order numbers), i suggest that we have to differentiate the parent/group order number batch first (preparation stage) because if we use the current logic workflow, the result is only one batch (1829), unless it is the only batch sending to the location.
e.g: if we increase the subtraction (in string manipulation node) to 6, then we will get 3 batches (182908, 182912, 182918), and so on. this will affect the final results.
once we have verified this (differentiating the batches), we can hopefully proceed to the next issue that arises, because all the next logic flow depends on these right (batch group) results.
rgds.
@marzukim thanks for your time, I really appreciate the help. As I think about the process, it may be a lot easier to batch based on Bag Located Section instead of orders. As I think of this, this is really the sequence of batching. I am attaching a screenshot as a reference. Getting this batching sequence has been the tough part in the KNIME creation process.
Batching Process:
- Order By Bag Location (This is the primary column to use for batching)
- The customer on the way ts for any other guest needs to be within the customer on the way and arrived tm of the first guest
- OMW ts + 2 minutes(time needed to retrieve the order) must be less than customer arrived ts for either guest
— There needs to be enough time to gather orders before either guest arrives.
- If Bag count > 8 then cap the batch (Meaning new batch)
KNIME_batchingV2.5.knar.knwf (381.4 KB)
even though i’m not an expert in your field, i’ve learned something new from you, even if it wasn’t 100%. (too old to learn new things
).
hope your effort will be expanded and elaborated to tackle on other issues. wish you all the best in your work
happy knimining.