Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/07/17 14:05:09 (7 years ago)
Author:
epitzer
Message:

#2727 completely replace basic array with array mapped trie in ValueTypeArray and descendants

Location:
branches/PersistentDataStructures/HeuristicLab.Problems.VehicleRouting/3.4/Encodings
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/PersistentDataStructures/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/AlbaEncoding.cs

    r14186 r14650  
    4040
    4141      Tour tour = new Tour();
    42       for (int i = 0; i < this.array.Length; i++) {
    43         if (this.array[i] >= cities) {
     42      for (int i = 0; i < this.historyArray.Length; i++) {
     43        if (this.historyArray[i] >= cities) {
    4444          if (tour.Stops.Count > 0) {
    4545            result.Add(tour);
     
    4848          }
    4949        } else {
    50           tour.Stops.Add(this.array[i] + 1);
     50          tour.Stops.Add(this.historyArray[i] + 1);
    5151        }
    5252      }
     
    7272
    7373        while (vehicleAssignment == -1) {
    74           if (this.array[i] >= ProblemInstance.Cities.Value) {
    75             vehicleAssignment = this.array[i] - ProblemInstance.Cities.Value;
     74          if (this.historyArray[i] >= ProblemInstance.Cities.Value) {
     75            vehicleAssignment = this.historyArray[i] - ProblemInstance.Cities.Value;
    7676          }
    7777
  • branches/PersistentDataStructures/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/PermutationEncoding.cs

    r14186 r14650  
    2424using HeuristicLab.Common;
    2525using HeuristicLab.Core;
     26using HeuristicLab.Data.PersistentDataStructures.Adaptations;
    2627using HeuristicLab.Encodings.PermutationEncoding;
    2728using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    6970    public PermutationEncoding(Permutation permutation, IVRPProblemInstance problemInstance)
    7071      : base(PermutationTypes.RelativeUndirected) {
    71       this.array = new int[permutation.Length];
    72       for (int i = 0; i < array.Length; i++)
    73         this.array[i] = permutation[i];
     72      this.historyArray = new HistoryArray<int>(permutation.Length);
     73      for (int i = 0; i < historyArray.Length; i++)
     74        this.historyArray[i] = permutation[i];
    7475
    7576      this.ProblemInstance = problemInstance;
     
    8283
    8384    public int IndexOf(int city) {
    84       return Array.IndexOf(this.array, city);
     85      return historyArray.IndexOf(city);
    8586    }
    8687  }
  • branches/PersistentDataStructures/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Prins/PrinsEncoding.cs

    r14186 r14650  
    102102
    103103        //find predecessor / successor in permutation
    104         int predecessorIndex = Array.IndexOf(this.array, tour.Stops[0] - 1) - 1;
     104        int predecessorIndex = historyArray.IndexOf(tour.Stops[0] - 1) - 1;
    105105        if (predecessorIndex >= 0) {
    106106          int predecessor = this[predecessorIndex] + 1;
     
    114114          }
    115115        } else {
    116           int successorIndex = Array.IndexOf(this.array,
     116          int successorIndex = historyArray.IndexOf(
    117117            tour.Stops[tour.Stops.Count - 1] - 1) + 1;
    118118          int successor = this[successorIndex] + 1;
  • branches/PersistentDataStructures/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Zhu/ZhuEncoding.cs

    r14186 r14650  
    6363
    6464        //find predecessor / successor in permutation
    65         int predecessorIndex = Array.IndexOf(this.array, tour.Stops[0] - 1) - 1;
     65        int predecessorIndex = historyArray.IndexOf(tour.Stops[0] - 1) - 1;
    6666        if (predecessorIndex >= 0) {
    6767          int predecessor = this[predecessorIndex] + 1;
     
    7575          }
    7676        } else {
    77           int successorIndex = Array.IndexOf(this.array,
     77          int successorIndex = historyArray.IndexOf(
    7878            tour.Stops[tour.Stops.Count - 1] - 1) + 1;
    7979          int successor = this[successorIndex] + 1;
Note: See TracChangeset for help on using the changeset viewer.