private static void GeneratePMFData() { List <int> data = new List <int>(); BatteryQualityGenerator g = new BatteryQualityGenerator(); for (int i = 0; i < 1000; i++) { data.Add(g.GetNext()); } File.WriteAllLines("pmfData.txt", data.Select(b => b.ToString())); }
/// <summary> /// Scenario 2 is like scenario 1, but with very slow, fast drilling robots /// </summary> private static void scenario2() { Parallel.For(0, numRuns, (i) => { BatteryQualityGenerator g = new BatteryQualityGenerator(); SimulationDriver sim = new SimulationDriver() { stopCondition = (state) => { return(state.time >= 3600 * 24 * 365); //One year } }; var robots = new List <Robot> { new Robot(ThreadSafeRandom.NextNormalInt(5, 1), g.GetNext()), new Robot(ThreadSafeRandom.NextNormalInt(5, 1), g.GetNext()), new Robot(ThreadSafeRandom.NextNormalInt(5, 1), g.GetNext()), new Robot(ThreadSafeRandom.NextNormalInt(5, 1), g.GetNext()) }; robots.ForEach(r => { r.AvgMiningTime = 4; r.StdDevMiningTime = 1; }); var sites = new List <MiningSite> { new MiningSite(100), new MiningSite(110), new MiningSite(80), new MiningSite(100) }; State starting = new State() { baseStation = new BaseStation(4), robots = robots, sites = sites }; sim.world = starting; robots.ForEach(r => { sim.world.eventQueue.Enqueue(new AttemptChargingEnqueueEvent(r, starting.baseStation, 0), 0); }); sim.Run(); Console.WriteLine(starting.baseStation.oreMined); }); }