Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/01/11 17:48:53 (13 years ago)
Author:
mkommend
Message:

#1479: Integrated trunk changes.

Location:
branches/GP.Grammar.Editor/HeuristicLab.Problems.QuadraticAssignment/3.3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/GP.Grammar.Editor/HeuristicLab.Problems.QuadraticAssignment/3.3/Analyzers/BestQAPSolutionAnalyzer.cs

    r6377 r6618  
    6161      get { return (LookupParameter<DoubleValue>)Parameters["BestKnownQuality"]; }
    6262    }
    63     public LookupParameter<ItemList<Permutation>> BestKnownSolutionsParameter {
    64       get { return (LookupParameter<ItemList<Permutation>>)Parameters["BestKnownSolutions"]; }
     63    public LookupParameter<ItemSet<Permutation>> BestKnownSolutionsParameter {
     64      get { return (LookupParameter<ItemSet<Permutation>>)Parameters["BestKnownSolutions"]; }
    6565    }
    6666    public LookupParameter<Permutation> BestKnownSolutionParameter {
     
    8484      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best QAP solution should be stored."));
    8585      Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this QAP instance."));
    86       Parameters.Add(new LookupParameter<ItemList<Permutation>>("BestKnownSolutions", "The best known solutions (there may be multiple) of this QAP instance."));
     86      Parameters.Add(new LookupParameter<ItemSet<Permutation>>("BestKnownSolutions", "The best known solutions (there may be multiple) of this QAP instance."));
    8787      Parameters.Add(new LookupParameter<Permutation>("BestKnownSolution", "The best known solution of this QAP instance."));
    8888    }
     
    9393      #region Backwards compatible code, remove with 3.4
    9494      if (!Parameters.ContainsKey("BestKnownSolutions")) {
    95         Parameters.Add(new LookupParameter<ItemList<Permutation>>("BestKnownSolutions", "The best known solutions of this QAP instance."));
     95        Parameters.Add(new LookupParameter<ItemSet<Permutation>>("BestKnownSolutions", "The best known solutions of this QAP instance."));
     96      } else if (Parameters["BestKnownSolutions"].GetType().Equals(typeof(LookupParameter<ItemList<Permutation>>))) {
     97        string actualName = (Parameters["BestKnownSolutions"] as LookupParameter<ItemList<Permutation>>).ActualName;
     98        Parameters.Remove("BestKnownSolutions");
     99        Parameters.Add(new LookupParameter<ItemSet<Permutation>>("BestKnownSolutions", "The best known solutions of this QAP instance.", actualName));
    96100      }
    97101      #endregion
     
    117121        BestKnownQualityParameter.ActualValue = new DoubleValue(qualities[i].Value);
    118122        BestKnownSolutionParameter.ActualValue = (Permutation)permutations[i].Clone();
    119         BestKnownSolutionsParameter.ActualValue = new ItemList<Permutation>();
     123        BestKnownSolutionsParameter.ActualValue = new ItemSet<Permutation>(new PermutationEqualityComparer());
    120124        BestKnownSolutionsParameter.ActualValue.Add((Permutation)permutations[i].Clone());
    121125      } else if (bestKnownQuality.Value == qualities[i].Value) {
     
    125129          BestKnownSolutionParameter.ActualValue = (Permutation)permutations[i].Clone();
    126130        if (BestKnownSolutionsParameter.ActualValue == null)
    127           BestKnownSolutionsParameter.ActualValue = new ItemList<Permutation>();
    128         PermutationEqualityComparer comparer = new PermutationEqualityComparer();
     131          BestKnownSolutionsParameter.ActualValue = new ItemSet<Permutation>(new PermutationEqualityComparer());
    129132        foreach (var k in sorted) { // for each solution that we found check if it is in the pool of best-knowns
    130133          if (!max && k.Value > qualities[i].Value
    131134            || max && k.Value < qualities[i].Value) break; // stop when we reached a solution worse than the best-known quality
    132135          Permutation p = permutations[k.index];
    133           bool alreadyPresent = false;
    134           foreach (Permutation p2 in BestKnownSolutionsParameter.ActualValue) {
    135             if (comparer.Equals(p, p2)) {
    136               alreadyPresent = true;
    137               break;
    138             }
    139           }
    140           if (!alreadyPresent)
     136          if (!BestKnownSolutionsParameter.ActualValue.Contains(p))
    141137            BestKnownSolutionsParameter.ActualValue.Add((Permutation)permutations[k.index].Clone());
    142138        }
  • branches/GP.Grammar.Editor/HeuristicLab.Problems.QuadraticAssignment/3.3/Plugin.cs.frame

    r6377 r6618  
    2323
    2424namespace HeuristicLab.Problems.QuadraticAssignment {
    25   [Plugin("HeuristicLab.Problems.QuadraticAssignment", "3.3.4.$WCREV$")]
     25  [Plugin("HeuristicLab.Problems.QuadraticAssignment", "3.3.5.$WCREV$")]
    2626  [PluginFile("HeuristicLab.Problems.QuadraticAssignment-3.3.dll", PluginFileType.Assembly)]
    2727  [PluginDependency("HeuristicLab.Analysis", "3.3")]
  • branches/GP.Grammar.Editor/HeuristicLab.Problems.QuadraticAssignment/3.3/Properties/AssemblyInfo.frame

    r6099 r6618  
    5555// [assembly: AssemblyVersion("1.0.*")]
    5656[assembly: AssemblyVersion("3.3.0.0")]
    57 [assembly: AssemblyFileVersion("3.3.4.$WCREV$")]
     57[assembly: AssemblyFileVersion("3.3.5.$WCREV$")]
  • branches/GP.Grammar.Editor/HeuristicLab.Problems.QuadraticAssignment/3.3/QuadraticAssignmentProblem.cs

    r6377 r6618  
    4949
    5050    #region Parameter Properties
    51     public IValueParameter<ItemList<Permutation>> BestKnownSolutionsParameter {
    52       get { return (IValueParameter<ItemList<Permutation>>)Parameters["BestKnownSolutions"]; }
     51    public IValueParameter<ItemSet<Permutation>> BestKnownSolutionsParameter {
     52      get { return (IValueParameter<ItemSet<Permutation>>)Parameters["BestKnownSolutions"]; }
    5353    }
    5454    public IValueParameter<Permutation> BestKnownSolutionParameter {
     
    6464
    6565    #region Properties
    66     public ItemList<Permutation> BestKnownSolutions {
     66    public ItemSet<Permutation> BestKnownSolutions {
    6767      get { return BestKnownSolutionsParameter.Value; }
    6868      set { BestKnownSolutionsParameter.Value = value; }
     
    113113    public QuadraticAssignmentProblem()
    114114      : base(new QAPEvaluator(), new RandomPermutationCreator()) {
    115       Parameters.Add(new OptionalValueParameter<ItemList<Permutation>>("BestKnownSolutions", "The list of best known solutions which is updated whenever a new better solution is found or may be the optimal solution if it is known beforehand.", null));
     115      Parameters.Add(new OptionalValueParameter<ItemSet<Permutation>>("BestKnownSolutions", "The list of best known solutions which is updated whenever a new better solution is found or may be the optimal solution if it is known beforehand.", null));
    116116      Parameters.Add(new OptionalValueParameter<Permutation>("BestKnownSolution", "The best known solution which is updated whenever a new better solution is found or may be the optimal solution if it is known beforehand.", null));
    117117      Parameters.Add(new ValueParameter<DoubleMatrix>("Weights", "The strength of the connection between the facilities.", new DoubleMatrix(5, 5)));
     
    152152      // BackwardsCompatibility3.3
    153153      #region Backwards compatible code, remove with 3.4
    154       /*if (Parameters.ContainsKey("BestKnownSolution")) {
    155         Permutation solution = ((IValueParameter<Permutation>)Parameters["BestKnownSolution"]).Value;
    156         Parameters.Remove("BestKnownSolution");
    157         Parameters.Add(new OptionalValueParameter<ItemList<Permutation>>("BestKnownSolutions", "The list of best known solutions which is updated whenever a new better solution is found or may be the optimal solution if it is known beforehand.", null));
    158         if (solution != null) {
    159           BestKnownSolutions = new ItemList<Permutation>();
    160           BestKnownSolutions.Add(solution);
    161         }
    162       }*/
    163154      if (!Parameters.ContainsKey("BestKnownSolutions")) {
    164         Parameters.Add(new OptionalValueParameter<ItemList<Permutation>>("BestKnownSolutions", "The list of best known solutions which is updated whenever a new better solution is found or may be the optimal solution if it is known beforehand.", null));
     155        Parameters.Add(new OptionalValueParameter<ItemSet<Permutation>>("BestKnownSolutions", "The list of best known solutions which is updated whenever a new better solution is found or may be the optimal solution if it is known beforehand.", null));
     156      } else if (Parameters["BestKnownSolutions"].GetType().Equals(typeof(OptionalValueParameter<ItemList<Permutation>>))) {
     157        ItemList<Permutation> list = ((OptionalValueParameter<ItemList<Permutation>>)Parameters["BestKnownSolutions"]).Value;
     158        Parameters.Remove("BestKnownSolutions");
     159        Parameters.Add(new OptionalValueParameter<ItemSet<Permutation>>("BestKnownSolutions", "The list of best known solutions which is updated whenever a new better solution is found or may be the optimal solution if it is known beforehand.", (list != null ? new ItemSet<Permutation>(list) : null)));
    165160      }
    166161      if (Parameters.ContainsKey("DistanceMatrix")) {
    167         DoubleMatrix bla = ((ValueParameter<DoubleMatrix>)Parameters["DistanceMatrix"]).Value;
     162        DoubleMatrix d = ((ValueParameter<DoubleMatrix>)Parameters["DistanceMatrix"]).Value;
    168163        Parameters.Remove("DistanceMatrix");
    169         Parameters.Add(new ValueParameter<DoubleMatrix>("Distances", "bla", bla));
     164        Parameters.Add(new ValueParameter<DoubleMatrix>("Distances", "The distance matrix which can either be specified directly without the coordinates, or can be calculated automatically from the coordinates.", d));
    170165      }
    171166      AttachEventHandlers();
     
    411406            if (solParser.Quality.IsAlmost(QAPEvaluator.Apply(new Permutation(PermutationTypes.Absolute, solParser.Assignment), Weights, Distances))) {
    412407              BestKnownQuality = new DoubleValue(solParser.Quality);
    413               BestKnownSolutions = new ItemList<Permutation>(new Permutation[] { new Permutation(PermutationTypes.Absolute, solParser.Assignment) });
     408              BestKnownSolutions = new ItemSet<Permutation>(new Permutation[] { new Permutation(PermutationTypes.Absolute, solParser.Assignment) }, new PermutationEqualityComparer());
    414409              BestKnownSolution = new Permutation(PermutationTypes.Absolute, solParser.Assignment);
    415410            } else {
     
    420415          } else {
    421416            BestKnownQuality = new DoubleValue(solParser.Quality);
    422             BestKnownSolutions = new ItemList<Permutation>(new Permutation[] { new Permutation(PermutationTypes.Absolute, solParser.Assignment) });
     417            BestKnownSolutions = new ItemSet<Permutation>(new Permutation[] { new Permutation(PermutationTypes.Absolute, solParser.Assignment) }, new PermutationEqualityComparer());
    423418            BestKnownSolution = new Permutation(PermutationTypes.Absolute, solParser.Assignment);
    424419          }
     
    426421      } else {
    427422        BestKnownQuality = null;
    428         BestKnownSolutions = null;
     423        BestKnownSolutions = new ItemSet<Permutation>(new PermutationEqualityComparer());
    429424        BestKnownSolution = null;
    430425      }
  • branches/GP.Grammar.Editor/HeuristicLab.Problems.QuadraticAssignment/3.3/Tests/Properties/AssemblyInfo.cs

    r5939 r6618  
    5353// by using the '*' as shown below:
    5454[assembly: AssemblyVersion("3.3.0.0")]
    55 [assembly: AssemblyFileVersion("3.3.0.0")]
     55[assembly: AssemblyFileVersion("3.3.5.0")]
Note: See TracChangeset for help on using the changeset viewer.