Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14019


Ignore:
Timestamp:
07/07/16 16:33:17 (8 years ago)
Author:
thasling
Message:

#2615:
added jobguid as parameter, so it can be accesed from outside the analyzer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/thasling/DistributedGA/DistributedGA.Hive/P2PMigrationAnalyzer.cs

    r14013 r14019  
    2121
    2222using System;
     23using System.Collections;
    2324using System.Collections.Generic;
    2425using System.IO;
    2526using System.Linq;
     27using DistributedGA.Core.Domain;
    2628using DistributedGA.Core.Implementation;
    2729using DistributedGA.Core.Interface;
     
    7072    public IValueParameter<ILog> LogParameter {
    7173      get { return (IValueParameter<ILog>)Parameters["Log"]; }
     74    }
     75    public ILookupParameter<StringValue> JobGuidParameter {
     76      get { return (ILookupParameter<StringValue>)Parameters["JobGUID"]; }
    7277    }
    7378
     
    225230          // recieve
    226231          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         
    228241          // 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++) {
    230243            switch (selectedMigStratReplace) {
    231244              case MigrationStrategy.Best:
     
    251264          var qualities = QualityParameter.ActualValue;
    252265          var qualityTranslatedName = QualityParameter.TranslatedName;
    253           foreach (var msg in message) {
     266          foreach (var msg in immigrants) {
    254267            using (var stream = new MemoryStream(msg.Value)) {
    255268              var immigrantScope = HeuristicLab.Persistence.Default.Xml.XmlParser.Deserialize<IScope>(stream);
Note: See TracChangeset for help on using the changeset viewer.