Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/11/17 23:06:32 (7 years ago)
Author:
abeham
Message:

#1614: Improved performance by switching from Dictionary to Array

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves/NMoveAbsoluteAttribute.cs

    r15504 r15511  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using HeuristicLab.Common;
     
    3233
    3334    [Storable]
    34     public Dictionary<int, int> OldAssignments { get; private set; }
     35    public List<Tuple<int, int>> OldAssignments { get; private set; }
    3536    [Storable]
    3637    public double MoveQuality { get; private set; }
     
    4142    public NMoveAbsoluteTabuAttribute(NMove move, IntegerVector assignment, double moveQuality)
    4243      : base() {
    43       OldAssignments = new Dictionary<int, int>();
    44       foreach (var kvp in move.NewAssignments)
    45         OldAssignments.Add(kvp.Key, assignment[kvp.Key]);
     44      OldAssignments = new List<Tuple<int, int>>(move.N);
     45      foreach (var equip in move.Indices)
     46        OldAssignments.Add(Tuple.Create(equip, assignment[equip]));
    4647      MoveQuality = moveQuality;
    4748    }
Note: See TracChangeset for help on using the changeset viewer.