## 3 Methodology
### Agent Description
Each order requires processing in various processing stages; however, some orders may bypass some stages. \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Definition** \\ \hline \(a_{j}\), \(d_{j}\), \(s_{j}\) & Arrival date, due date, size of order \(j\) \\ \(b_{j}\) & Production lot for order \(j\) \\ \(c_{ii}\) & Processing time available in period \(t\) on each machine in stage \(i\) \\ \(m_{i}\) & Number of identical, parallel machines in stage \(i\) \\ \(n\) & Number of customer orders to be scheduled \\ \(p_{ij}\) & Processing time in stage \(i\) of each product in order \(j\) \\ \(J_{i}\subseteq J\) & \(\{j\in J\): \(p_{ij}>0\}\) subset of wholesaler orders to be processed in stage \(i\) \\ \(J1\subseteq J\) & Subset of small wholesaler orders \\ \(J2\subseteq J\) & Subset of large wholesaler orders \\ \(J_{k}\) & Subset of wholesaler orders for coffee type \(k\) \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Model parameters. \begin{table}
\begin{tabular}{c c} \hline \hline
**Variable** & **Definition** \\ \hline \(u_{j}\) & 1, if order \(j\) is completed after due date; otherwise \(u_{j}=0\) \\ \(x_{jit}\) & 1, if order \(j\) is performed in period \(t\); otherwise \(x_{jit}=0\) \\ \(y_{jit}\) & Fraction of customer order \(j\) to be processed in period \(t\) \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Variables. \begin{table}
\begin{tabular}{c c} \hline \hline
**Index** & **Definition** \\ \hline \(i\) & Processing stage, \(I\in I=(1,\ldots,m)\) \\ \(j\) & Wholesaler order, \(j\in J=(1,\ldots,n)\) \\ \(k\) & Coffee type, \(k\in K=(1,\ldots,r)\) \\ \(t\) & Planning period, \(t\in T=(1,\ldots,h)\) \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Indices. The processing stages are the following: pre-cleaning, threshing, sorting by sieve1, sorting by vibration-gravity, pneumatic sorting, and optical sorting. Let \(\mathrm{p_{ij}}\geq 0\) be the processing time in stage i of each product in order \(\mathrm{j}\in\mathrm{J}\). The orders are processed and transferred among the stages in lots of various sizes that depend on the ordered product type and let \(\mathrm{b_{j}}\) be the size of production lot for order \(\mathrm{j}\). The coffee beans are feed into the pre-cleaning machine, \(\mathrm{m_{1}}\), and then, it goes to the threshing machine, \(\mathrm{m_{2}}\); this machine has 2 outputs, good coffee beans, and straw, the straw leaves the system and the coffee continues its way to the next processing stage. The sorting by sieve machines in stage 3, \(\mathrm{m_{3}}\) y \(\mathrm{m_{4}}\), have three outputs, (1) good coffee beans, (2) pellet and (3) straw; the good coffee beans continues its way to enter the next machine, while the broken coffee beans and straw leave the system, separately. The sorting by vibration-gravity machine, \(\mathrm{m_{5}}\), has four outputs, (1) good coffee beans, which passes to the next machine, or failing that, leaves the system as the final product; (2) pellet, (3) dust and (4) dried cherries that leave the system definitively as waste. The pneumatic sorting machines, \(\mathrm{m_{6}}\), \(\mathrm{m_{7}}\) y \(\mathrm{m_{8}}\), have three outputs (1) good coffee beans that leave the system as final product; (2) stain coffee beans that leave the system as waste, and (3) coffee beans that re-enter the machine to be reprocessed. The optical sorting machines, \(\mathrm{m_{9}}\), \(\mathrm{m_{10}}\) y \(\mathrm{m_{11}}\), have two outputs (1) good coffee beans that leave the system as final product; (2) stain coffee beans that leave the system as waste. The planning horizon consists of h planning periods, and L is the length of each planning period, in this case, working hours per week. Let \(\mathrm{T=\{1,\ldots,h\}}\) be the set of planning periods and \(\mathrm{c_{it}}\) the processing time available in period \(\mathrm{t}\) on each machine in stage i. Customer orders are split into production lots of fixed sizes, each to be processed as a separate job.