public void Load(JSSPData data)
        {
            var jobData = new ItemList <Job>(data.Jobs);

            for (int j = 0; j < data.Jobs; j++)
            {
                var job = new Job(j, data.DueDates != null ? data.DueDates[j] : double.MaxValue);
                for (int t = 0; t < data.Resources; t++)
                {
                    job.Tasks.Add(new Task(t, data.Demands[j, t], j, data.ProcessingTimes[j, t]));
                }
                jobData.Add(job);
            }

            BestKnownQuality = data.BestKnownQuality.HasValue ? new DoubleValue(data.BestKnownQuality.Value) : null;
            if (data.BestKnownSchedule != null)
            {
                var enc = new JSMEncoding();
                enc.JobSequenceMatrix = new ItemList <Permutation>(data.Resources);
                for (int i = 0; i < data.Resources; i++)
                {
                    enc.JobSequenceMatrix[i] = new Permutation(PermutationTypes.Absolute, new int[data.Jobs]);
                    for (int j = 0; j < data.Jobs; j++)
                    {
                        enc.JobSequenceMatrix[i][j] = data.BestKnownSchedule[i, j];
                    }
                }
                BestKnownSolution = new JSMDecoder().CreateScheduleFromEncoding(enc, jobData);
                if (ScheduleEvaluator is MeanTardinessEvaluator)
                {
                    BestKnownQuality = new DoubleValue(MeanTardinessEvaluator.GetMeanTardiness(BestKnownSolution, jobData));
                }
                else if (ScheduleEvaluator is MakespanEvaluator)
                {
                    BestKnownQuality = new DoubleValue(MakespanEvaluator.GetMakespan(BestKnownSolution));
                }
            }
            Name        = data.Name;
            Description = data.Description;
            JobData     = jobData;
            Jobs        = data.Jobs;
            Resources   = data.Resources;
        }
Exemple #2
0
 protected JSMDecoder(JSMDecoder original, Cloner cloner) : base(original, cloner)
 {
 }
 protected JSMDecoder(JSMDecoder original, Cloner cloner) : base(original, cloner) { }