public static void ReadData(string path, ref ProblemSetting ps, ref List<Job> jobs) { // init ps //note that for brownEnergyPrice/greenEnergy list, the time index start from 1, thus need to append 0 in the head of list var timeslotString = ReadSingleParameterFromFile(path + "totaltimeslots.txt"); ps.TimeSlots = Int16.Parse(timeslotString); // read from file // Console.WriteLine("timeSlot=" + ps.TimeSlots); ps.ClusterNodeNum = Int16.Parse(ReadSingleParameterFromFile(path + "vm.txt")); // read from file //Console.WriteLine("vm=" + ps.ClusterNodeNum); ps.RevenueRate = Double.Parse(ReadSingleParameterFromFile(path + "revenuerate.txt")); // read from file // Console.WriteLine("revenue rate=" + ps.RevenueRate); ps.SolarEnergyList = ReadIntListFromFile(path + "solars.txt"); // read from file // Console.WriteLine("solar energy length" + ps.SolarEnergyList.Count); // ps.SolarEnergyList.ForEach(e => Console.Write(e + " ")); // Console.WriteLine(); ps.BrownPriceList = ReadDoubleListFromFile(path + "brownPrice.txt"); // Console.WriteLine("brown price length" + ps.BrownPriceList.Count); // ps.BrownPriceList.ForEach(e => Console.Write(e + " ")); // Console.WriteLine(); // init ps jobs = ReadJobFromFile(path + "jobs.txt", ps.RevenueRate); // Console.WriteLine("scheduledJobs"); // scheduledJobs.ForEach(j => Console.WriteLine(j.ArrivalTime + " " + j.Deadline + " " + j.ProcessingTime + " " + j.RequiredNodes)); }
public Simulator(IScheduler scheduler, ProblemSetting ps, List<Job> jobs) { this.Scheduler = scheduler; this.PS = ps.Clone(); this.Jobs = jobs.DeepClone(); this.OriginPS = ps.Clone(); this.OriginJobs = jobs.DeepClone(); }
public SchedulerBase(ProblemSetting ps) { this.ProblemSetting = ps.Clone(); CurrentJobList = new List<Job>(); this.ScheduledJobList = new List<Job>(); Cluster = new Cluster(this.ProblemSetting.TimeSlots, this.ProblemSetting.ClusterNodeNum); //this.Results = new Dictionary<string, List<SimulateResult>>(); }
public SchedulerBase(ProblemSetting ps) { this.ProblemSetting = ps.Clone(); CurrentJobList = new List <Job>(); this.ScheduledJobList = new List <Job>(); Cluster = new Cluster(this.ProblemSetting.TimeSlots, this.ProblemSetting.ClusterNodeNum); //this.Results = new Dictionary<string, List<SimulateResult>>(); }
static void RunOneSimulation(String path, string schedulerName) { var ps = new ProblemSetting(); var jobs = new List<Job>(); FileUtil.ReadData(path, ref ps, ref jobs); IScheduler scheduler = SchedulerFactory.GetScheduler(schedulerName, ps); var simulator = new Simulator(scheduler, ps, jobs); var simulationresult = simulator.Simulate(); Console.WriteLine(simulationresult); }
public ProblemSetting Clone() { var ps = new ProblemSetting { //Jobs = new List<Job>(), TimeSlots = this.TimeSlots, ClusterNodeNum = this.ClusterNodeNum, RevenueRate = this.RevenueRate, BrownPriceList = this.BrownPriceList != null ? new List <double>(this.BrownPriceList) : null, SolarEnergyList = this.SolarEnergyList != null ? new List <int>(this.SolarEnergyList): null }; //Jobs.ForEach(job => // { // ps.Jobs.Add(job.DeepClone()); // }); return(ps); }
public ProblemSetting Clone() { var ps = new ProblemSetting { //Jobs = new List<Job>(), TimeSlots = this.TimeSlots, ClusterNodeNum = this.ClusterNodeNum, RevenueRate = this.RevenueRate, BrownPriceList = this.BrownPriceList !=null ? new List<double>(this.BrownPriceList) : null, SolarEnergyList = this.SolarEnergyList !=null ? new List<int>(this.SolarEnergyList): null }; //Jobs.ForEach(job => // { // ps.Jobs.Add(job.DeepClone()); // }); return ps; }