コード例 #1
0
 /// <summary>
 /// Strong Construction
 /// </summary>
 /// <param name="controller">Controller/Owner</param>
 public RoomAnalysis(SolverController controller)
 {
     this.controller = controller;
     doors = new List<Door>();
     rooms = new List<Room>();
     doorBitmap = new SolverBitmap("Doors", controller.Map.Size);
 }
コード例 #2
0
        public void Test_NotReducedWithLimitations()
        {
            double[] expectedSolution = new double[]
            {
                1.0000000000000009,
                1,
                0.9999999999999994,
                1,
                0.9999999999999996,
                1,
                -6.000000000000001
            };
            Result expected = new Result(expectedSolution, false);

            #region Init Params
            int      count = 7;
            double[] Ii    = { 1, 1, 1, 1, 1, 1, 1 };
            double[] w     = { 0.2, 0.121, 0.683, 0.04, 0.102, 0.081, 0.02 };
            double[] d     =
            {
                10.0054919341489,
                3.03265795024749,
                6.83122010827837,
                1.98478460320379,
                5.09293357450987,
                4.05721328676762,
                0.991215230484718
            };
            double[]   b = { 0, 0, 0 };
            double[][] A =
            {
                new double[] { 1, 1, 1,  1,  1,  1,  1 },
                new double[] { 0, 0, 1, -1, -1,  0,  0 },
                new double[] { 0, 0, 0,  0,  1, -1, -1 }
            };

            Limitation[] limitations = new Limitation[]
            {
                new Limitation(1, 1),
                new Limitation(1, 1),
                new Limitation(1, 1),
                new Limitation(1, 1),
                new Limitation(1, 1),
                new Limitation(1, 1),
                new Limitation(1, 1),
            };

            ForSolver data = new ForSolver(count, Ii, w, d, b, A, null, limitations);
            #endregion

            SolverController controller = new SolverController();
            Result           res        = controller.Solve(data);

            Assert.AreEqual(expected.reduced, res.reduced);
            Assert.That(expected.solution, Is.EqualTo(res.solution).Within(0.1));
        }
コード例 #3
0
        public ArenaItem()
        {
            InitializeComponent();
            InitializeComponent2();

            // Create a SolverController.
            this.solverController = new SolverController(
                this as IMazeForm,
                this.MazeUserControl.MazePainter,
                this.visitedProgressBar as ProgressBar
                );
        }
コード例 #4
0
        public void Test_ReducedExtra()
        {
            double[] expectedSolution = new double[]
            {
                8.24701040395792,
                0.8247010403957922,
                7.422309363562128,
                2.0877220059143995,
                5.334587357647728,
                4.326928579374164,
                1.007658778273564
            };
            Result expected = new Result(expectedSolution, true);

            #region Init Params
            int      count = 7;
            double[] Ii    = { 1, 1, 1, 1, 1, 1, 1 };
            double[] w     = { 0.2, 0.121, 0.683, 0.04, 0.102, 0.081, 0.02 };
            double[] d     =
            {
                10.0054919341489,
                3.03265795024749,
                6.83122010827837,
                1.98478460320379,
                5.09293357450987,
                4.05721328676762,
                0.991215230484718
            };
            double[]   b = { 0, 0, 0 };
            double[][] A =
            {
                new double[] { 1, -1, -1,  0,  0,  0,  0 },
                new double[] { 0,  0,  1, -1, -1,  0,  0 },
                new double[] { 0,  0,  0,  0,  1, -1, -1 }
            };

            double[][] extra = new double[][]
            {
                new double[] { 1, -10, 0, 0, 0, 0, 0 },
            };

            ForSolver data = new ForSolver(count, Ii, w, d, b, A, extra);
            #endregion

            SolverController controller = new SolverController();
            Result           res        = controller.Solve(data);

            Assert.AreEqual(expected.reduced, res.reduced);
            Assert.That(expected.solution, Is.EqualTo(res.solution).Within(0.1));
        }
