示例#1
0
 GTreeOverlapRemoval(OverlapRemovalSettings settings, Node[] nodes, Size[] sizes)
 {
     _overlapForLayers = true;
     _settings         = settings;
     _sizes            = sizes;
     _nodes            = nodes;
 }
 /// <summary>
 /// Removes the overlap by using the default settings.
 /// </summary>
 /// <param name="nodes"></param>
 /// <param name="nodeSeparation"></param>
 public static void RemoveOverlaps(Node[] nodes, double nodeSeparation) {
     var settings = new OverlapRemovalSettings {
         RandomizeAllPointsOnStart = true,
         NodeSeparation = nodeSeparation
     };
     var mst = new OverlapRemoval(settings, nodes);
     mst.RemoveOverlaps();
 }
        public static void RemoveOverlapsForLayers(Node[] nodes, Size[] sizesOnLayers)
        {
            var settings = new OverlapRemovalSettings
            {
                RandomizeAllPointsOnStart = true,
            };
            var mst = new GTreeOverlapRemoval(settings, nodes, sizesOnLayers);

            mst.RemoveOverlaps();
        }
        /// <summary>
        /// Removes the overlap by using the default settings.
        /// </summary>
        /// <param name="nodes"></param>
        /// <param name="nodeSeparation"></param>
        public static void RemoveOverlaps(Node[] nodes, double nodeSeparation)
        {
            var settings = new OverlapRemovalSettings {
                RandomizeAllPointsOnStart = true,
                NodeSeparation            = nodeSeparation
            };
            var mst = new GTreeOverlapRemoval(settings, nodes);

            mst.RemoveOverlaps();
        }
        /// <summary>
        /// Removes the overlap with default settings.
        /// </summary>
        /// <param name="graph"></param>
        /// <param name="nodeSeparation"></param>
        public static void RemoveOverlaps(GeometryGraph graph, double nodeSeparation)
        {
            var settings = new OverlapRemovalSettings {
                RandomizeAllPointsOnStart = true,
                NodeSeparation            = nodeSeparation
            };
            var mst = new OverlapRemoval(settings);

            mst.RemoveOverlap(graph);
        }
示例#6
0
 private IOverlapRemoval GetOverlapRemover(OverlapRemovalSettings settings, GeometryGraph geomGraph)
 {
     if (settings.Method == OverlapRemovalMethod.MinimalSpanningTree)
     {
         return(new OverlapRemoval(settings, geomGraph.Nodes.ToArray()));
     }
     else if (settings.Method == OverlapRemovalMethod.Prism)
     {
         return(new ProximityOverlapRemoval(settings, geomGraph));
     }
     return(null);
 }
 private IOverlapRemoval GetOverlapRemover(OverlapRemovalSettings settings)
 {
     if (settings.Method == OverlapRemovalMethod.Pmst)
     {
         return(new OverlapRemoval(settings));
     }
     else if (settings.Method == OverlapRemovalMethod.Prism)
     {
         return(new ProximityOverlapRemoval(settings));
     }
     return(null);
 }
示例#8
0
        /// <summary>
        /// List of the settings for which the comparison should be made.
        /// </summary>
        /// <returns></returns>
        public static List <Tuple <String, OverlapRemovalSettings> > CollectionOverlapRemovalMethods()
        {
            List <Tuple <String, OverlapRemovalSettings> > testList = new List <Tuple <String, OverlapRemovalSettings> >();

            //set OverlapRemovalSettings so that we can be sure that the wanted parameters are used.
            OverlapRemovalSettings settings = new OverlapRemovalSettings();

            settings.Method                    = OverlapRemovalMethod.Prism;
            settings.Epsilon                   = 1E-6;
            settings.IterationsMax             = 1000;
            settings.StopOnMaxIterat           = false;
            settings.NodeSeparation            = 4;
            settings.RandomizationSeed         = 21;
            settings.InitialScaling            = InitialScaling.None;
            settings.WorkInInches              = false;
            settings.RandomizeAllPointsOnStart = false;
            settings.RandomizationSeed         = 10;

            settings.StressSettings.MaxStressIterations        = 27;
            settings.StressSettings.SolvingMethod              = SolvingMethod.PrecondConjugateGradient;
            settings.StressSettings.UpdateMethod               = UpdateMethod.Parallel;
            settings.StressSettings.StressChangeTolerance      = 10E-4;
            settings.StressSettings.CancelOnStressConvergence  = true;
            settings.StressSettings.CancelOnStressMaxIteration = true;
            settings.StressSettings.Parallelize           = false;
            settings.StressSettings.SolverMaxIteratMethod = MaxIterationMethod.SqrtProblemSize;
            //relevant for conjugate gradient methods only
            settings.StressSettings.ResidualTolerance         = 0.01;
            settings.StressSettings.CancelAfterFirstConjugate = true;

            testList.Add(Tuple.Create("PRISM-CG", settings)); //prism +precond. conjugate gradient

            settings = settings.Clone();
            settings.StressSettings.SolverMaxIteratMethod = MaxIterationMethod.LinearProblemSize;
            settings.StressSettings.ResidualTolerance     = 0.01;
            settings.StressSettings.SolvingMethod         = SolvingMethod.PrecondConjugateGradient;
//            testList.Add(Tuple.Create("PRISM-CG-2", settings));

            //settings = settings.Clone();
            //settings.StressSettings.MaxStressIterations = 15;
            //settings.StressSettings.SolvingMethod = SolvingMethod.Localized;
            //testList.Add(Tuple.Create("PRISM-LM",settings));

            settings        = settings.Clone();
            settings.Method = OverlapRemovalMethod.MinimalSpanningTree;
            testList.Add(Tuple.Create("GTree", settings));

            return(testList);
        }
 void IOverlapRemoval.Settings(OverlapRemovalSettings settings) {
     _settings = settings;
 }
 void IOverlapRemoval.Settings(OverlapRemovalSettings settings)
 {
     _settings = settings;
 }
 /// <summary>
 /// Settings to be used for the overlap removal, not all of them are used.
 /// </summary>
 /// <param name="settings"></param>
 /// <param name="nodes">the array of nodes to remover overlaps on</param>
 public GTreeOverlapRemoval(OverlapRemovalSettings settings, Node[]  nodes)
 {
     _settings = settings;
     _nodes    = nodes;
 }
