- Timestamp:
- 11/08/17 07:34:46 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CFSAP/HeuristicLab.Problems.Scheduling.CFSAP/3.3/CFSAPSequenceOnly.cs
r15456 r15460 44 44 } 45 45 46 public IntMatrix ProcessingTimes { 47 get { return ProcessingTimesParameter.Value; } 48 set { ProcessingTimesParameter.Value = value; } 49 } 50 46 51 public IValueParameter<ItemList<IntMatrix>> SetupTimesParameter { 47 52 get { return (IValueParameter<ItemList<IntMatrix>>)Parameters["SetupTimes"]; } 53 } 54 55 public ItemList<IntMatrix> SetupTimes { 56 get { return SetupTimesParameter.Value; } 57 set { SetupTimesParameter.Value = value; } 48 58 } 49 59 … … 162 172 for (int machine = 0; machine < 2; machine++) { 163 173 int[] assignment = Enumerable.Repeat(machine, N).ToArray(); 164 int newT = EvaluateAssignement(order, assignment, processingTimes, setupTimes);174 int newT = CFSAP.EvaluateAssignement(order, assignment, processingTimes, setupTimes); 165 175 if (newT < T) { //New best solution has been found 166 176 T = newT; 167 assignment.CopyTo(optimalAssignment, N);177 optimalAssignment = assignment; 168 178 } 169 }170 171 return T;172 }173 174 //Function to evaluate individual with the specified assignment175 public static int EvaluateAssignement(Permutation order, int[] assignment, IntMatrix processingTimes, ItemList<IntMatrix> setupTimes) {176 var N = order.Length;177 int T = 0;178 179 for (int i = 0; i < N; i++) {180 int operation = order[i];181 int machine = assignment[operation];182 T += processingTimes[machine, operation];183 }184 185 for (int machine = 0; machine < 2; machine++) {186 int first = -1;187 int last = -1;188 for (int i = 0; i < N; i++) {189 int operation = order[i];190 if (assignment[operation] == machine) {191 if (first == -1)192 first = operation;193 else194 T += setupTimes[machine][last, operation];195 last = operation;196 }197 }198 if (last != -1 && first != -1)199 T += setupTimes[machine][last, first];200 179 } 201 180 … … 232 211 233 212 return assignment; 213 } 214 215 public void UpdateEncoding() { 216 Encoding.Length = ProcessingTimes.Columns; 234 217 } 235 218 … … 265 248 } 266 249 SetupTimesParameter.Value = setups; 267 Encoding.Length = data.Jobs;250 UpdateEncoding(); 268 251 Name = data.Name + "-nest" + nest; 269 252 Description = data.Description; 253 if (data.BestKnownCycleTime.HasValue) 254 BestKnownQuality = data.BestKnownCycleTime.Value; 255 else BestKnownQualityParameter.Value = null; 270 256 } 271 257 }
Note: See TracChangeset
for help on using the changeset viewer.