Changeset 6569 for branches/QAPAlgorithms/HeuristicLab.Problems.QuadraticAssignment/3.3/QuadraticAssignmentProblem.cs
- Timestamp:
- 07/17/11 22:51:11 (13 years ago)
- Location:
- branches/QAPAlgorithms
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/QAPAlgorithms
- Property svn:ignore
-
old new 12 12 *.psess 13 13 *.vsp 14 *.docstates
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/QAPAlgorithms/HeuristicLab.Problems.QuadraticAssignment/3.3/QuadraticAssignmentProblem.cs
r6416 r6569 49 49 50 50 #region Parameter Properties 51 public IValueParameter<Item List<Permutation>> BestKnownSolutionsParameter {52 get { return (IValueParameter<Item List<Permutation>>)Parameters["BestKnownSolutions"]; }51 public IValueParameter<ItemSet<Permutation>> BestKnownSolutionsParameter { 52 get { return (IValueParameter<ItemSet<Permutation>>)Parameters["BestKnownSolutions"]; } 53 53 } 54 54 public IValueParameter<Permutation> BestKnownSolutionParameter { … … 64 64 65 65 #region Properties 66 public Item List<Permutation> BestKnownSolutions {66 public ItemSet<Permutation> BestKnownSolutions { 67 67 get { return BestKnownSolutionsParameter.Value; } 68 68 set { BestKnownSolutionsParameter.Value = value; } … … 113 113 public QuadraticAssignmentProblem() 114 114 : base(new QAPEvaluator(), new RandomPermutationCreator()) { 115 Parameters.Add(new OptionalValueParameter<Item List<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)); 116 116 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)); 117 117 Parameters.Add(new ValueParameter<DoubleMatrix>("Weights", "The strength of the connection between the facilities.", new DoubleMatrix(5, 5))); … … 152 152 // BackwardsCompatibility3.3 153 153 #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 }*/163 154 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))); 165 160 } 166 161 if (Parameters.ContainsKey("DistanceMatrix")) { 167 DoubleMatrix bla= ((ValueParameter<DoubleMatrix>)Parameters["DistanceMatrix"]).Value;162 DoubleMatrix d = ((ValueParameter<DoubleMatrix>)Parameters["DistanceMatrix"]).Value; 168 163 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)); 170 165 } 171 166 AttachEventHandlers(); … … 411 406 if (solParser.Quality.IsAlmost(QAPEvaluator.Apply(new Permutation(PermutationTypes.Absolute, solParser.Assignment), Weights, Distances))) { 412 407 BestKnownQuality = new DoubleValue(solParser.Quality); 413 BestKnownSolutions = new Item List<Permutation>(new Permutation[] { new Permutation(PermutationTypes.Absolute, solParser.Assignment) });408 BestKnownSolutions = new ItemSet<Permutation>(new Permutation[] { new Permutation(PermutationTypes.Absolute, solParser.Assignment) }, new PermutationEqualityComparer()); 414 409 BestKnownSolution = new Permutation(PermutationTypes.Absolute, solParser.Assignment); 415 410 } else { … … 420 415 } else { 421 416 BestKnownQuality = new DoubleValue(solParser.Quality); 422 BestKnownSolutions = new Item List<Permutation>(new Permutation[] { new Permutation(PermutationTypes.Absolute, solParser.Assignment) });417 BestKnownSolutions = new ItemSet<Permutation>(new Permutation[] { new Permutation(PermutationTypes.Absolute, solParser.Assignment) }, new PermutationEqualityComparer()); 423 418 BestKnownSolution = new Permutation(PermutationTypes.Absolute, solParser.Assignment); 424 419 } … … 426 421 } else { 427 422 BestKnownQuality = null; 428 BestKnownSolutions = n ull;423 BestKnownSolutions = new ItemSet<Permutation>(new PermutationEqualityComparer()); 429 424 BestKnownSolution = null; 430 425 }
Note: See TracChangeset
for help on using the changeset viewer.