Research Article

A Context-Aware Assisted WiFi Positioning Method

Algorithm 1

A variable weight dynamic KNN fingerprint identification algorithm (VWD-KNN).
Input: Fingerprint library , the corresponding position of each fingerprint in the fingerprint library is ,the fingerprint of the test point is ,the Context parameter is Context, and the threshold parameter is c.
Output: The positioning result of the test point is .
1: The Euclidean distance between the fingerprint of the test point and each fingerprint in the fingerprint database is calculated. The distance is denoted as , using formula (1)(2)(3), and the corresponding index sequence is generated;
2: Dis reorders in ascending order. In the sorting process, the index is bound to dis, and the sorting result is marked as ;
3: Based on and traverse calculated each fingerprint impact on the final result weight weight= , Initialize the ;
4: The fourth step: Determination process of dynamic K:
5: Get the length len of the weight;
6: for to len do
7:   (1) Calculating =+(1-)=. Using formula (9);
8:   (2) If , continue cyclic processing until increases to len and dynamic equals len. Otherwise, is taken as the determination result of dynamic , and then transferred to (3);
9:   (3) Take the larger of dynamic and initializing as the final decision result and return;
10: end for
11: Recalculate the weights Among them, . Using formula (4);
12: Get the positioning result and . Using formula (5)(6)