Exemplo n.º 1
0
        public MCTrialGenerator()
        {
            // Read in envConfig
            envConfig = EnvConfigXMLReader.Parse(envConfigFile);
            if (envConfig == null)
            {
                Log.debug("MCTrialGenerator::Main(): Parsed envConfig is null, exiting");
                return;
            }

            // Initialize GridMath object
            gridMath = new GridMath(envConfig.gridOrigin_x, envConfig.gridOrigin_z, envConfig.gridToWorldScale);

            // Populate hashsets of cells for easy lookup
            landCells         = new HashSet <PrimitivePair <int, int> >(envConfig.landCells);
            landAndWaterCells = new HashSet <PrimitivePair <int, int> >(envConfig.landCells);
            landAndWaterCells.UnionWith(envConfig.waterCells);

            // Random generator for determining whether a unit has weapons or jammers etc.
            rand = new Random(generatorRandomSeed);
        }
Exemplo n.º 2
0
        public MCTrialGenerator()
        {
            // Read in envConfig
            envConfig = EnvConfigXMLReader.Parse(envConfigFile);
            if (envConfig == null)
            {
                Log.debug("MCTrialGenerator::Main(): Parsed envConfig is null, exiting");
                return;
            }

            // Initialize GridMath object
            gridMath = new GridMath(envConfig.gridOrigin_x, envConfig.gridOrigin_z, envConfig.gridToWorldScale);

            // Populate hashsets of cells for easy lookup
            landCells         = new HashSet <PrimitivePair <int, int> >(envConfig.landCells);
            landAndWaterCells = new HashSet <PrimitivePair <int, int> >(envConfig.landCells);
            landAndWaterCells.UnionWith(envConfig.waterCells);

            // Random generator for determining whether a unit has weapons or jammers etc.
            rand = new Random(generatorRandomSeed);

            // Type of experiment that will be run
            switch (experimentType)
            {
            case ExperimentType.COMMS_RANGE:
                experiment = new CommsRangeExperiment(this);
                break;

            case ExperimentType.BLUE_NUM:
                experiment = new SmallUAVNumberExperiment(this);
                break;

            case ExperimentType.RED_NUM:
                experiment = new RedAgentNumberExperiment(this);
                break;

            case ExperimentType.RED_PRED:
                experiment = new RedMovePredExperiment(this);
                break;

            case ExperimentType.FACTORIAL:
                experiment = new FactorialExperiment(this);
                break;
            }

            // Blue Base
            blueBases = new List <SiteConfig>();
            blueBases.Add(new BlueBaseConfig(-3.02830208f, -9.7492255f, "Blue Base", new Optional <float>()));

            // Red Base
            redBases = new List <SiteConfig>();
            redBases.Add(new RedBaseConfig(-17.7515077f, 13.7463599f, "Red Base 0"));
            redBases.Add(new RedBaseConfig(-0.439941213f, 12.7518844f, "Red Base 1"));
            redBases.Add(new RedBaseConfig(22.0787984f, 10.7493104f, "Red Base 2"));

            // NGO Site
            ngoSites = new List <SiteConfig>();
            ngoSites.Add(new NGOSiteConfig(-21.2181483f, -1.25010618f, "NGO Site 0"));
            ngoSites.Add(new NGOSiteConfig(-4.76803318f, -5.74888572f, "NGO Site 1"));
            ngoSites.Add(new NGOSiteConfig(11.6916982f, 4.76402643f, "NGO Site 2"));
            ngoSites.Add(new NGOSiteConfig(24.6807822f, -6.75057337f, "NGO Site 3"));

            // Village
            villages = new List <SiteConfig>();
            villages.Add(new VillageConfig(-16.0197901f, 5.74808437f, "Village 0"));
            villages.Add(new VillageConfig(-14.296086f, -3.22944096f, "Village 1"));
            villages.Add(new VillageConfig(-5.63349131f, 4.74559538f, "Village 2"));
            villages.Add(new VillageConfig(7.34998325f, -0.743652906f, "Village 3"));
            villages.Add(new VillageConfig(-13.4306279f, -11.7638197f, "Village 4"));
        }