コード例 #5
0
        public void Test_Reduced()
        {
            double[] expectedSolution = new double[]
            {
                10.055562924869308,
                3.0143307158690513,
                7.041232209000256,
                1.9820614478522982,
                5.059170761147956,
                4.067338249014302,
                0.9918325121336546
            };
            Result expected = new Result(expectedSolution, true);

            #region Init Params
            int      count = 7;
            double[] Ii    = { 1, 1, 1, 1, 1, 1, 1 };
            double[] w     = { 0.2, 0.121, 0.683, 0.04, 0.102, 0.081, 0.02 };
            double[] d     =
            {
                10.0054919341489,
                3.03265795024749,
                6.83122010827837,
                1.98478460320379,
                5.09293357450987,
                4.05721328676762,
                0.991215230484718
            };
            double[]   b = { 0, 0, 0 };
            double[][] A =
            {
                new double[] { 1, -1, -1,  0,  0,  0,  0 },
                new double[] { 0,  0,  1, -1, -1,  0,  0 },
                new double[] { 0,  0,  0,  0,  1, -1, -1 }
            };

            ForSolver data = new ForSolver(count, Ii, w, d, b, A);
            #endregion

            SolverController controller = new SolverController();
            Result           res        = controller.Solve(data);

            Assert.AreEqual(expected.reduced, res.reduced);
            Assert.That(expected.solution, Is.EqualTo(res.solution).Within(0.1));
        }
コード例 #6
0
        public void Test_SecondFlowEqual0()
        {
            double[] expectedSolution = new double[]
            {
                -3.6696413861578048,
                -1.9727827233177697,
                0,
                1.4377792703915215,
                1.5360313978980966,
                1.814149543904313,
                0.8544638972816511
            };
            Result expected = new Result(expectedSolution, true);

            #region Init Params
            int      count = 7;
            double[] Ii    = { 1, 1, 1, 1, 1, 1, 1 };
            double[] w     = { 0.2, 0.121, 0.683, 0.04, 0.102, 0.081, 0.02 };
            double[] d     =
            {
                10.0054919341489,
                3.03265795024749,
                6.83122010827837,
                1.98478460320379,
                5.09293357450987,
                4.05721328676762,
                0.991215230484718
            };
            double[]   b = { 0, 0, 0 };
            double[][] A =
            {
                new double[] { 1, 1,  1, 1, 1, 1, 1 },
                new double[] { 1, 1, -1, 1, 1, 1, 1 },
                new double[] { 1, 1,  1, 1, 1, 1, 1 }
            };

            ForSolver data = new ForSolver(count, Ii, w, d, b, A);
            #endregion

            SolverController controller = new SolverController();
            Result           res        = controller.Solve(data);

            Assert.AreEqual(expected.reduced, res.reduced);
            Assert.That(expected.solution, Is.EqualTo(res.solution).Within(0.1));
        }
コード例 #7
0
        public void Test_Reduced2()
        {
            double[] expectedSolution = new double[]
            {
                0.19999999999999718,
                1.0000000000000002,
                1.1999999999999977,
                3,
                1.8000000000000027,
                0.9954492440018422,
                0.8045507559981595,
            };
            Result expected = new Result(expectedSolution, true);

            #region Init Params
            int      count = 7;
            double[] Ii    = { 1, 1, 1, 1, 1, 1, 1 };
            double[] w     = { 0.2, 0.121, 0.683, 0.04, 0.102, 0.081, 0.02 };
            double[] d     =
            {
                10.0054919341489,
                3.03265795024749,
                6.83122010827837,
                1.98478460320379,
                5.09293357450987,
                4.05721328676762,
                0.991215230484718
            };
            double[]   b = { 0, 0, 0 };
            double[][] A =
            {
                new double[] { 1, 1, -1,  0, 0,  0,  0 },
                new double[] { 0, 0,  1, -1, 1,  0,  0 },
                new double[] { 0, 0,  0,  0, 1, -1, -1 }
            };

            double[][] extra = new double[][]
            {
                new double[] { -5, 1, 0, 0, 0, 0, 0 },
            };

            Limitation[] limitations = new Limitation[]
            {
                new Limitation(0, 100),
                new Limitation(1, 1),
                new Limitation(0, 100),
                new Limitation(3, 3),
                new Limitation(0, 100),
                new Limitation(0, 100),
                new Limitation(0, 100),
            };

            ForSolver data = new ForSolver(count, Ii, w, d, b, A, extra, limitations);
            #endregion

            SolverController controller = new SolverController();
            Result           res        = controller.Solve(data);

            Assert.AreEqual(expected.reduced, res.reduced);
            Assert.That(expected.solution, Is.EqualTo(res.solution).Within(0.1));
        }
