コード例 #1
0
 public IterativeDivider(Array array, Array heftArray, Transformator transformator, int spaceDimension,
     int histogramResolution, int serverNO, double delta, int pointNO, int kNN, int maxRange,
     Shell[] shellsForKNN, Shell[] shellsForRange, double kNNMeasCoeff, double lbMeasCoeff)
     : base(array, heftArray, transformator, spaceDimension, histogramResolution, serverNO, delta, 
         pointNO, kNN, maxRange, shellsForKNN, shellsForRange, kNNMeasCoeff, lbMeasCoeff)
 {
 }
コード例 #2
0
 public RecursiveDivider(Array array, Array heftArray, Transformator transformator, int spaceDimension,
     int histogramResolution, int serverNO, double delta, int pointNO, int kNN, int maxRange,
     Shell[] shellsForKNN, Shell[] shellsForRange, double kNNMeasCoeff, double lbMeasCoeff)
     : base(array, heftArray, transformator, spaceDimension, histogramResolution, serverNO, delta, 
         pointNO, kNN, maxRange, shellsForKNN, shellsForRange, kNNMeasCoeff, lbMeasCoeff)
 {
     this.initializationValue = -1.0;
     transformator.initializeObjectiveValueArray(this.initializationValue, this.objectiveValueArray);
 }
コード例 #3
0
 public Shell[] createShells(int shellNO, int spaceDimension)
 {
     List<Shell> shells = new List<Shell>();
     // The shellIdx is only a candidate shell index based on Fermat's theorem on sum of two squares
     // and Legendre's three-square theorem
     int shellIdx = 1;
     while (shells.Count < shellNO)
     {
         Shell currentShell = new Shell();
         IntTuple[] currentIntTuples = backtrackingMethod.decomposeByBacktracking(shellIdx, spaceDimension);
         if (currentIntTuples.Length != 0)
         {
             currentShell.setIntTuplesWithSwapsAndSignChange(currentIntTuples, backtrackingMethod.getComparer());
             shells.Add(currentShell);
         }
         shellIdx++;
     }
     return shells.ToArray();
 }
コード例 #4
0
 public BaseDivider(Array array, Array heftArray, Transformator transformator, int spaceDimension, 
     int histogramResolution, int serverNO, double delta, int pointNO, int kNN, int maxRange, 
     Shell[] shellsForKNN, Shell[] shellsForRange, double kNNMeasCoeff, double lbMeasCoeff)
 {
     this.heftArray = heftArray;
     this.transformator = transformator;
     this.spaceDimension = spaceDimension;
     this.histogramResolution = histogramResolution;
     this.serverNO = serverNO;
     this.delta = delta;
     this.kNNMeasCoeff = kNNMeasCoeff;
     this.lbMeasCoeff = lbMeasCoeff;
     int[] lengthsObjectiveValueArray = new int[2 * spaceDimension + 1];
     lengthsObjectiveValueArray[0] = serverNO;
     for (int idx = 1; idx <= 2 * spaceDimension; idx++)
     {
         lengthsObjectiveValueArray[idx] = histogramResolution;
     }
     this.objectiveValueArray = Array.CreateInstance(typeof(double), lengthsObjectiveValueArray);
     this.partitionArray = Array.CreateInstance(typeof(Coords[]), lengthsObjectiveValueArray);
     this.hasEnoughBinsArray = Array.CreateInstance(typeof(bool), lengthsObjectiveValueArray);
     setMeasureInstances(array, pointNO, kNN, maxRange, shellsForKNN, shellsForRange);
 }
コード例 #5
0
 public Dictionary<int, List<int[]>> convertIntPairsOfShellsToListOfIdxArrays(int histogramResolution, 
     int[] inputIndicesArray, Shell[] shells)
 {
     Dictionary<int, List<int[]>> result = new Dictionary<int, List<int[]>>();
     int shellIdx = 0;
     foreach (var shell in shells)
     {
         List<int[]> indicesArraysInCurrentShell = new List<int[]>();
         IntTuple[] intTuples = shell.getIntTuples();
         foreach (var intTuple in intTuples)
         {
             int[] currentIndicesArray;
             if(intTuple.determineIdxArrayRelativeTo(histogramResolution, inputIndicesArray,
                 out currentIndicesArray))
             {
                 indicesArraysInCurrentShell.Add(currentIndicesArray);
             }
         }
         result.Add(shellIdx, indicesArraysInCurrentShell);
         shellIdx++;
     }
     return result;
 }
コード例 #6
0
        private void setMeasureInstances(Array array, int pointNO, int kNN, int maxRange, 
            Shell[] shellsForKNN, Shell[] shellsForRange)
        {
            KNNAuxData kNNAuxData = new KNNAuxData()
            {
                SpaceDimension = this.spaceDimension,
                HistogramResolution = this.histogramResolution,
                ServerNO = this.serverNO,
                PointNO = pointNO,
                KNN = kNN,
                Histogram = array,
                Shells = shellsForKNN
            };
            this.kNNMeasure = new KNNMeasure(kNNAuxData, this.transformator);

            RangeAuxData rangeAuxData = new RangeAuxData()
            {
                SpaceDimension = this.spaceDimension,
                HistogramResolution = this.histogramResolution,
                ServerNO = this.serverNO,
                PointNO = pointNO,
                MaxRange = maxRange,
                Histogram = array,
                Shells = shellsForRange
            };
            this.rangeMeasure = new RangeMeasure(rangeAuxData, transformator);

            LoadBalancingAuxData lbAuxData = new LoadBalancingAuxData()
            {
                ServerNO = this.serverNO,
                PointNO = pointNO,
                Delta = this.delta
            };
            this.lbMeasure = new LoadBalancingMeasure(lbAuxData, this.transformator);

            BoxAuxData boxAuxData = new BoxAuxData()
            {
                SpaceDimension = this.spaceDimension,
                HistogramResolution = this.histogramResolution,
                ServerNO = this.serverNO,
                Histogram = array,
                HeftArray = this.heftArray
            };
            this.boxMeasure = new BoxMeasure(boxAuxData, this.transformator);
        }