# Data Fusion Analysis and Synthesis Framework for Improving Disaster Situation Awareness
## 7 Algorithms for Synthesizing the Optimal Data Fusion Configuration
### Optimal-Fit  
Similar to the previous one, this Algorithm 2 builds up a search space of possible element/data-source compositions step by step. Contrary to the previous one, at each step, for all data source compositions, the effectiveness, time, and cost values are calculated and the alternatives with higher effectiveness values are appended to the search tree. This process terminates if all data sources are considered or the timing and cost constraints are violated. The branch with the highest effectiveness value is considered as the optimal data source composition. The Algorithm 2 is implemented by the function \(CALCULATE\_OPTIMAL\_FIT\). The parameters used in this algorithm, same as the previous Algorithm 1, are _instance_, _time_limit_, and _cost_limit_, which represent an instance of a physical object, timing and cost constraints, respectively. In line (2), the function \(OPTIMAL\_APPLICABLE\_SOURCE\) is called, which returns a tree whose leaves refer to a set of data source alternatives that have the maximum contribution to the effectiveness on their path with respect to timing and cost constraints. In the specification of the function \(OPTIMAL\_APPLICABLE\_SOURCE\), two functions play an important role: The function \(GET\_MAX\_N\) implements the formulas defined in Section 6.2. For each leaf node, the function \(GETPATH\) searches for the paths to the root node and calculates the total effectiveness, cost, and timing values of the branch. According to this approach, the path that has the highest effectiveness value is selected as the representation of the optimal data fusion. The running time of the algorithm can be calculated as follows: If the tree length in the output is \(\mathcal{L}\), and the number of available data sensors is \(M\), and the number of children nodes created is \(C=3\), then the running time is lower than the value showed in (5). Here, t represents the running time in each allocation step (corresponds to the function \(OPTIMAL\_AVAILABLE\_SOURCE\)). An exact running time cannot be calculated, because the level of leaf nodes is variable depending on the cost limit. \[ \begin{split} T_{optimal}\leq t\times[M+C^{\mathcal{L}-1}\sum_{k =1}^{C}M-k-\mathcal{L}+2],\ \mathcal{L}>1\\ T_{optimal}\leq t\times[M+C^{\mathcal{L}}(M-\mathcal{L}+\frac{C+ 5}{2})],\ \mathcal{L}>1\end{split}  \tag{5}\]```
1:functionCALCULATE_OPTIMAL_FIT(instance, time_limit, cost_limit) returns list of data sources
2:
3:functionCALCULATE_OPTIMAL_FIT(instance, time_limit, cost_limit)
4:\(candidate\_trees\gets OPTIMAL\_APPLICABLE\_SOURCES(empty\_tree,instance,time\_limit,cost\_limit)\)
5:while constraints are met do
6:\(candidate\_trees\gets OPTIMAL\_APPLICABLE\_SOURCES(candidate\_trees,instance,time\_limit, cost\_limit)\)
7:if each leaf of candidate_trees is end_leaf then
8:break
9:endif
10:endwhile
11:\(best\_path\gets empty\_tree\)
12:for each leaf in candidate_trees do
13:\(path,effectiveness\gets GETPATH(candidate\_trees,leaf)\)\(\triangleright\) returns subtree
14:if\(effectiveness>best\_path.effectiveness\)then
15:\(best\_path\gets path\)
16:endif
17:endfor
18:return\(best\_path\)
19:endfunction
20:functionOPTIMAL_AVAILABLE_SOURCES(\(ds\_trees,instance,time\_limit,cost\_limit\))
21:\(available\_data\_sources\leftarrow\)GET_AVAILABLE_SOURCES(\(ds\_trees,instance\))\(\triangleright\) 2D list that returns available data sources for each subtree
22:for all\(leaf\) in\(ds\_trees\)do
23:\(expanded\leftarrow\) false
24:\(path,effectiveness\leftarrow\) GETPATH(\(ds\_trees,leaf\))
25:\(selected\_data\_sources\leftarrow\) GET_MAX_N(\(path,available\_data\_sources,3\))\(\triangleright\) Get \(N\) maximum effectiveness values
26:for all\(data\_source\)in\(selected\_data\_sources\)do
27:\(subtree\_addchild(data\_source)\)
28:\(expanded\leftarrow\) true
29:endfor
30:if not\(expanded\)then
31:\(subtree\_leaf.type\gets end\_node\)
32:endif
33:endfor
34:return\(ds\_trees\)
35:endfunction
```

**Algorithm 2**CALCULATE_OPTIMAL_FIT(instance, time_limit, cost_limit) returns list of data sources

**Example 4**.