## 4 System Design
### Task Mapping and Allocation Model  
In this paper, the motivation is a clear design of mission-planning systems. For this, a task-object method is proposed. The tasks and objects belong to the mission are received, and the mapping is performed. The mapping is performed using two methods: manual and autonomous. In manual mapping, the mission-planning toolbox has a plan in which the visual programming tool is integrated to enable DIY makers to perform drag and drop operations. We use JSPlumb javascript library to serve this purpose. In autonomous mapping, the mapping is performed according to the highest suggestion index for a virtual object. Supposing we have a vector \(V_{o}\), representing the virtual representation of the IoT resource, hereafter called virtual object, and a vector \(\tau\), representing a task:  
\[V_{o}=\begin{bmatrix}id\\ name\\ methods\\ attributes\\ tags\end{bmatrix}\]  
and  
\[\tau=\begin{bmatrix}id\\ title\\ period\\ execution\\ tags\end{bmatrix} \tag{1}\]  
Suggestion Index \(\eta\) for task \(\tau_{i}\) is a function of the attributes name, methods, attributes, and tags of any virtual object \(V_{o}\). In this work, the suggestion index is computed on the basis of task name, tags and the methods of VOs. Let \(\omega\) be the similarity index vector \([\omega_{n}\ \omega_{m}\ \omega_{a}t]\) which contains weights for name correlation, methods correlation, and attributes correlation. A user-  
\[\omega_{n}(\tau_{i})=\alpha\omega_{n}(\tau_{i})\ \ \text{where}\ \alpha=0.25.\]  
**Lemma 3**.: _If a task name has matching attributes with a virtual object, it also contributes but to a less extent._  
\[\omega_{a}(\tau_{i})=\sigma(\tau_{i}[title],V_{o}[attributes])\ \ \ \forall\ V_{o}.\]  
_For attributes, the \(\alpha\) value is set as 0.1 because it plays a lesser role in finding the correlation._  
\[\omega_{n}(\tau_{i})=\alpha\omega_{n}(\tau_{i})\ \ \text{where}\ \alpha=0.1.\]  
**Lemma 4**.: _Tags of tasks are the keywords which are associated with tasks. Similarly, tags are also stored for indexing virtual objects. The number of similar tags in both contributes to the suggestion index, but a number of dissimilar tags also play a role in computing suggestion node._  
\[\omega_{a}(\tau_{i})=\sigma(\tau_{i}[tags],V_{o}[tags])-\frac{1}{\sigma^{-1}( \tau_{i}[tags],V_{o}[tags])}\ \ \ \ \forall\ V_{o}.\]  
For tags, the value of \(\alpha\) is set as 0.5 and is considered of equal importance as name.  
\[\omega_{t}(\tau_{i})=\alpha\omega_{n}(\tau_{i})\ \ \text{where}\ \alpha=0.5.\]  
On the basis of the above lemmas, the suggestion index \(\eta\) for \(\tau_{i}\) is computed as follows:  
\[\eta[\tau_{i}]=\sum_{j=0}^{4}\omega_{j}.\]  
The flow of operations in planning missions and task-object mapping is described in Figure 4.  
The mission-planning toolbox is responsible for the making and planning of the missions and the mapping and allocation of the tasks on IoT virtual objects through the mission plan. The mission plan connects with the cloud-centric application to get the mission object using a RESTful Application Programming Interface (API). The mission object has reference to the tasks and virtual objects which are relevant to the received mission. The received data are parsed, and tasks and objects are created. The mapping plan is then populated with the tasks and virtual objects on the left and right end, respectively. The suggestion index is computed for each task and appended with the task to facilitate manual mapping and autonomous mapping. Once the mapping is done, it has been asserted if a certain object has more than one task, then the scheduling algorithm comes into place to provide consensus among tasks of that particular object. If one-to-one mapping is done, then the tasks are allocated and deployed on the physical devices. Different device-specific function calls are considered for the proper execution of the tasks on the physical resources. The mission is evaluated against its goal and policies, and if the policies and goals are not met, it calls the task-object mapping back.