コード例 #8
0
        public void Test_ReducedExtraLimitations()
        {
            double[] expectedSolution = new double[]
            {
                20.00000000000001,
                2,
                18.000000000000014,
                5.020578731317562,
                12.979421268682454,
                11.532467336779543,
                1.4469539319029119
            };
            Result expected = new Result(expectedSolution, true);

            #region Init Params
            int      count = 7;
            double[] Ii    = { 1, 1, 1, 1, 1, 1, 1 };
            double[] w     = { 0.2, 0.121, 0.683, 0.04, 0.102, 0.081, 0.02 };
            double[] d     =
            {
                10.0054919341489,
                3.03265795024749,
                6.83122010827837,
                1.98478460320379,
                5.09293357450987,
                4.05721328676762,
                0.991215230484718
            };
            double[]   b = { 0, 0, 0 };
            double[][] A =
            {
                new double[] { 1, -1, -1,  0,  0,  0,  0 },
                new double[] { 0,  0,  1, -1, -1,  0,  0 },
                new double[] { 0,  0,  0,  0,  1, -1, -1 }
            };

            double[][] extra = new double[][]
            {
                new double[] { 1, -10, 0, 0, 0, 0, 0 },
            };

            Limitation[] limitations = new Limitation[]
            {
                new Limitation(1, 100),
                new Limitation(2, 100),
                new Limitation(3, 100),
                new Limitation(4, 100),
                new Limitation(-3, 100),
                new Limitation(-2, 100),
                new Limitation(-1, 100),
            };

            ForSolver data = new ForSolver(count, Ii, w, d, b, A, extra, limitations);
            #endregion

            SolverController controller = new SolverController();
            Result           res        = controller.Solve(data);

            Assert.AreEqual(expected.reduced, res.reduced);
            Assert.That(expected.solution, Is.EqualTo(res.solution).Within(0.1));
        }
