# Environmental-Based Speed Recommendation for Future Smart Cars +
## 4 Experimental Results  
### System Overview  
The proposed methodology was developed and deployed on top of a distributed agent-based computing deployment for smart cars, named Hydra [20]. The developed approach was chosen as the system infrastructure because it employs a fast and lightweight mechanism for software oriented agents. Each agent runs Hydra as a software service, which manipulates the execution of running tasks and performs self-optimization functions regarding optimal on-vehicle resource utilization. Hydra employs four basic modules: (1) Agent discovery and recovery; (2) Monitoring; (3) Prediction and (4) Election.  
Regarding the communication of the software agents inside the vehicle, Hydra exploits the agent discovery and recovery module, which is responsible to separately find out the existence of other agents. The software agents announce their presence and services in the vehicle's internal network. That way, agent-to-agent connection is established and then every agent is aware of the presence of the following neighbor, forming a cyclic ring. However, this ring can be interrupted if an agent goes offline and is not accessible anymore. To address this issue, Hydra sends and receives messages between agents that contain useful information about their status. There are four types of messages: ANNOUNCE, UPDATE, BID and BID WIN and each message has two corresponding actions: SET and GET. The messages serve the purpose of establishing a new connection in a preexisting agent ring and update the neighbor agent with the current status. Agent \(i\) sends a series of update messages to agent \(i+1\) and, if that fails, then agent \(i\) considers agent \(i+1\) offline, abandons the connection and re-connects with the next available agent. Messages also facilitate the bidding process, in case a task needs to be offloaded to another agent. In summary, the messages that Hydra is exploiting are presented in Table 2. The communication layer was developed on top of Dlib [45] and ZeroMQ [46] libraries.  
When an agent is running Hydra, one or more tasks are executed on the agent. However, the configuration of each task is actually unknown initially, and needs to be monitored at run time. Hence, after the initialization of the agents and the establishment of the communication, each agent starts its monitoring manager. Every agent that is running Hydra conducts the same monitoring process locally, sampling the status of their resources periodically. For that reason, monitoring module defines a sampling period in order to get a sufficient number of updates about the current resource usage. Based on the data that are gathered through the local monitoring procedure, run-time optimizations can be performed, based on a desired objective.  
In case there is a resource constraint, Hydra employs a prediction scheme that projects the resource utilization in the next sampling period. This mechanism is based on the transition matrix concept, where the status of each resource utilization is described by a set of predefined \(m>1\) states\(\{s_{1},s_{2},...,s_{m}\}\), so as to build a transition probability matrix \(M=M(s_{i},s_{j})\), where \(M=M(s_{i},s_{j})=Pr(transition\,s_{i}\to s_{j})\).  
If the predicted utilization is above the desired threshold, then Hydra triggers the election mechanism. The agent that detects the threshold violation communicates with the rest of agents in order to initiate the election process. It requests from all the available agents to send their bids and selects the winner according to which one has the highest resource availability. Then, it announces the winner of the bid and migrates one or more applications to the corresponding agent. The same procedure is followed in case there is an agent failure, so that the workload that was running on that agent is shared among its neighbors. Thus, from the user's perspective, the system's functionality is preserved and the running workload remains steady across the multi-agent system.