示例#1
0
        public DietController(RequirementsProvider requirementsProvider, NsgaSolverFactory nsgaSolverFactory, IRecipeProvider recipeProvider)
        {
            _requirementsProvider = requirementsProvider;
            _nsgaSolverFactory    = nsgaSolverFactory;
            _recipeProvider       = recipeProvider;

            RInvoker.Path = HostingEnvironment.MapPath(@"~/Content");
        }
示例#2
0
        private static NsgaResult RunConfiguration(Configuration configuration, List <Recipe> recipes, List <PersonalData> personalData)
        {
            var nsgaFactory = new NsgaSolverFactory(new Random());

            var solver = nsgaFactory.GetGroupDietSolver(recipes, personalData, configuration);

            return(solver.Solve());
        }
示例#3
0
        static void Main(string[] args)
        {
            var nsgaFactory   = new NsgaSolverFactory(new Random());
            var configuration = new ConfigurationProvider().GetConfiguration();

            configuration.PopulationSize = 300;
            configuration.MaxIterations  = 400;

            var mathSolver = nsgaFactory.GetMathSolver(configuration);

            var result = mathSolver.Solve();

            CsvLogger.RegisterLogger("math");

            foreach (var res in result.Fronts.First().Select(i => i.Evaluations))
            {
                CsvLogger.AddRow("math", new dynamic[] { res[0].Score, res[1].Score });
            }

            CsvLogger.Write("math", "math.csv");

            Console.WriteLine("done");
        }