Esempio n. 1
0
        private void InitSimulation()
        {
            v            = new Visualization(dimX, canvas, polytope);
            v.DrawPoints = drawPts;

            switch (polytope)
            {
            case Polytope.Simplex:
                d0             = Simplex.GenerateDistanceMatrix(dimX);
                minimalization = new GradientDescent(d0, alpha, Simplex.GetVerticesCount(dimX));
                //minimalization = new SimulatedAnnealing(1000, Simplex.GetVerticesCount(dimX), d0, dimY);
                break;

            case Polytope.Hypercube:
                d0             = Hypercube.GenerateDistanceMatrix(dimX);
                minimalization = new GradientDescent(d0, alpha, Hypercube.GetVerticesCount(dimX));
                //minimalization = new SimulatedAnnealing(1000, Hypercube.GetVerticesCount(dimX), d0, dimY);
                break;

            default:
                break;
            }

            mds = new MDS(MDS.EuclideanDistance, MDS.KruskalStress, minimalization);

            s = mds.InitPos();
            stressDisplay.Text = s.GetValue().ToString();
            DrawSolution(s, zoom);

            iterationDisplay.Text = "0";
        }
Esempio n. 2
0
        private void ResetSimulation(object sender, RoutedEventArgs e)
        {
            // Stop simulation
            simulationInProgress = false;
            timer.Stop();
            startButton.Content = "Start";

            // Clear canvas
            if (v != null)
            {
                v.Clear();
            }

            mds            = null;
            s              = null;
            v              = null;
            minimalization = null;

            // Reset simulation
            InitSimulation();

            // Unblock Controls
            ToggleControlsClear(false);

            ToggleControlsSimulation(false);
        }