- Timestamp:
- 11/07/17 13:49:09 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CFSAP/HeuristicLab.Problems.Scheduling.CFSAP/3.3/CFSAPSequenceOnly.cs
r14757 r15456 34 34 35 35 namespace HeuristicLab.Problems.Scheduling.CFSAP { 36 [Item("Cyclic Flow Shop with two machine nests (CFSAP) sequence only", "Non-permutational cyclic flow shop scheduling problem with two machine nestsfrom W. Bozejko.")]36 [Item("Cyclic flow shop with two machines and a single nest (CFSAP) sequencing problem", "Non-permutational cyclic flow shop scheduling problem with a single nest of two machine from W. Bozejko.")] 37 37 [Creatable(CreatableAttribute.Categories.CombinatorialProblems)] 38 38 [StorableClass] … … 90 90 public override double Evaluate(Individual individual, IRandom random) { 91 91 var order = individual.Permutation(Encoding.Name); 92 int T = EvaluateSequence(order); 93 return T; 94 } 95 96 public int EvaluateSequence(Permutation order) { 92 97 var N = order.Length; 93 98 var processingTimes = ProcessingTimesParameter.Value; … … 229 234 } 230 235 236 /// <summary> 237 /// Imports the first nest (index 0) given in the CFSAPData. 238 /// This is the same as calling Load(data, 0). 239 /// </summary> 240 /// <param name="data">The data of all nests.</param> 231 241 public void Load(CFSAPData data) { 232 if (data.MachineNests != 2) throw new ArgumentException("Currently only two machine nests are supported."); 233 ProcessingTimesParameter.Value = new IntMatrix(data.ProcessingTimes); 234 var setups = new ItemList<IntMatrix>(data.MachineNests); 235 for (var m = 0; m < data.SetupTimes.GetLength(0); m++) { 242 Load(data, 0); 243 } 244 245 /// <summary> 246 /// Imports a specific nest given in the CFSAPData. 247 /// </summary> 248 /// <param name="data">The data of all nests.</param> 249 /// <param name="nest">The zero-based index of the nest that should be imported.</param> 250 public void Load(CFSAPData data, int nest) { 251 if (data.Machines[nest] != 2) throw new ArgumentException("Currently only two machines per nest are supported."); 252 if (nest < 0 || nest >= data.Nests) throw new ArgumentException("Nest must be a zero-based index."); 253 var pr = new int[data.Machines[nest], data.Jobs]; 254 for (var i = 0; i < data.Machines[nest]; i++) 255 for (var j = 0; j < data.Jobs; j++) 256 pr[i, j] = data.ProcessingTimes[nest][i][j]; 257 ProcessingTimesParameter.Value = new IntMatrix(pr); 258 var setups = new ItemList<IntMatrix>(data.Machines[nest]); 259 for (var m = 0; m < data.SetupTimes[nest].GetLength(0); m++) { 236 260 var setupTimes = new int[data.Jobs, data.Jobs]; 237 261 for (var i = 0; i < data.Jobs; i++) 238 for (var j = 0; j < data.Jobs; j++)239 setupTimes[i, j] = data.SetupTimes[m, i,j];262 for (var j = 0; j < data.Jobs; j++) 263 setupTimes[i, j] = data.SetupTimes[nest][m][i][j]; 240 264 setups.Add(new IntMatrix(setupTimes)); 241 265 } 242 266 SetupTimesParameter.Value = setups; 243 267 Encoding.Length = data.Jobs; 244 Name = data.Name ;268 Name = data.Name + "-nest" + nest; 245 269 Description = data.Description; 246 270 }
Note: See TracChangeset
for help on using the changeset viewer.