Changeset 14019
- Timestamp:
- 07/07/16 16:33:17 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/thasling/DistributedGA/DistributedGA.Hive/P2PMigrationAnalyzer.cs
r14013 r14019 21 21 22 22 using System; 23 using System.Collections; 23 24 using System.Collections.Generic; 24 25 using System.IO; 25 26 using System.Linq; 27 using DistributedGA.Core.Domain; 26 28 using DistributedGA.Core.Implementation; 27 29 using DistributedGA.Core.Interface; … … 70 72 public IValueParameter<ILog> LogParameter { 71 73 get { return (IValueParameter<ILog>)Parameters["Log"]; } 74 } 75 public ILookupParameter<StringValue> JobGuidParameter { 76 get { return (ILookupParameter<StringValue>)Parameters["JobGUID"]; } 72 77 } 73 78 … … 225 230 // recieve 226 231 var message = h.GetDataFromNetwork(); 227 232 List<KeyValuePair<PeerInfo, byte[]>> immigrants = new List<KeyValuePair<PeerInfo, byte[]>>(); 233 //limit number of immigrants to use 234 if(noOfEmigrants < message.Count) 235 { 236 immigrants = message.Skip(Math.Max(0, message.Count() - noOfEmigrants)).ToList(); 237 } else { 238 immigrants = message; 239 } 240 228 241 // remove individuals from population to make place for immigrants 229 for (int i = 0; i < message.Count; i++) {242 for (int i = 0; i < immigrants.Count; i++) { 230 243 switch (selectedMigStratReplace) { 231 244 case MigrationStrategy.Best: … … 251 264 var qualities = QualityParameter.ActualValue; 252 265 var qualityTranslatedName = QualityParameter.TranslatedName; 253 foreach (var msg in message) {266 foreach (var msg in immigrants) { 254 267 using (var stream = new MemoryStream(msg.Value)) { 255 268 var immigrantScope = HeuristicLab.Persistence.Default.Xml.XmlParser.Deserialize<IScope>(stream);
Note: See TracChangeset
for help on using the changeset viewer.