## 2 Materials and Methods  
### Scenario Description  
The soybean seed classification process addressed in this study is based on the real-life case of a Brazilian agribusiness cooperative located in the state of Parana. This process is performed twice: at the arrival and departure of grains.  
The current process, to ensure transparency among all stakeholders, including farms and cooperatives, stores physically classified samples for up to three days before being discarded. However, there are still weaknesses in the process, such as the manual input of classification results into the system. This raises concerns among managers, who report attempted fraud and bribery every year.  
As shown in Figure 1, the system comprises the following stages: Trucks arrive with a soybean grain load and wait in a queue until they are served. Once served, the worker performs the \"Liming\" step, during which samples are taken from different parts of the truck. The samples proceed to the \"Quartering\" stage, where the sample is homogenized (i.e., grains collected from different parts of the truck are mixed to form a single sample). Subsequently, the samples are separated into two parts for two parallel processes: the first involves the \"Impurities Classification\", while the second involves both \"Moisture Measurement\" and \"Injury Classification\". The \"Impurities Classification\" stage analyzes the presence of contaminants in the sample, such as small stones, branches, leaves, and dust. It is performed using a machine. In the subsequent process, \"Moisture Measurement\" assesses the humidity level of the sample, also carried out by a machine. \"Injury Classification\" is the stage where soybean grains are manually inspected by workers to identify the quantity of damaged grains, rotten grains, and unripe grains. Finally, a report is generated summarizing all the analyses conducted, and the truck exits the system.  
Human vision cannot reliably detect tenuous injuries, and the \"Injury Classification\" step necessitates cutting the seed and observing its health, leading to extended processing times (averaging 10 min) and lengthy truck queue times. Currently, workers perform a superficial visual analysis, which is highly inefficient and can lead to substantial fines for misclassification (averaging 3 min). However, on days with a high influx of trucks, the workers do not perform the \"Injury Classification\" step, claiming that this activity requires a significant amount of time, increasing the total lead time, and consequently resulting in long queues and waiting times.  
Thus, the company chose to invest in intelligent methods for carrying out the task. It was considered to use a machine capable of performing the \"Injury Classification\" step efficiently using computer vision, a technique that has been used by researchers in order to identify varieties or defects in different types of grains such as soybeans [43; 46; 47], wheat [48; 49], corn [50; 51], rice [52], and many others. The machine's current lead time proves to be better than the ideal analysis time when performed by a worker, and the machine supplier anticipates that with new software updates, this lead time will be reduced to half.  
Then, considering the different lead times for the same step, it is necessary to understand how the whole system will be affected when including the machine and changing parameters. Therefore, an approach combining computational simulation and machine learning techniques is applied to forecast the average lead time and waiting queue time to help decision-makers.