Exemplo n.º 1
0
        protected List <Tuple <Route, double> > SolveRestrictedMasterProblem(string folderPath, string coveringPath, List <ExtRouteInfo> currentPool)
        {
            ColumnSelectionGAMS           gamsProcedure     = new ColumnSelectionGAMS(ProblemData);
            DirectoryInfo                 coveringDir       = Directory.CreateDirectory(folderPath).CreateSubdirectory(coveringPath);
            List <Tuple <Route, double> > coveringSelection = gamsProcedure.Solve(coveringDir.FullName, currentPool);

            for (int i = 0; i < coveringSelection.Count; i++)
            {
                coveringSelection[i].Item1.ToXMLFormat().Save(Path.Combine(coveringDir.FullName, string.Format("r={0} s={1}.xml", i, coveringSelection[i].Item2)));
            }

            return(coveringSelection);
        }
        private RouteSet Solve <TProcedure, TParameters>(double overloadFactor, int shakings, Exploration expCondition, Random rdObj, List <Func <RouteSet, Exploration, Random, RouteSet> > neighborhoods, List <Func <RouteSet, Random, RouteSet> > shakingProcedures, string gamsFolderPath, TProcedure procedure, TParameters parameters, List <RouteSet> initialPool) where TProcedure : LocalSearchProcedure <RouteSet, TParameters>
        {
            List <RouteSet> solutionPool = BuildSolutionPool(overloadFactor, shakings, expCondition, rdObj, neighborhoods, shakingProcedures, procedure, parameters, initialPool);

            Console.WriteLine("solution pool {0}", solutionPool.Count);
            List <ExtRouteInfo> routesPool = BuildRoutePool(solutionPool, overloadFactor, gamsFolderPath);

            Console.WriteLine("routes pool {0}", routesPool.Count);
            ColumnSelectionGAMS gamsProcedure = new ColumnSelectionGAMS(ProblemData);
            List <Route>        selected      = gamsProcedure.Solve(gamsFolderPath, routesPool);

            for (int i = 0; i < selected.Count; i++)
            {
                selected[i].ToXMLFormat().Save(Path.Combine(gamsFolderPath, string.Format("overlapping{0}.xml", i)));
            }
            return(BuildSolution(selected));
        }