示例#12
0
        private ProximityOverlapRemoval RunOverlapRemoval(GeometryGraph graphCopy, GeometryGraph graphOriginal, HashSet <Tuple <int, int> > proximityEdges,
                                                          HashSet <Tuple <int, int, int> > proximityTriangles, List <Tuple <string, double> > statistics, OverlapRemovalSettings settings)
        {
            ProximityOverlapRemoval prism = new ProximityOverlapRemoval(graphCopy);

            prism.Settings = settings;
            Timer timer = new Timer();

            timer.Start();
            prism.RemoveOverlaps();
            timer.Stop();
            var cpuTimeSpan    = TimeSpan.FromSeconds(timer.Duration);
            var statCpuTime    = Tuple.Create("CPUTime", cpuTimeSpan.TotalSeconds);
            var statIterations = Tuple.Create("Iterations", (double)prism.LastRunIterations);

            var statEdgeLength = Statistics.Statistics.EdgeLengthDeviation(graphOriginal, graphCopy, proximityEdges);
            var statProcrustes =
                Statistics.Statistics.ProcrustesStatistics(graphOriginal.Nodes.Select(v => v.Center).ToList(),
                                                           graphCopy.Nodes.Select(v => v.Center).ToList());
            var statTriangleOrient = Statistics.Statistics.TriangleOrientation(graphOriginal, graphCopy, proximityTriangles);
            var statArea           = Statistics.Statistics.Area(graphCopy);


            statistics.Add(statCpuTime);
            statistics.Add(statIterations);
            statistics.Add(statEdgeLength);
            statistics.Add(statProcrustes);
            statistics.Add(statArea);
            statistics.Add(statTriangleOrient);
            return(prism);
        }
 public static void RemoveOverlapsForLayers(Node[] nodes, Size[] sizesOnLayers) {
     var settings = new OverlapRemovalSettings
     {
         RandomizeAllPointsOnStart = true,
     };
     var mst = new OverlapRemoval(settings, nodes, sizesOnLayers);
     mst.RemoveOverlaps();
 }
 private IOverlapRemoval GetOverlapRemover(OverlapRemovalSettings settings, GeometryGraph geomGraph)
 {
     return(new GTreeOverlapRemoval(settings, geomGraph.Nodes.ToArray()));
 }
 OverlapRemoval(OverlapRemovalSettings settings, Node[] nodes, Size[] sizes) {
     _overlapForLayers = true;
     _settings = settings;
     _sizes = sizes;
     _nodes = nodes;
 }
 /// <summary>
 /// Settings to be used for the overlap removal, not all of them are used.
 /// </summary>
 /// <param name="settings"></param>
 /// <param name="nodes">the array of nodes to remover overlaps on</param>
 public OverlapRemoval(OverlapRemovalSettings settings, Node[]  nodes) {
     _settings = settings;
     _nodes = nodes;
 }
 /// <summary>
 /// Settings to be used for the overlap removal, not all of them are used.
 /// </summary>
 /// <param name="settings"></param>
 public OverlapRemoval(OverlapRemovalSettings settings)
 {
     Settings = settings;
 }