WIP: upperBound

This commit is contained in:
Armin Wolf 2017-06-09 07:55:39 +02:00
parent ca72648c26
commit 8e1c642f52
1 changed files with 30 additions and 4 deletions

View File

@ -1,11 +1,9 @@
package Presenter.Algorithms; package Presenter.Algorithms;
import Model.Coordinates; import Model.Coordinates;
import sun.awt.image.ImageWatched;
import java.util.Iterator; import java.util.*;
import java.util.LinkedList;
import java.util.Set;
import java.util.TreeSet;
/** /**
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden. * Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
@ -18,6 +16,7 @@ public class LeastMedianOfSquaresEstimator extends Algorithm {
private LinkedList<Coordinates> set = new LinkedList<>(); private LinkedList<Coordinates> set = new LinkedList<>();
private LinkedList<Coordinates> sortedIntersections = new LinkedList<>();
private int n; private int n;
private double quantile = 0.5; private double quantile = 0.5;
private double quantileError; private double quantileError;
@ -32,6 +31,8 @@ public class LeastMedianOfSquaresEstimator extends Algorithm {
private double umin; private double umin;
private double umax; private double umax;
private double heightsigmaMin; private double heightsigmaMin;
private Coordinates sigmaMinStart;
private Coordinates sigmaMinEnd;
private int numberOfIntersections; private int numberOfIntersections;
private final int constant = 1; private final int constant = 1;
private Coordinates kMinusBracelet; private Coordinates kMinusBracelet;
@ -119,10 +120,35 @@ public class LeastMedianOfSquaresEstimator extends Algorithm {
} }
public void upperBound(double point){ public void upperBound(double point){
ArrayList<Coordinates> temp = new ArrayList<>();
ArrayList<Double> min = new ArrayList<>();
double height;
for (Coordinates p : set) {
temp.add(new Coordinates(point, (p.getX() * point) + p.getY()));
}
Collections.sort(temp);
for (int i=1;i<(n-(kMinus+1));i++){
height = temp.get(i+(((int) kMinus) - 1)).getY() - temp.get(i).getY();
if (height < heightsigmaMin)
sigmaMinStart = new Coordinates(point, temp.get(i+(((int) kMinus) - 1)).getY());
sigmaMinEnd = new Coordinates(point, temp.get(i).getY());
}
} }
public void lowerBound(Slab slab){ public void lowerBound(Slab slab){
double[] alpha = new double[n];
double[] beta = new double[n];
alpha[0] = 0;
beta[0] = 0;
for (int i=1;i < n; i++){
}
// if Ui is active on return add it to the list of active slabs..!!! // if Ui is active on return add it to the list of active slabs..!!!
} }