LMS fertig
This commit is contained in:
parent
b37b4564a5
commit
9055177bab
|
@ -66,6 +66,7 @@ public class LeastMedianOfSquaresEstimator extends Algorithm {
|
|||
slabs = new PriorityQueue<>(comparator);
|
||||
slabs.add(new Slab(-100000, 100000));
|
||||
heightsigmaMin = Double.MAX_VALUE;
|
||||
LinkedList<Point> tmpIntersections = intersections;
|
||||
|
||||
//(3.) Apply the following steps as long as the exists active slabs
|
||||
boolean active = true;
|
||||
|
@ -82,19 +83,32 @@ public class LeastMedianOfSquaresEstimator extends Algorithm {
|
|||
sigmaMin = planeSweep(slab);
|
||||
} else {//(c.) otherwise....
|
||||
//get random intersections point...
|
||||
splitActiveSlab(intersectionsPoint, slab);
|
||||
|
||||
//(d.) this may update sigma min
|
||||
upperBound(intersectionsPoint);
|
||||
//(e.) for i={1,2}, call lower bound(Ui)
|
||||
lowerBound(subSlabU1);
|
||||
lowerBound(subSlabU2);
|
||||
|
||||
if (subSlabU1.getActivity()){
|
||||
this.slabs.add(subSlabU1);
|
||||
Double randomIntersection = null;
|
||||
Collections.shuffle(tmpIntersections, new Random());
|
||||
for (Point point : tmpIntersections) {
|
||||
if (point.getX() > slab.getLower() && point.getX() < slab.getUpper()) {
|
||||
randomIntersection = point.getX();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (subSlabU2.getActivity()){
|
||||
this.slabs.add(subSlabU2);
|
||||
|
||||
if (randomIntersection != null){
|
||||
splitActiveSlab(randomIntersection, slab);
|
||||
|
||||
//(d.) this may update sigma min
|
||||
upperBound(intersectionsPoint);
|
||||
//(e.) for i={1,2}, call lower bound(Ui)
|
||||
lowerBound(subSlabU1);
|
||||
lowerBound(subSlabU2);
|
||||
|
||||
if (subSlabU1.getActivity()){
|
||||
this.slabs.add(subSlabU1);
|
||||
}
|
||||
if (subSlabU2.getActivity()){
|
||||
this.slabs.add(subSlabU2);
|
||||
}
|
||||
} else {
|
||||
this.slabs.poll();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -124,23 +138,9 @@ public class LeastMedianOfSquaresEstimator extends Algorithm {
|
|||
|
||||
numberOfInversions = mergeSort(umin, 0, umin.size() - 1, umax);
|
||||
|
||||
for (Point point : intersections) {
|
||||
if (point.getX() > slab.getLower() && point.getX() < slab.getUpper()) {
|
||||
randomIntersection.add(point.getX());
|
||||
}
|
||||
}
|
||||
|
||||
Collections.shuffle(randomIntersection);
|
||||
int access = (int) ( randomIntersection.size() * 0.5);
|
||||
if (!randomIntersection.isEmpty()){
|
||||
intersectionsPoint = randomIntersection.get(access);
|
||||
}
|
||||
|
||||
return numberOfInversions;
|
||||
}
|
||||
|
||||
//Parameter anpassen
|
||||
|
||||
/**
|
||||
* Angepasster Merge-Sort Algorithmus.
|
||||
* Die Funktion bekommt neben den standard Parametern zusätzlich eine Liste mit Elementen
|
||||
|
|
Loading…
Reference in New Issue