Changeset 13435 for branches/ProblemRefactoring
- Timestamp:
- 12/04/15 10:35:04 (9 years ago)
- Location:
- branches/ProblemRefactoring
- Files:
-
- 31 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding.Views/3.3/ScheduleView.cs
r12012 r13435 67 67 private void RedrawGanttChart(Schedule content) { 68 68 ResetGanttChart(); 69 int resCount = 0; 70 Random random = new Random(1); 71 foreach (Resource r in content.Resources) { 72 foreach (ScheduledTask t in content.Resources[resCount].Tasks) { 73 int categoryNr = 0; 74 string toolTip = "Task#" + t.TaskNr; 75 string categoryName = "ScheduleTasks"; 76 if (t is ScheduledTask) { 77 categoryNr = ((ScheduledTask)t).JobNr; 78 categoryName = "Job" + categoryNr; 79 toolTip = categoryName + " - " + toolTip; 80 } 81 ganttChart.AddData("Resource" + r.Index, 69 foreach (Resource resource in content.Resources) { 70 foreach (ScheduledTask task in resource.Tasks) { 71 int categoryNr = task.JobNr; 72 string categoryName = "Job" + categoryNr; 73 string toolTip = categoryName + " - " + "Task#" + task.TaskNr; 74 75 ganttChart.AddData("Resource" + resource.Index, 82 76 categoryNr, 83 t .TaskNr,84 t .StartTime,85 t .EndTime,77 task.TaskNr, 78 task.StartTime, 79 task.EndTime, 86 80 toolTip); 87 81 } 88 resCount++;89 82 } 90 }91 92 private void RefreshChartInformations(Schedule content) {93 94 83 } 95 84 -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/HeuristicLab.Encodings.ScheduleEncoding-3.3.csproj
r11623 r13435 122 122 <Compile Include="Interfaces\IScheduleCreator.cs" /> 123 123 <Compile Include="Interfaces\IScheduleCrossover.cs" /> 124 <Compile Include="Interfaces\ISchedule Encoding.cs" />124 <Compile Include="Interfaces\ISchedule.cs" /> 125 125 <Compile Include="Interfaces\IScheduleManipulator.cs" /> 126 126 <Compile Include="Interfaces\IScheduleOperator.cs" /> -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/ISchedule.cs
r13434 r13435 23 23 24 24 namespace HeuristicLab.Encodings.ScheduleEncoding { 25 public interface ISchedule Encoding: IItem {25 public interface ISchedule : IItem { 26 26 } 27 27 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IScheduleCreator.cs
r12012 r13435 25 25 namespace HeuristicLab.Encodings.ScheduleEncoding { 26 26 public interface IScheduleCreator : ISolutionCreator, IScheduleOperator { 27 ILookupParameter<ISchedule Encoding> ScheduleEncodingParameter { get; }27 ILookupParameter<ISchedule> ScheduleParameter { get; } 28 28 } 29 29 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IScheduleCrossover.cs
r12012 r13435 25 25 namespace HeuristicLab.Encodings.ScheduleEncoding { 26 26 public interface IScheduleCrossover : ICrossover, IScheduleOperator { 27 ILookupParameter<ISchedule Encoding> ChildParameter { get; }28 IScopeTreeLookupParameter<ISchedule Encoding> ParentsParameter { get; }27 ILookupParameter<ISchedule> ChildParameter { get; } 28 IScopeTreeLookupParameter<ISchedule> ParentsParameter { get; } 29 29 } 30 30 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/Interfaces/IScheduleManipulator.cs
r12012 r13435 25 25 namespace HeuristicLab.Encodings.ScheduleEncoding { 26 26 public interface IScheduleManipulator : IManipulator, IScheduleOperator { 27 ILookupParameter<ISchedule Encoding> ScheduleEncodingParameter { get; }27 ILookupParameter<ISchedule> ScheduleParameter { get; } 28 28 } 29 29 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/JSMEncoding.cs
r12012 r13435 30 30 [Item("JobSequenceMatrixEncoding", "Represents an encoding for a scheduling Problem using a list of job sequences to deliver scheduleinformation.")] 31 31 [StorableClass] 32 public class JSMEncoding : Item, ISchedule Encoding{32 public class JSMEncoding : Item, ISchedule { 33 33 34 34 [Storable] -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/JSMRandomCreator.cs
r12012 r13435 52 52 Parameters.Add(new ValueLookupParameter<IntValue>("Resources", "The number of resources used in this problem instance.")); 53 53 54 Schedule EncodingParameter.ActualName = "JobSequenceMatrix";54 ScheduleParameter.ActualName = "JobSequenceMatrix"; 55 55 } 56 56 … … 67 67 } 68 68 69 protected override ISchedule EncodingCreateSolution() {69 protected override ISchedule CreateSolution() { 70 70 return Apply(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue); 71 71 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Manipulators/JSMManipulator.cs
r12012 r13435 34 34 public JSMManipulator() 35 35 : base() { 36 Schedule EncodingParameter.ActualName = "JobSequenceMatrix";36 ScheduleParameter.ActualName = "JobSequenceMatrix"; 37 37 } 38 38 39 protected abstract void Manipulate(IRandom random, ISchedule Encodingindividual);39 protected abstract void Manipulate(IRandom random, ISchedule individual); 40 40 41 41 public override IOperation InstrumentedApply() { 42 var solution = Schedule EncodingParameter.ActualValue as JSMEncoding;42 var solution = ScheduleParameter.ActualValue as JSMEncoding; 43 43 if (solution == null) throw new InvalidOperationException("ScheduleEncoding was not found or is not of type JSMEncoding."); 44 44 Manipulate(RandomParameter.ActualValue, solution); -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Manipulators/JSMShiftChangeManipulator.cs
r12012 r13435 63 63 } 64 64 65 protected override void Manipulate(IRandom random, ISchedule Encodingencoding) {65 protected override void Manipulate(IRandom random, ISchedule encoding) { 66 66 var solution = encoding as JSMEncoding; 67 67 if (solution == null) throw new InvalidOperationException("Encoding is not of type JSMEncoding"); -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/Manipulators/JSMSwapManipulator.cs
r12012 r13435 50 50 } 51 51 52 protected override void Manipulate(IRandom random, ISchedule Encodingindividual) {52 protected override void Manipulate(IRandom random, ISchedule individual) { 53 53 var solution = individual as JSMEncoding; 54 54 if (solution == null) throw new InvalidOperationException("Encoding is not of type JSMEncoding"); -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/Manipulators/PWRManipulator.cs
r12012 r13435 35 35 public PWRManipulator() 36 36 : base() { 37 Schedule EncodingParameter.ActualName = "PermutationWithRepetition";37 ScheduleParameter.ActualName = "PermutationWithRepetition"; 38 38 } 39 39 … … 41 41 42 42 public override IOperation InstrumentedApply() { 43 var solution = Schedule EncodingParameter.ActualValue as PWREncoding;43 var solution = ScheduleParameter.ActualValue as PWREncoding; 44 44 if (solution == null) throw new InvalidOperationException("ScheduleEncoding was not found or is not of type PWREncoding."); 45 45 Manipulate(RandomParameter.ActualValue, solution); -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/PWREncoding.cs
r12012 r13435 29 29 [Item("PermutationWithRepetitionEncoding", "Represents a encoding for a standard JobShop Scheduling Problem.")] 30 30 [StorableClass] 31 public class PWREncoding : Item, ISchedule Encoding{31 public class PWREncoding : Item, ISchedule { 32 32 33 33 [Storable] -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/PWRRandomCreator.cs
r12012 r13435 51 51 Parameters.Add(new ValueLookupParameter<IntValue>("Resources", "The number of resources used in this problem instance.")); 52 52 53 Schedule EncodingParameter.ActualName = "PermutationWithRepetition";53 ScheduleParameter.ActualName = "PermutationWithRepetition"; 54 54 } 55 55 … … 62 62 } 63 63 64 protected override ISchedule EncodingCreateSolution() {64 protected override ISchedule CreateSolution() { 65 65 return Apply(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue); 66 66 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/Manipulators/PRVManipulator.cs
r12012 r13435 34 34 public PRVManipulator() 35 35 : base() { 36 Schedule EncodingParameter.ActualName = "PriorityRulesVector";36 ScheduleParameter.ActualName = "PriorityRulesVector"; 37 37 } 38 38 … … 40 40 41 41 public override IOperation InstrumentedApply() { 42 var solution = Schedule EncodingParameter.ActualValue as PRVEncoding;42 var solution = ScheduleParameter.ActualValue as PRVEncoding; 43 43 if (solution == null) throw new InvalidOperationException("ScheduleEncoding was not found or is not of type PRVEncoding."); 44 44 Manipulate(RandomParameter.ActualValue, solution); -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/PRVEncoding.cs
r12012 r13435 30 30 [Item("PriorityRulesVectorEncoding", "Represents an encoding for a Scheduling Problem.")] 31 31 [StorableClass] 32 public class PRVEncoding : Item, ISchedule Encoding{32 public class PRVEncoding : Item, ISchedule { 33 33 [Storable] 34 34 public IntegerVector PriorityRulesVector { get; set; } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/PriorityRulesVector/PRVRandomCreator.cs
r12012 r13435 57 57 Parameters.Add(new ValueLookupParameter<IntValue>("Jobs", "The number of jobs handled in this problem instance.")); 58 58 Parameters.Add(new ValueLookupParameter<IntValue>("Resources", "The number of resources used in this problem instance.")); 59 Schedule EncodingParameter.ActualName = "PriorityRulesVector";59 ScheduleParameter.ActualName = "PriorityRulesVector"; 60 60 } 61 61 … … 68 68 } 69 69 70 protected override ISchedule EncodingCreateSolution() {70 protected override ISchedule CreateSolution() { 71 71 return Apply(JobsParameter.ActualValue.Value, ResourcesParameter.ActualValue.Value, RandomParameter.ActualValue, NrOfRules); 72 72 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleCreator.cs
r12012 r13435 31 31 public abstract class ScheduleCreator : InstrumentedOperator, IScheduleCreator { 32 32 33 public ILookupParameter<ISchedule Encoding> ScheduleEncodingParameter {34 get { return (ILookupParameter<ISchedule Encoding>)Parameters["ScheduleEncoding"]; }33 public ILookupParameter<ISchedule> ScheduleParameter { 34 get { return (ILookupParameter<ISchedule>)Parameters["Schedule"]; } 35 35 } 36 36 … … 40 40 public ScheduleCreator() 41 41 : base() { 42 Parameters.Add(new LookupParameter<ISchedule Encoding>("ScheduleEncoding", "The new scheduling solutioncandidate."));42 Parameters.Add(new LookupParameter<ISchedule>("Schedule", "The new scheduling solutioncandidate.")); 43 43 } 44 44 45 45 public override IOperation InstrumentedApply() { 46 Schedule EncodingParameter.ActualValue = CreateSolution();46 ScheduleParameter.ActualValue = CreateSolution(); 47 47 return base.InstrumentedApply(); 48 48 } 49 49 50 protected abstract ISchedule EncodingCreateSolution();50 protected abstract ISchedule CreateSolution(); 51 51 } 52 52 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleCrossover.cs
r12012 r13435 32 32 public abstract class ScheduleCrossover : InstrumentedOperator, IScheduleCrossover, IStochasticOperator { 33 33 34 public ILookupParameter<ISchedule Encoding> ChildParameter {35 get { return (ILookupParameter<ISchedule Encoding>)Parameters["Child"]; }34 public ILookupParameter<ISchedule> ChildParameter { 35 get { return (ILookupParameter<ISchedule>)Parameters["Child"]; } 36 36 } 37 public IScopeTreeLookupParameter<ISchedule Encoding> ParentsParameter {38 get { return (IScopeTreeLookupParameter<ISchedule Encoding>)Parameters["Parents"]; }37 public IScopeTreeLookupParameter<ISchedule> ParentsParameter { 38 get { return (IScopeTreeLookupParameter<ISchedule>)Parameters["Parents"]; } 39 39 } 40 40 public ILookupParameter<IRandom> RandomParameter { … … 48 48 : base() { 49 49 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators.")); 50 Parameters.Add(new LookupParameter<ISchedule Encoding>("Child", "The child solution resulting from the crossover."));51 ChildParameter.ActualName = "Schedul ingSolution";52 Parameters.Add(new ScopeTreeLookupParameter<ISchedule Encoding>("Parents", "The parent solution which should be crossed."));53 ParentsParameter.ActualName = "Schedul ingSolution";50 Parameters.Add(new LookupParameter<ISchedule>("Child", "The child solution resulting from the crossover.")); 51 ChildParameter.ActualName = "Schedule"; 52 Parameters.Add(new ScopeTreeLookupParameter<ISchedule>("Parents", "The parent solution which should be crossed.")); 53 ParentsParameter.ActualName = "Schedule"; 54 54 } 55 55 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/DirectScheduleRandomCreator.cs
r12012 r13435 63 63 Parameters.Add(new ValueLookupParameter<IntValue>("Resources", "The number of resources used in this problem instance.")); 64 64 Parameters.Add(new LookupParameter<ItemList<Job>>("JobData", "Job data taken from the JSSP - Instance.")); 65 Schedule EncodingParameter.ActualName = "Schedule";65 ScheduleParameter.ActualName = "Schedule"; 66 66 } 67 67 … … 82 82 83 83 84 protected override ISchedule EncodingCreateSolution() {84 protected override ISchedule CreateSolution() { 85 85 try { 86 86 var jobData = (ItemList<Job>)JobDataParameter.ActualValue.Clone(); -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Job.cs
r12012 r13435 31 31 [Item("Job", "Represents a composition of tasks that require processing in a scheduling problem.")] 32 32 [StorableClass] 33 public class Job : Item, INotifyPropertyChanged {33 public sealed class Job : Item, INotifyPropertyChanged { 34 34 35 35 [Storable(Name = "DueDate")] … … 38 38 get { return dueDate; } 39 39 set { 40 bool changed = dueDate != value;40 if (dueDate == value) return; 41 41 dueDate = value; 42 if (changed) { 43 OnPropertyChanged("DueDate"); 44 OnToStringChanged(); 45 } 42 OnPropertyChanged("DueDate"); 43 OnToStringChanged(); 46 44 } 47 45 } … … 52 50 get { return index; } 53 51 set { 54 bool changed = index != value;52 if (index == value) return; 55 53 index = value; 56 if (changed) { 57 OnPropertyChanged("Index"); 58 OnToStringChanged(); 59 } 54 OnPropertyChanged("Index"); 55 OnToStringChanged(); 60 56 } 61 57 } … … 65 61 public ItemList<Task> Tasks { 66 62 get { return tasks; } 67 set { 68 bool changed = tasks != value; 63 private set { 69 64 tasks = value; 70 if (changed)OnPropertyChanged("Tasks");65 OnPropertyChanged("Tasks"); 71 66 } 72 67 } 73 68 74 69 [StorableConstructor] 75 pr otectedJob(bool deserializing) : base(deserializing) { }76 pr otectedJob(Job original, Cloner cloner)70 private Job(bool deserializing) : base(deserializing) { } 71 private Job(Job original, Cloner cloner) 77 72 : base(original, cloner) { 78 73 this.dueDate = original.DueDate; … … 151 146 } 152 147 153 internal Task GetPreviousTask(Task t) {154 if (t.TaskNr == 0) return null;155 return Tasks[t.TaskNr - 1];156 }157 158 148 public event EventHandler TasksChanged; 159 pr otected virtualvoid OnTasksChanged() {149 private void OnTasksChanged() { 160 150 var handler = TasksChanged; 161 151 if (handler != null) handler(this, EventArgs.Empty); … … 163 153 164 154 public event PropertyChangedEventHandler PropertyChanged; 165 pr otected virtualvoid OnPropertyChanged(string propertyName) {155 private void OnPropertyChanged(string propertyName) { 166 156 var handler = PropertyChanged; 167 157 if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Manipulators/DirectScheduleManipulator.cs
r12012 r13435 35 35 public DirectScheduleManipulator() 36 36 : base() { 37 Schedule EncodingParameter.ActualName = "Schedule";37 ScheduleParameter.ActualName = "Schedule"; 38 38 } 39 39 … … 41 41 42 42 public override IOperation InstrumentedApply() { 43 var schedule = Schedule EncodingParameter.ActualValue as Schedule;43 var schedule = ScheduleParameter.ActualValue as Schedule; 44 44 if (schedule == null) throw new InvalidOperationException("ScheduleEncoding was not found or is not of type Schedule."); 45 45 Manipulate(RandomParameter.ActualValue, schedule); -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Resource.cs
r12012 r13435 20 20 #endregion 21 21 22 using System.Linq; 22 23 using System.Text; 23 24 using HeuristicLab.Common; … … 28 29 [Item("ResourceClass", "Represents a resource used in scheduling problems.")] 29 30 [StorableClass] 30 public class Resource : Item {31 public sealed class Resource : Item { 31 32 32 33 [Storable] 33 public int Index { 34 get; 35 set; 36 } 34 public int Index { get; private set; } 37 35 [Storable] 38 public ItemList<ScheduledTask> Tasks { 39 get; 40 set; 36 public ItemList<ScheduledTask> Tasks { get; private set; } 37 38 //TODO why does a Ressource has a duration? 39 public double TotalDuration { 40 get { 41 if (Tasks.Count == 0) return 0.0; 42 return Tasks.Max(t => t.EndTime); 43 } 41 44 } 42 45 43 46 [StorableConstructor] 44 pr otectedResource(bool deserializing) : base(deserializing) { }45 pr otectedResource(Resource original, Cloner cloner)47 private Resource(bool deserializing) : base(deserializing) { } 48 private Resource(Resource original, Cloner cloner) 46 49 : base(original, cloner) { 47 50 this.Index = original.Index; … … 58 61 } 59 62 60 public double TotalDuration {61 get {62 double result = 0;63 foreach (ScheduledTask t in Tasks) {64 if (t.EndTime > result)65 result = t.EndTime;66 }67 return result;68 }69 }70 71 63 public override string ToString() { 72 64 StringBuilder sb = new StringBuilder(); 73 65 sb.Append("Resource#" + Index + " [ "); 74 66 foreach (ScheduledTask t in Tasks) { 75 sb.Append(t + " ");67 sb.Append(t + " "); 76 68 } 77 69 sb.Append("]"); -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Schedule.cs
r12012 r13435 25 25 using HeuristicLab.Common; 26 26 using HeuristicLab.Core; 27 using HeuristicLab.Data;28 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 28 … … 31 30 [Item("Schedule", "Represents the general solution for scheduling problems.")] 32 31 [StorableClass] 33 public class Schedule : NamedItem, ISchedule Encoding{32 public class Schedule : NamedItem, ISchedule { 34 33 35 34 #region Properties … … 38 37 public ItemList<Resource> Resources { 39 38 get { return resources; } 40 set {41 if (resources != null) DeregisterResourcesEvents();42 resources = value;43 if (resources != null) RegisterResourcesEvents();44 OnResourcesChanged();45 }46 39 } 47 40 [Storable] 48 private DoubleValue quality;49 public DoubleValue Quality {41 private double quality; 42 public double Quality { 50 43 get { return quality; } 51 44 set { 52 if (quality != value) { 53 if (quality != null) DeregisterQualityEvents(); 54 quality = value; 55 if (quality != null) RegisterQualityEvents(); 56 OnQualityChanged(); 57 } 45 if (quality == value) return; 46 quality = value; 47 OnQualityChanged(); 58 48 } 59 49 } … … 66 56 protected Schedule(Schedule original, Cloner cloner) 67 57 : base(original, cloner) { 68 this.Resources = cloner.Clone(original.Resources); 69 this.Quality = cloner.Clone(original.Quality); 58 this.resources = cloner.Clone(original.Resources); 59 this.quality = original.Quality; 60 //TODO clone 70 61 this.lastScheduledTaskOfJob = new Dictionary<int, ScheduledTask>(original.lastScheduledTaskOfJob); 62 63 RegisterResourcesEvents(); 71 64 } 72 65 public Schedule(int nrOfResources) { 73 Resources = new ItemList<Resource>();66 resources = new ItemList<Resource>(); 74 67 for (int i = 0; i < nrOfResources; i++) { 75 68 Resources.Add(new Resource(i)); 76 69 } 77 70 lastScheduledTaskOfJob = new Dictionary<int, ScheduledTask>(); 71 72 RegisterResourcesEvents(); 78 73 } 79 74 … … 89 84 changed(this, EventArgs.Empty); 90 85 } 91 private void RegisterQualityEvents() {92 Quality.ValueChanged += new EventHandler(Quality_ValueChanged);93 }94 private void DeregisterQualityEvents() {95 Quality.ValueChanged -= new EventHandler(Quality_ValueChanged);96 }97 private void Quality_ValueChanged(object sender, EventArgs e) {98 OnQualityChanged();99 }100 86 101 87 public event EventHandler ResourcesChanged; … … 107 93 private void RegisterResourcesEvents() { 108 94 Resources.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(Resources_PropertyChanged); 109 }110 private void DeregisterResourcesEvents() {111 Resources.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(Resources_PropertyChanged);112 95 } 113 96 private void Resources_PropertyChanged(object sender, EventArgs e) { … … 154 137 return sb.ToString(); 155 138 } 156 157 public double CalculateMakespan() {158 double quality = 0;159 foreach (Resource r in Resources) {160 if (r.TotalDuration > quality) {161 quality = r.TotalDuration;162 }163 }164 return quality;165 }166 139 } 167 140 } -
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleManipulator.cs
r12012 r13435 32 32 public abstract class ScheduleManipulator : InstrumentedOperator, IScheduleManipulator, IStochasticOperator { 33 33 34 public ILookupParameter<ISchedule Encoding> ScheduleEncodingParameter {35 get { return (ILookupParameter<ISchedule Encoding>)Parameters["ScheduleEncoding"]; }34 public ILookupParameter<ISchedule> ScheduleParameter { 35 get { return (ILookupParameter<ISchedule>)Parameters["Schedule"]; } 36 36 } 37 37 … … 45 45 public ScheduleManipulator() 46 46 : base() { 47 Parameters.Add(new LookupParameter<ISchedule Encoding>("ScheduleEncoding", "The scheduling solution to be manipulated."));47 Parameters.Add(new LookupParameter<ISchedule>("Schedule", "The scheduling solution to be manipulated.")); 48 48 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators.")); 49 49 } -
branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/Analyzers/BestSchedulingSolutionAnalyzer.cs
r12012 r13435 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using System.Linq; 23 24 using HeuristicLab.Common; … … 77 78 if (bestSolution == null) { 78 79 bestSolution = (Schedule)solutions[i].Clone(); 79 bestSolution.Quality = (DoubleValue)qualities[i].Clone();80 bestSolution.Quality = qualities[i].Value; 80 81 BestSolutionParameter.ActualValue = bestSolution; 81 82 results.Add(new Result("Best Scheduling Solution", bestSolution)); 82 83 } else { 83 if (max && bestSolution.Quality.Value < qualities[i].Value || 84 !max && bestSolution.Quality.Value > qualities[i].Value) { 85 bestSolution.Quality.Value = qualities[i].Value; 86 bestSolution.Resources = (ItemList<Resource>)solutions[i].Resources.Clone(); 84 if (max && bestSolution.Quality < qualities[i].Value || 85 !max && bestSolution.Quality > qualities[i].Value) { 86 bestSolution.Quality = qualities[i].Value; 87 bestSolution.Resources.Clear(); 88 bestSolution.Resources.AddRange((IEnumerable<Resource>)solutions[i].Resources.Clone()); 87 89 } 88 90 } -
branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/Decoders/JSMDecoder.cs
r12012 r13435 177 177 } 178 178 179 public override Schedule CreateScheduleFromEncoding(ISchedule Encodingencoding) {179 public override Schedule CreateScheduleFromEncoding(ISchedule encoding) { 180 180 var solution = encoding as JSMEncoding; 181 181 if (solution == null) throw new InvalidOperationException("Encoding is not of type JSMEncoding"); -
branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/Decoders/PRVDecoder.cs
r12012 r13435 202 202 } 203 203 204 public override Schedule CreateScheduleFromEncoding(ISchedule Encodingencoding) {204 public override Schedule CreateScheduleFromEncoding(ISchedule encoding) { 205 205 var solution = encoding as PRVEncoding; 206 if (solution == null) throw new InvalidOperationException("Encoding is not of type P WREncoding");206 if (solution == null) throw new InvalidOperationException("Encoding is not of type PRVEncoding"); 207 207 208 208 var jobs = (ItemList<Job>)JobDataParameter.ActualValue.Clone(); -
branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/Decoders/PWRDecoder.cs
r12012 r13435 55 55 } 56 56 57 public override Schedule CreateScheduleFromEncoding(ISchedule Encodingencoding) {57 public override Schedule CreateScheduleFromEncoding(ISchedule encoding) { 58 58 var solution = encoding as PWREncoding; 59 59 if (solution == null) throw new InvalidOperationException("Encoding is not of type PWREncoding"); -
branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/Decoders/ScheduleDecoder.cs
r12012 r13435 32 32 public abstract class ScheduleDecoder : SingleSuccessorOperator, IScheduleDecoder { 33 33 34 public ILookupParameter<ISchedule Encoding> ScheduleEncodingParameter {35 get { return (ILookupParameter<ISchedule Encoding>)Parameters["ScheduleEncoding"]; }34 public ILookupParameter<ISchedule> ScheduleEncodingParameter { 35 get { return (ILookupParameter<ISchedule>)Parameters["ScheduleEncoding"]; } 36 36 } 37 37 public ILookupParameter<Schedule> ScheduleParameter { … … 44 44 public ScheduleDecoder() 45 45 : base() { 46 Parameters.Add(new LookupParameter<ISchedule Encoding>("ScheduleEncoding", "The new scheduling solution represented as encoding."));46 Parameters.Add(new LookupParameter<ISchedule>("ScheduleEncoding", "The new scheduling solution represented as encoding.")); 47 47 Parameters.Add(new LookupParameter<Schedule>("Schedule", "The decoded scheduling solution represented as generalized schedule.")); 48 48 } 49 49 50 public abstract Schedule CreateScheduleFromEncoding(ISchedule Encodingsolution);50 public abstract Schedule CreateScheduleFromEncoding(ISchedule solution); 51 51 52 52 public override IOperation Apply() { -
branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/Interfaces/IScheduleDecoder.cs
r12012 r13435 24 24 namespace HeuristicLab.Encodings.ScheduleEncoding { 25 25 public interface IScheduleDecoder : IOperator { 26 ILookupParameter<ISchedule Encoding> ScheduleEncodingParameter { get; }26 ILookupParameter<ISchedule> ScheduleEncodingParameter { get; } 27 27 ILookupParameter<Schedule> ScheduleParameter { get; } 28 28 } -
branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/JobShopSchedulingProblem.cs
r13173 r13435 164 164 ScheduleEvaluatorParameter.ValueChanged += ScheduleEvaluatorParameter_ValueChanged; 165 165 ScheduleEvaluator.QualityParameter.ActualNameChanged += ScheduleEvaluator_QualityParameter_ActualNameChanged; 166 SolutionCreator.Schedule EncodingParameter.ActualNameChanged += SolutionCreator_SchedulingEncodingParameter_ActualNameChanged;166 SolutionCreator.ScheduleParameter.ActualNameChanged += SolutionCreator_SchedulingEncodingParameter_ActualNameChanged; 167 167 ScheduleDecoderParameter.ValueChanged += ScheduleDecoderParameter_ValueChanged; 168 168 if (ScheduleDecoder != null) ScheduleDecoder.ScheduleParameter.ActualNameChanged += ScheduleDecoder_ScheduleParameter_ActualNameChanged; … … 171 171 #region Events 172 172 protected override void OnSolutionCreatorChanged() { 173 SolutionCreator.Schedule EncodingParameter.ActualNameChanged += SolutionCreator_SchedulingEncodingParameter_ActualNameChanged;173 SolutionCreator.ScheduleParameter.ActualNameChanged += SolutionCreator_SchedulingEncodingParameter_ActualNameChanged; 174 174 InitializeOperators(); 175 175 } … … 288 288 289 289 if (ScheduleDecoder != null) 290 ScheduleDecoder.ScheduleEncodingParameter.ActualName = SolutionCreator.Schedule EncodingParameter.ActualName;290 ScheduleDecoder.ScheduleEncodingParameter.ActualName = SolutionCreator.ScheduleParameter.ActualName; 291 291 292 292 if (ScheduleDecoder != null) { … … 295 295 } else if (SolutionCreator is DirectScheduleRandomCreator) { 296 296 var directEvaluator = (DirectScheduleRandomCreator)SolutionCreator; 297 ScheduleEvaluator.ScheduleParameter.ActualName = directEvaluator.Schedule EncodingParameter.ActualName;297 ScheduleEvaluator.ScheduleParameter.ActualName = directEvaluator.ScheduleParameter.ActualName; 298 298 ScheduleEvaluator.ScheduleParameter.Hidden = true; 299 299 } else { … … 303 303 304 304 foreach (var op in Operators.OfType<IScheduleManipulator>()) { 305 op.Schedule EncodingParameter.ActualName = SolutionCreator.ScheduleEncodingParameter.ActualName;306 op.Schedule EncodingParameter.Hidden = true;305 op.ScheduleParameter.ActualName = SolutionCreator.ScheduleParameter.ActualName; 306 op.ScheduleParameter.Hidden = true; 307 307 } 308 308 309 309 foreach (var op in Operators.OfType<IScheduleCrossover>()) { 310 op.ChildParameter.ActualName = SolutionCreator.Schedule EncodingParameter.ActualName;310 op.ChildParameter.ActualName = SolutionCreator.ScheduleParameter.ActualName; 311 311 op.ChildParameter.Hidden = true; 312 op.ParentsParameter.ActualName = SolutionCreator.Schedule EncodingParameter.ActualName;312 op.ParentsParameter.ActualName = SolutionCreator.ScheduleParameter.ActualName; 313 313 op.ParentsParameter.Hidden = true; 314 314 } … … 320 320 op.ScheduleParameter.Hidden = true; 321 321 } else if (SolutionCreator is DirectScheduleRandomCreator) { 322 op.ScheduleParameter.ActualName = ((DirectScheduleRandomCreator)SolutionCreator).Schedule EncodingParameter.ActualName;322 op.ScheduleParameter.ActualName = ((DirectScheduleRandomCreator)SolutionCreator).ScheduleParameter.ActualName; 323 323 op.ScheduleParameter.Hidden = true; 324 324 } else {
Note: See TracChangeset
for help on using the changeset viewer.