Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/17/11 22:51:11 (13 years ago)
Author:
abeham
Message:

#1541

  • updated to latest trunk version
Location:
branches/QAPAlgorithms
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/QAPAlgorithms

  • branches/QAPAlgorithms/HeuristicLab.Problems.QuadraticAssignment/3.3/QuadraticAssignmentProblem.cs

    r6416 r6569  
    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.", new ItemSet<Permutation>(list)));
    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      }
Note: See TracChangeset for help on using the changeset viewer.