Пример #1
0
        static void Main(string[] args)
        {
            var description = new ModelDescription();

            description.AddLayer <ForestLayer>();
            description.AddAgent <Deer, ForestLayer>();
            description.AddAgent <Wolf, ForestLayer>();
        }
Пример #2
0
    private static ModelDescription GetModelDescription()
    {
        ModelDescription description = new ModelDescription();

        description.AddLayer <Terrain>();
        description.AddAgent <Animal, Terrain>();
        return(description);
    }
Пример #3
0
        private static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("EN-US");
            LoggerFactory.SetLogLevel(LogLevel.Off);

            var description = new ModelDescription();

            description.AddLayer <CarLayer>();
            description.AddLayer <CarParkingLayer>();
            description.AddLayer <TrafficLightLayer>();
            description.AddLayer <TravelerLayer>();


            description.AddAgent <Traveler, TravelerLayer>();
            description.AddEntity <Car>();


            ISimulationContainer application;

            if (args != null && args.Any())
            {
                application = SimulationStarter.BuildApplication(description, args);
            }
            else
            {
                var config = CreateDefaultConfig();
                application = SimulationStarter.BuildApplication(description, config);
            }

            var simulation = application.Resolve <ISimulation>();

            var watch = Stopwatch.StartNew();
            var state = simulation.StartSimulation();

            var layers = state.Model.Layers;


            foreach (var layer in layers)
            {
                if (layer.Value is TravelerLayer travelerLayer)
                {
                    TripsOutputAdapter.PrintTripResult(travelerLayer.Travelers.Values);
                }
            }

            watch.Stop();

            Console.WriteLine($"Executed iterations {state.Iterations} lasted {watch.Elapsed}");
            application.Dispose();
        }
Пример #4
0
    public static void Main(string[] args)
    {
        var            testGenmoes = FileUtils.ReadGenomesFromFile(".\\output\\genomes.csv");
        HillClimberFCM fcm         = new HillClimberFCM(population: 96, numberOfValues: 486, STEPS, OUTPUT_FILENAME, FITNESS_COLUMNNAME, testGenmoes);

        ModelDescription description = new ModelDescription();

        description.AddLayer <Terrain>();
        description.AddAgent <Animal, Terrain>();


        ABM abm = new ABM(modelDescription: description);

        abm.Train(fcm, 30, 45, true, args);

        testGenmoes = FileUtils.ReadGenomesFromFile(".\\output\\genomes.csv");
        fcm         = new HillClimberFCM(population: 96, numberOfValues: 486, STEPS, OUTPUT_FILENAME, FITNESS_COLUMNNAME, testGenmoes);
        abm.Test(fcm, 2, args);
    }