コード例 #9
0
ファイル: OptionsDialog.cs プロジェクト: wacker-muc/Ariadne
        /// <summary>
        /// Add a tool tip text to all controls.
        /// </summary>
        private void InitializeToolTip()
        {
            #region General

            toolTip.SetToolTip(checkBoxDetailsBox, string.Join("\n", new string[] {
                "If selected, the screen saver will display a window ",
                "with information on the current maze solver and ",
                "run-time statistics."
            }));
            toolTip.SetToolTip(checkBoxBlinking, string.Join("\n", new string[] {
                "If selected, the end point of the solution path is ",
                "displayed as a blinking square."
            }));
            toolTip.SetToolTip(checkBoxEfficientSolvers, string.Join("\n", new string[] {
                "If selected, the maze solver strategies may detect ",
                "areas (dead ends) that are completely surrounded ",
                "and will not lead to the target square."
            }));
            toolTip.SetToolTip(textBoxStepsPerSecond, string.Join("\n", new string[] {
                "Speed of the solver algorithm. Reasonable values are ",
                "50 (very slow) to 800 (very fast)."
            }));
            toolTip.SetToolTip(checkBoxLogSolverStatistics, string.Join("\n", new string[] {
                "If selected, for each solver run one line of run-time ",
                "statistics is written to a log file in the application ",
                "directory:",
                SolverController.SolverLogPath()
            }));

            toolTip.SetToolTip(labelStepsPerSecond, toolTip.GetToolTip(textBoxStepsPerSecond));

            #endregion

            #region Images

            toolTip.SetToolTip(imageNumberNumericUpDown, string.Join("\n", new string[] {
                "Number of (foreground) images that should be displayed ",
                "in the screen saver (provided there is enough room)."
            }));
            toolTip.SetToolTip(imageMinSizeNumericUpDown, string.Join("\n", new string[] {
                "When an image needs to be reduced in size (because ",
                "it is larger than " + labelImagesMaxSize.Text + "), this is the minimum size it ",
                "will be scaled to.",
                "Note: The images will not be enlarged, even if they ",
                "are smaller than " + labelImagesMinSize.Text + "."
            }));
            toolTip.SetToolTip(imageMaxSizeNumericUpDown, string.Join("\n", new string[] {
                "Images that are larger than " + labelImagesMaxSize.Text + " (in width or ",
                "height) will be reduced in size."
            }));
            toolTip.SetToolTip(labelImagesMinSizePct, string.Join("\n", new string[] {
                "Image sizes are specified as a percentage of the screen dimension."
            }));
            toolTip.SetToolTip(imageFolderTextBox, string.Join("\n", new string[] {
                "Path to a directory with images (JPG, PNG, GIF) that ",
                "will be displayed in the screen saver. Images will ",
                "also be searched in all subdirectories."
            }));

            toolTip.SetToolTip(labelImagesNumber, toolTip.GetToolTip(imageNumberNumericUpDown));
            toolTip.SetToolTip(labelImagesMinSize, toolTip.GetToolTip(imageMinSizeNumericUpDown));
            toolTip.SetToolTip(labelImagesMaxSize, toolTip.GetToolTip(imageMaxSizeNumericUpDown));
            toolTip.SetToolTip(labelImagesMaxSizePct, toolTip.GetToolTip(labelImagesMinSizePct));
            toolTip.SetToolTip(selectImageFolderButton, toolTip.GetToolTip(imageFolderTextBox));

            #endregion

            #region Background

            toolTip.SetToolTip(checkBoxBackgroundImage, string.Join("\n", new string[] {
                "If selected, a background image will be displayed ",
                "behind the maze.  The image is initially hidden and ",
                "slowly uncovered as the solver passes over it."
            }));
            toolTip.SetToolTip(checkBoxDifferentBackgroundImageFolder, string.Join("\n", new string[] {
                "When selected, you may choose a background image folder. ",
                "Otherwise, background and foreground images are ",
                "selected from the same folder."
            }));
            toolTip.SetToolTip(backgroundImageFolderTextBox, string.Join("\n", new string[] {
                "Path to a directory (including its subdirectories) ",
                "with images (JPG, PNG, GIF) that will be displayed ",
                "as screen saver background images."
            }));
            toolTip.SetToolTip(subtractImagesBackgroundCheckBox, string.Join("\n", new string[] {
                "If selected and an image has a uniformly colored ",
                "background (e.g. all white or all black), the area ",
                "that this image covers on the maze is reduced to ",
                "an outline shape."
            }));

            toolTip.SetToolTip(selectBackgroundImageFolderButton, toolTip.GetToolTip(backgroundImageFolderTextBox));

            #endregion

            #region Extras

            toolTip.SetToolTip(checkBoxPaintAllWalls, string.Join("\n", new string[] {
                "If selected, the screen saver will always paint a complete ",
                "maze. Otherwise, it may also paint walls only along the ",
                "examined path or paint no walls at all (which provides ",
                "for a larger number of squares)."
            }));
            toolTip.SetToolTip(checkBoxOutlineShapes, string.Join("\n", new string[] {
                "If selected, certain continuous walls may be built ",
                "around the outline of natural or geometrical shapes. ",
                "Some shapes are easily recognizable and others are not."
            }));
            toolTip.SetToolTip(checkBoxIrregularMazes, string.Join("\n", new string[] {
                "If selected, the maze paths may follow certain ",
                "preferred patterns. Otherwise, all mazes are ",
                "uniformly random."
            }));
            toolTip.SetToolTip(checkBoxMultipleMazes, string.Join("\n", new string[] {
                "If selected, an outline shape (see above) may ",
                "contain a second separate maze that is solved ",
                "independently of the main maze."
            }));
            toolTip.SetToolTip(imageBackgroundFuzzinessNumericUpDown, string.Join("\n", new string[] {
                "Determines how much of a uniform background ",
                "is substracted from an image. Higher values ",
                "result in a smaller remaining image area."
            }));

            toolTip.SetToolTip(labelImageFuzziness, toolTip.GetToolTip(imageBackgroundFuzzinessNumericUpDown));

            #endregion
        }
コード例 #10
0
 /// <summary>
 /// Strong Construction
 /// </summary>
 /// <param name="controller"></param>
 public StaticAnalysis(SolverController controller)
 {
     this.controller = controller;
 }