Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/29/11 15:40:01 (13 years ago)
Author:
svonolfe
Message:

Merged changes from trunk into branch (#1177)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/CustomerRelocation/PotvinCustomerRelocationMoveMaker.cs

    r5202 r5867  
    101101      PotvinCustomerRelocationMove move = CustomerRelocationMoveParameter.ActualValue;
    102102
    103       PotvinEncoding newSolution = move.Individual as PotvinEncoding;
     103      PotvinEncoding newSolution = move.Individual.Clone() as PotvinEncoding;
    104104      Apply(newSolution, move);
    105105      VRPToursParameter.ActualValue = newSolution;
     
    125125      string key = AdditionFrequencyMemoryKeyParameter.Value.Value;
    126126
    127       if (!memory.ContainsKey(key)) {
    128         memory.Add(new Variable(key,
    129             new ItemDictionary<PotvinCustomerRelocationMoveAttribute, IntValue>()));
     127      if (memory != null) {
     128        if (!memory.ContainsKey(key)) {
     129          memory.Add(new Variable(key,
     130              new ItemDictionary<PotvinCustomerRelocationMoveAttribute, IntValue>()));
     131        }
     132        ItemDictionary<PotvinCustomerRelocationMoveAttribute, IntValue> additionFrequency =
     133          memory[key].Value as ItemDictionary<PotvinCustomerRelocationMoveAttribute, IntValue>;
     134
     135        PotvinCustomerRelocationMoveAttribute attr = new PotvinCustomerRelocationMoveAttribute(0, move.Tour, move.City);
     136        if (!additionFrequency.ContainsKey(attr))
     137          additionFrequency[attr] = new IntValue(0);
     138
     139        additionFrequency[attr].Value++;
    130140      }
    131       ItemDictionary<PotvinCustomerRelocationMoveAttribute, IntValue> additionFrequency =
    132         memory[key].Value as ItemDictionary<PotvinCustomerRelocationMoveAttribute, IntValue>;
    133 
    134       PotvinCustomerRelocationMoveAttribute attr = new PotvinCustomerRelocationMoveAttribute(0, move.Tour, move.City);
    135       if (!additionFrequency.ContainsKey(attr))
    136         additionFrequency[attr] = new IntValue(0);
    137 
    138       additionFrequency[attr].Value++;
    139141    }
    140142  }
Note: See TracChangeset for help on using the changeset viewer.