Example #1
0
        private static void arrayPartitionPhase(IndexTransformator transformator, InputParser inputParser, 
            HeftArrayCreator heftArrayCreator, out int serverNO, out int pointNO, out double delta, 
            out int neededTileNumber, out int[] tiles)
        {
            int spaceDimension;
            int histogramResolution;
            int strategyCode;
            int cellMaxValue;
            double deltaCoefficient;
            int slidingWindowSize;
            Array array;
            bool together = inputParser.determineTogetherOrSeparately();
            if (together)
            {
                array = inputParser.parseInputFile(out spaceDimension, out histogramResolution,
                    out serverNO, out pointNO, out delta, out strategyCode, out cellMaxValue,
                    out deltaCoefficient, out slidingWindowSize);
            }
            else
            {
                parseInputSeparately(inputParser, out serverNO, out pointNO, out delta, out spaceDimension,
                    out histogramResolution, out strategyCode, out cellMaxValue, out array,
                    out deltaCoefficient, out slidingWindowSize);
            }
            Console.WriteLine("Point no.: {0}", pointNO);
            Console.WriteLine("Delta: {0}", delta);
            double usedDelta = delta * deltaCoefficient;
            Console.WriteLine("The used delta: {0}", usedDelta);
            Array heftArray = heftArrayCreator.createHeftArray(spaceDimension, histogramResolution, array);

            Divider divider = new Divider(array, heftArray, transformator, spaceDimension, histogramResolution,
                serverNO, delta, usedDelta, strategyCode, slidingWindowSize);
            Coords[] partition;
            neededTileNumber = divider.determineNeededTileNumber(out partition);
            Console.WriteLine("Needed tile number: {0}", neededTileNumber);
            tiles = writeOutTiles(neededTileNumber, spaceDimension, partition);
        }
Example #2
0
 public Divider(Array array, Array heftArray, IndexTransformator transformator, int spaceDimension,
     int histogramResolution, int serverNO, double delta, double usedDelta, int strategyCode, 
     int slidingWindowSize)
 {
     this.array = array;
     this.heftArray = heftArray;
     this.transformator = transformator;
     this.spaceDimension = spaceDimension;
     this.histogramResolution = histogramResolution;
     this.serverNO = serverNO;
     this.delta = delta;
     this.usedDelta = usedDelta;
     this.strategyCode = strategyCode;
     this.slidingWindowSize = slidingWindowSize;
     int[] lengthsTileNumberArray = new int[2 * spaceDimension];
     for (int idx = 0; idx < 2 * spaceDimension; idx++)
     {
         lengthsTileNumberArray[idx] = histogramResolution;
     }
     this.tileNumberArray = Array.CreateInstance(typeof(int), lengthsTileNumberArray);
     this.partitionArray = Array.CreateInstance(typeof(Coords[]), lengthsTileNumberArray);
     this.diffSumArray = Array.CreateInstance(typeof(double), lengthsTileNumberArray);
     this.maxDiffArray = Array.CreateInstance(typeof(double), lengthsTileNumberArray);
 }
Example #3
0
 static void Main(string[] args)
 {
     // IMPORTANT NOTE:
     //     please check the Debug or Release folder contains lpsolve55.dll and build on x86 platform.
     IndexTransformator transformator = new IndexTransformator();
     InputParser inputParser = new InputParser(transformator);
     BinsCreator binsCreator = new BinsCreator(transformator);
     LPModelFileCreator lpModelFileCreator = new LPModelFileCreator();
     LPSolver lpSolver = new LPSolver();
     int serverNO;
     int pointNO;
     double delta;
     int spaceDimension;
     int histogramResolution;
     Array array;
     int[] binHefts;
     int binNO;
     double explicitLimit;
     binCreationPhase(inputParser, binsCreator, out serverNO, out pointNO, out delta, out spaceDimension,
         out histogramResolution, out array, out binHefts, out binNO, out explicitLimit);
     lpProblemPhase(inputParser, serverNO, pointNO, delta, binNO, binHefts, explicitLimit, lpModelFileCreator, lpSolver);
     Console.WriteLine("Press any key to exit!");
     Console.Read();
 }
 public BinsCreator(IndexTransformator transformator)
 {
     this.transformator = transformator;
 }
Example #5
0
 static void Main(string[] args)
 {
     // IMPORTANT NOTE:
     //     please check the Debug or Release folder contains lpsolve55.dll and build on x86 platform.
     IndexTransformator transformator = new IndexTransformator();
     InputParser inputParser = new InputParser(transformator);
     HeftArrayCreator heftArrayCreator = new HeftArrayCreator(transformator);
     int serverNO;
     int pointNO;
     double delta;
     int neededTileNumber;
     int[] tiles;
     //try
     //{
         arrayPartitionPhase(transformator, inputParser, heftArrayCreator,
         out serverNO, out pointNO, out delta, out neededTileNumber, out tiles);
         LPModelFileCreator lpModelFileCreator = new LPModelFileCreator();
         LPSolver lpSolver = new LPSolver();
         lpProblemPhase(inputParser, serverNO, pointNO, delta, neededTileNumber, tiles,
             lpModelFileCreator, lpSolver);
     //}
     //catch (Exception ex)
     //{
     //    Console.WriteLine("ERROR: " + ex.Message);
     //}
     Console.WriteLine("Press any key to exit!");
     Console.Read();
 }
 public InputParser(IndexTransformator transformator)
 {
     this.transformator = transformator;
 }
 public HeftArrayCreator(IndexTransformator transformator)
 {
     this.transformator = transformator;
 }