Beispiel #1
0
 public LinearModel(SDRData.SDR sdr, string distribution, string dimension)
     : this(null, Features.Mode.Local, 1, 1, (int) sdr, distribution, dimension, Model.SDR)
 {
     Name = String.Format("{0}Equiv", sdr);
     switch (sdr)
     {
         case SDRData.SDR.MWR:
             LocalWeights[(int) Features.Local.jobWrm][0] = +1;
             return;
         case SDRData.SDR.LWR:
             LocalWeights[(int) Features.Local.jobWrm][0] = -1;
             return;
         case SDRData.SDR.SPT:
             LocalWeights[(int) Features.Local.proc][0] = -1;
             return;
         case SDRData.SDR.LPT:
             LocalWeights[(int) Features.Local.proc][0] = +1;
             return;
         default:
             return; // do nothing
     }
 }
Beispiel #2
0
        public void ApplyBDR(SDRData.SDR sdrFirst, SDRData.SDR sdrSecond, int stepSplitProc)
        {
            int stepSplit = (int) (stepSplitProc/100.0*_prob.Dimension);

            for (int step = Sequence.Count; step < _prob.Dimension; step++)
            {
                var sdr = step < stepSplit ? sdrFirst : sdrSecond;
                var job = JobChosenBySDR(sdr);
                Dispatch1(job);
            }
        }
Beispiel #3
0
        public int JobChosenBySDR(SDRData.SDR sdr)
        {
            List<int> ix;
            switch (sdr)
            {
                case SDRData.SDR.LWR:
                case SDRData.SDR.MWR:
                    List<int> wrm = new List<int>(ReadyJobs.Count);
                    wrm.AddRange(ReadyJobs.Select(job => _jobs[job].WorkRemaining));

                    ix =
                        wrm.Select((x, i) => new {x, i})
                            .Where(x => x.x == (sdr == SDRData.SDR.LWR
                                ? wrm.Min()
                                : wrm.Max()))
                            .Select(x => x.i).ToList();

                    break;

                case SDRData.SDR.LPT:
                case SDRData.SDR.SPT:
                    List<int> times = new List<int>(ReadyJobs.Count);
                    times.AddRange(from job in ReadyJobs
                        let mac = _prob.Sigma[job, _jobs[job].MacCount]
                        select _prob.Procs[job, mac]);

                    ix =
                        times.Select((x, i) => new {x, i})
                            .Where(x => x.x == (sdr == SDRData.SDR.SPT
                                ? times.Min()
                                : times.Max()))
                            .Select(x => x.i).ToList();

                    break;
                default: // unknown, choose at random
                    return ReadyJobs[_random.Next(0, ReadyJobs.Count())];
            }

            var highestPriority = ReadyJobs.Select((x, i) => new {x, i})
                .Where(x => ix.Contains(x.i))
                .Select(x => x.x).ToList();

            return highestPriority.Count == 1
                ? highestPriority[0]
                : highestPriority[_random.Next(0, highestPriority.Count())]; // break ties randomly
        }
Beispiel #4
0
 public void ApplySDR(SDRData.SDR sdr)
 {
     for (int step = Sequence.Count; step < _prob.Dimension; step++)
     {
         var job = JobChosenBySDR(sdr);
         Dispatch1(job);
     }
 }