## 3 Context-Aware Positioning Model
### Context Sensing
#### 3.1.1 Characterizing the Physical Environment  
In order to allow the model to access and consume context information, the latter must be represented in a simple and discrete manner. Thus, the contextual elements are assembled into two feature vectors; one to describe the devices, and the other to describe the physical scenario. The devices feature vector (Table 1) stores contextual information based on available peripherals and capabilities. It allows for describing devices in terms of both their capability to sense and access the environment and their own fitness to participate in the positioning process. This means a device could behave differently depending on which contextual elements are available at a given time. The fitness score is a dynamic indicator of a device's aptitude to perform positioning. The greater the fitness of a device, the more likely its positioning information could be used during collaborative positioning. Formally, fitness is calculated as follows: \begin{table}
\begin{tabular}{c c} \hline \hline \multicolumn{1}{c}{**Communication Protocols**} & \begin{tabular}{c} List of sensed communication protocols \\ (_i.e._, TCP/IP and UDP). \\ \end{tabular} \\ \hline \multirow{2}{*}{**Communication Technologies**} & \
\begin{tabular}{c} List of sensed technologies \\ (e.g., GRPS, Wi-Fi, _etc._). \\ \end{tabular} \\ \hline \multirow{2}{*}{**Positioning Capabilities**} &
\begin{tabular}{c} List of sensed positioning strategies \\ (e.g., GPS, fingerprinting, _etc._). \\ \end{tabular} \\ \hline \multirow{2}{*}{**Peripherals**} & A list of available sensors and actuators, each with \\  & their current measurements \\  & (e.g., GPS transceiver, Bluetooth, accelerometer, _etc._) \\ \hline \multirow{2}{*}{**Position**} & A list of the devices’ last known positions, including \\  & their accuracy and positioning decay. \\ \hline \multirow{2}{*}{**Fitness**} & An indicator of whether the device is apt to participate \\  & in (collaborative) positioning. \\ \hline \multicolumn{1}{c}{**Energy**} & The device’s maximum and current energy levels. \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Devices feature vector. \[\text{F}=\text{D}*\left(\text{A}\frac{\text{A}_{\text{i}}-1}{\text{A}_{\text{i}}} \right)*\text{P}*\frac{\text{E}}{\text{E}_{\text{max}}} \tag{1}\]  
Where \(F\) is the fitness score of a device, which can range from 0 to 100. \(D\) is the decay of a positioning estimation. \(A\) is the accuracy requirement of the consumer application, and A\({}_{\text{i}}\) the accuracy of the last positioning estimation (both percentages). P is a binary value representing whether the device knows its position or not. E is the current amount of energy, and \(E_{max}\) the maximum energy level of the device, both represented as arbitrary units. Devices with greater decay (_i.e._, lower \(D\) values), lower accuracy, and/or lower energy values would tend to have low fitness scores. On the other hand, devices with lower decay (_i.e._, greater \(D\) values), greater accuracy, and/or energy values would yield higher fitness scores. Devices that do not know their position would have a fitness of zero (_if_\(P=0,then\)\(F=0\)), since they do not contribute to the positioning process. The scenario feature vector requires describing the contextual elements in the devices' proximity. For the purposes of our work, this characterization actually includes both the representation of the direct context of a device and the positioning strategies that can be accessed by such a device, as shown in Table 2.  
Thus, a device would sense and update its scenario feature vector each time it attempts to perform positioning, effectively assembling a map of its surrounding area (_i.e._, represented through the device's context). Once a device has scanned its environment, it will build a feature vector for each neighboring device within communication range, storing them as an Extensible Markup Language (XML) file.