algorithms-for-computing-li.../src/main/java/Presenter/Algorithms/RepeatedMedianEstimator.java

83 lines
2.2 KiB
Java

package Presenter.Algorithms;
import Model.Line;
import Model.Slab;
import java.util.ArrayList;
import java.util.LinkedList;
/**
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
*
* @Author: Armin Wolf
* @Email: a_wolf28@uni-muenster.de
* @Date: 28.05.2017.
*/
public class RepeatedMedianEstimator implements Algorithm {
private LinkedList<Line> set;
private Slab interval;
//in der Literatur als L_i, C_i, und R_i bekannt
private Integer countLeftSlab;
private Integer countCenterSlab;
private Integer countRightSlab;
//die Mengen L,C und R
private ArrayList<Line> linesInLeftSlab;
private ArrayList<Line> linesInCenterSlab;
private ArrayList<Line> linesInRightSlab;
private Double r;
private Integer n;
private Double k;
private Double kLow;
private Double kHigh;
private Double beta;
public RepeatedMedianEstimator(LinkedList<Line> set) {
this.set = set;
interval = new Slab(-10000,10000);
n = set.size();
beta = 1.0;
countLeftSlab = 0;
countCenterSlab = n - 1;
countRightSlab = 0;
linesInLeftSlab = new ArrayList<>();
linesInCenterSlab = new ArrayList<>(set);
linesInRightSlab = new ArrayList<>();
}
public void run(){
while (linesInCenterSlab.size() != 1){
r = Math.floor(Math.pow(n, beta));
ArrayList<Line> lines = sampleLines(linesInCenterSlab, r);
//TODO: hier kommt der neue Ansatz vom zweiten Algorithmus hin
k = (Math.floor(n * 0.5) - linesInLeftSlab.size());
computeSlabBorders();
fastSelectionAlg();
countNumberOfIntersectionsAbscissas();
}
}
public ArrayList<Line> sampleLines(ArrayList<Line> set, Double r){return null;}
public void computeSlabBorders(){
kLow = Math.max(1, Math.ceil(((r * k)/(linesInCenterSlab.size()))-((3 * Math.sqrt(r))/(2))));
kHigh = Math.max(1, Math.ceil(((r * k)/(linesInCenterSlab.size()))+((3 * Math.sqrt(r))/(2))));
}
public void fastSelectionAlg(){}
public void countNumberOfIntersectionsAbscissas(){}
}