# Exploring Decentralized Warehouse Management Using Large Language Models: A Proof of Concept
## 3 System Architecture
### Protocol Layer
#### Decision Process  
The primary objective of the package agent is to ensure continuous storage for its package while minimizing the total cost of storage. A penalty is applied for any gaps in storage, which can disrupt service continuity. The objective function for the package agent Objective\({}_{package}\) is defined as follows:  
\[\text{Objective}_{\text{package}}=\sum_{k=1}^{n}p_{k}\cdot d_{k}+w\cdot G \tag{34}\]  
where \(n\) is the total number of scheduled services, \(p_{k}\) is the price per unit time for the \(k\)-th storage service, \(d_{k}=t_{\text{end}_{k}}\), \(t_{\text{start}_{k}}\) is the duration of the \(k\)-th service, \(G\) represents the total duration of gaps in storage, penalizing any breaks in service continuity, and \(w\) is the penalty weight for gaps, reflecting their impact on the package agent's operations. The package agent aims to minimize Objective\({}_{\text{package}}\) by negotiating for the lowest possible storage prices \(p_{k}\) and by ensuring there are no gaps (\(G=0\)) between consecutive storage services in \(S_{i}\). This objective function balances cost and service continuity, guiding the package agent's decision-making process. Each package agent follows a specific decision-making process, leveraging the actions available in its action space to achieve its objectives. By continuously monitoring its perceptual data and scheduled services, the package agent proactively identifies when additional storage services are needed and initiates negotiations with warehouse agents to secure favorable terms. The package agent's decision process is illustrated in Figure 3.  
The process begins with the agent observing its storage needs. If no additional storage is required, the process terminates. If storage is required, the agent first checks if a direct offer has already been accepted. If the offer has been accepted, the agent adds a new storage service to its schedule and completes the process. If the offer has not been accepted, the agent checks whether the offer has been rejected. If the offer has been rejected, the agent prepares a new direct offer and sends it to the warehouse agents. If the offer has not been rejected, the agent checks whether the direct offer has expired. If the offer has expired without being accepted or rejected, the agent prepares and sends a new direct offer. Once a direct offer is accepted and the storage service is added to the schedule or a new offer is sent, the process is completed. This decision-making process allows the package agent to handle its storage requirements proactively, securing storage services as needed. The package agent's decision-making process, shown in Figure 3, uses inputs including perceptual data on storage needs, current scheduled services, and the status of direct offers (accepted, rejected, or expired). The outputs include a decision to terminate if no action is needed, a new direct offer with parameters like start time, end time, price, and expiry time if the prior offer was rejected or expired, or a new storage service added to the schedule if an offer is accepted. To delve deeper into the package agent's decision-making process, we focus on two main processes: observing storage needs and preparing direct offers. In the observing storage needs process, the package agent continuously monitors its perceptual data \(D_{\text{perceptual}_{i}}=(\text{Slot}_{i},S_{i})\), particularly the list of scheduled services \(S_{i}=[s_{i1},\ s_{i2},\ \dots,\ s_{in}]\). The agent checks for potential gaps in storage by examining the end times \(t_{\text{end}_{ij}}\) and start times \(t_{\text{start}_{(j+1)}}\) of consecutive services. A gap exists if \(t_{\text{end}_{ij}}<t_{\text{start}_{(j+1)}}\), contributing to the total gap duration \(G\). Additionally, the agent assesses if the time until the end of the last scheduled service \(t_{\text{end}_{\text{last}}}\) is shorter than a predefined threshold \(\Delta t\) by checking if \(T_{\text{current}}+\Delta t\geq t_{\text{end}_{\text{last}}}\).