public string BuildTripByRegion(int regionId)
        {
            using (diplomaDBContext = new DiplomaDBContext())
            {
                //var containers = diplomaDBContext.Container.Where(c => c.RegionId == regionId).Where(c => c.Full).ToArray();
                var containers = diplomaDBContext.Container.Where(c => c.RegionId == regionId).ToArray();

                GA_TSP tsp = new GA_TSP(containers);
                tsp.Initialization();
                var indexes = tsp.TSPCompute();

                var tripContainers = new List <Container>();

                string containerIndexes = "[ ";

                for (int i = 0; i < indexes.Length; i++)
                {
                    tripContainers.Add(containers[indexes[i]]);
                    containerIndexes += indexes[i].ToString() + ", ";
                }

                containerIndexes += "]";

                return(containerIndexes);
            }
        }
Ejemplo n.º 2
0
        public string Index()
        {
            GA_TSP tsp = new GA_TSP();

            tsp.Initialization();
            tsp.TSPCompute();

            return("success");
        }