示例#1
0
        public IActionResult GenerateRandomState(int dim, int populationSize, int elitism, int crossoverProb, int mutationProb, int nmbrGenerations)
        {
            int[][] Array = (_IFunctions.GenerateArray(dim));

            GeneticVM VM = new GeneticVM()
            {
                array           = _IFunctions.array2Dto1D(Array, dim),
                dimension       = dim,
                heuristic       = _IFunctions.Heuristic(Array, dim),
                crossoverProb   = crossoverProb,
                elitism         = elitism,
                mutationProb    = mutationProb,
                nmbrGenerations = nmbrGenerations,
                populationSize  = populationSize,
                dimensions      = new List <SelectListItem>()
                {
                    new SelectListItem {
                        Text = "4x4", Value = "4"
                    },
                    new SelectListItem {
                        Text = "5x5", Value = "5"
                    },
                    new SelectListItem {
                        Text = "6x6", Value = "6"
                    },
                    new SelectListItem {
                        Text = "7x7", Value = "7"
                    },
                    new SelectListItem {
                        Text = "8x8", Value = "8"
                    },
                    new SelectListItem {
                        Text = "9x9", Value = "9"
                    },
                    new SelectListItem {
                        Text = "10x10", Value = "10"
                    },
                    new SelectListItem {
                        Text = "11x11", Value = "11"
                    },
                    new SelectListItem {
                        Text = "12x12", Value = "12"
                    },
                }
            };

            return(View("Index", VM));
        }
        public IActionResult GenerateRandomState(int dim, int states, int maxCounter)
        {
            int[][] array = _IFunctions.GenerateArray(dim);

            LocalBeamSearchVM VM = new LocalBeamSearchVM()
            {
                array      = _IFunctions.array2Dto1D(array, dim),
                dimension  = dim,
                heuristic  = _IFunctions.Heuristic(array, dim),
                nmbrStates = states,
                maxCounter = maxCounter,
                dimensions = new List <SelectListItem>()
                {
                    new SelectListItem {
                        Text = "4x4", Value = "4"
                    },
                    new SelectListItem {
                        Text = "5x5", Value = "5"
                    },
                    new SelectListItem {
                        Text = "6x6", Value = "6"
                    },
                    new SelectListItem {
                        Text = "7x7", Value = "7"
                    },
                    new SelectListItem {
                        Text = "8x8", Value = "8"
                    },
                    new SelectListItem {
                        Text = "9x9", Value = "9"
                    },
                    new SelectListItem {
                        Text = "10x10", Value = "10"
                    },
                    new SelectListItem {
                        Text = "11x11", Value = "11"
                    },
                    new SelectListItem {
                        Text = "12x12", Value = "12"
                    },
                },
            };

            return(View("Index", VM));
        }
        public IActionResult GenerateRandomState(int dim, int T0, int coolingFactor)
        {
            int[][]             array = _IFunctions.GenerateArray(dim);
            SimulatedAnealingVM VM    = new SimulatedAnealingVM()
            {
                array         = _IFunctions.array2Dto1D(array, dim),
                dimension     = dim,
                heuristic     = _IFunctions.Heuristic(array, dim),
                T0            = T0,
                coolingFactor = coolingFactor,
                dimensions    = new List <SelectListItem>()
                {
                    new SelectListItem {
                        Text = "4x4", Value = "4"
                    },
                    new SelectListItem {
                        Text = "5x5", Value = "5"
                    },
                    new SelectListItem {
                        Text = "6x6", Value = "6"
                    },
                    new SelectListItem {
                        Text = "7x7", Value = "7"
                    },
                    new SelectListItem {
                        Text = "8x8", Value = "8"
                    },
                    new SelectListItem {
                        Text = "9x9", Value = "9"
                    },
                    new SelectListItem {
                        Text = "10x10", Value = "10"
                    },
                    new SelectListItem {
                        Text = "11x11", Value = "11"
                    },
                    new SelectListItem {
                        Text = "12x12", Value = "12"
                    },
                }
            };

            return(View("Index", VM));
        }
        public IActionResult GenerateRandomState(int dim, int stepsInSameState)
        {
            int[][] array = _IFunctions.GenerateArray(dim); //Generates random state

            HillClimbingVM VM = new HillClimbingVM()
            {
                array            = _IFunctions.array2Dto1D(array, dim),
                dimension        = dim,
                heuristic        = _IFunctions.Heuristic(array, dim), //Heuristic function calculates heuristic of this array
                stepsInSameState = stepsInSameState,
                dimensions       = new List <SelectListItem>()
                {
                    new SelectListItem {
                        Text = "4x4", Value = "4"
                    },
                    new SelectListItem {
                        Text = "5x5", Value = "5"
                    },
                    new SelectListItem {
                        Text = "6x6", Value = "6"
                    },
                    new SelectListItem {
                        Text = "7x7", Value = "7"
                    },
                    new SelectListItem {
                        Text = "8x8", Value = "8"
                    },
                    new SelectListItem {
                        Text = "9x9", Value = "9"
                    },
                    new SelectListItem {
                        Text = "10x10", Value = "10"
                    },
                    new SelectListItem {
                        Text = "11x11", Value = "11"
                    },
                    new SelectListItem {
                        Text = "12x12", Value = "12"
                    },
                },
            };

            return(View("Index", VM));
        }