Created
November 25, 2011 01:36
-
-
Save NickCarneiro/1392614 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float minDot = Float.MAX_VALUE; | |
//apply logic from above else loop here also | |
for (PointWithRSSI p : compare) { | |
float currDot = 0; | |
Set<String> c = p.getAccessPoints().keySet(); | |
for (String s: keys) { | |
if (c.contains(s)) { | |
currDot += p.getAccessPoints().get(s)*p.getAccessPoints().get(s) ; | |
currDot -= (Math.abs(temp.getCurrentPoint().getWeightedaccessPoints().get(s).getRssi()) * Math.abs(p.getAccessPoints().get(s))); //add to the dot product | |
} | |
else { //the penalty for non-containment | |
currDot += (temp.getCurrentPoint().getWeightedaccessPoints().get(s).getRssi()*temp.getCurrentPoint().getWeightedaccessPoints().get(s).getRssi()); | |
} | |
} | |
currDot = Math.abs(currDot); | |
if (currDot < minDot) { | |
minDot = currDot; | |
minPoint = p; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment