# Changeset 8322

Ignore:
Timestamp:
07/25/12 10:14:58 (7 years ago)
Message:
Location:
branches/ScatterSearch (trunk integration)
Files:
13 edited

Unmodified
Removed
• ## branches/ScatterSearch (trunk integration)/HeuristicLab.Algorithms.ScatterSearch/3.3/SolutionPoolUpdateMethod.cs

 r8319 using System; using System.Collections.Generic; using System.Linq; using HeuristicLab.Common; if (orderedOffspring.Any(hasBetterQuality)) { // produce the set union var union = orderedParents.Union(orderedOffspring.Where(hasBetterQuality), new SolutionEqualityComparer(SimilarityCalculator.CalculateSolutionSimilarity)); var union = orderedParents.Union(orderedOffspring.Where(hasBetterQuality), SimilarityCalculator); if (union.Count() > orderedParents.Count()) { var orderedUnion = Maximization.Value ? union.OrderByDescending(x => x.Variables[QualityParameter.ActualName].Value) : return base.Apply(); } // derive SingleObjectiveSolutionSimilarityCalculator from EqualityComparer // delete this ... public class SolutionEqualityComparer : EqualityComparer { private readonly Func similarityCalculator; public SolutionEqualityComparer(Func similarityCalculator) { this.similarityCalculator = similarityCalculator; } public override bool Equals(T x, T y) { if (object.ReferenceEquals(x, y)) return true; if (x == null || y == null) return false; return similarityCalculator(x, y) == 1.0; } public override int GetHashCode(T obj) { return 0; // return the same hash code for each object, otherwise Equals will not be called } } } }
• ## branches/ScatterSearch (trunk integration)/HeuristicLab.Optimization.Operators/3.3/SingleObjectiveSolutionSimilarityCalculator.cs

 r8319 #region Properties [Storable] public string SolutionVariableName { get; set; } [Storable] public string QualityVariableName { get; set; } [Storable] public string SolutionVariableName { get; set; } #endregion protected SingleObjectiveSolutionSimilarityCalculator(SingleObjectiveSolutionSimilarityCalculator original, Cloner cloner) : base(original, cloner) { if (original.QualityVariableName != null) this.QualityVariableName = (string)original.QualityVariableName.Clone(); this.SolutionVariableName = original.SolutionVariableName; this.QualityVariableName = original.QualityVariableName; } protected SingleObjectiveSolutionSimilarityCalculator() : base() { } public override int GetHashCode(IScope scope) { var quality = ((DoubleValue)scope.Variables[QualityVariableName].Value).Value; return quality.ToString().GetHashCode(); return ((DoubleValue)scope.Variables[QualityVariableName].Value).Value.GetHashCode(); } }
• ## branches/ScatterSearch (trunk integration)/HeuristicLab.Optimization.Operators/3.3/SolutionSimilarityCalculator.cs

 r8319 using System; using System.Collections.Generic; using System.Linq; using HeuristicLab.Common; [Item("SimilarityCalculator", "A base class for items that perform similarity calculation between two solutions.")] [StorableClass] public abstract class SolutionSimilarityCalculator : Item, ISolutionSimilarityCalculator, IEqualityComparer { public abstract class SolutionSimilarityCalculator : Item, ISolutionSimilarityCalculator { [StorableConstructor] protected SolutionSimilarityCalculator(bool deserializing) : base(deserializing) { }
• ## branches/ScatterSearch (trunk integration)/HeuristicLab.Optimization/3.3/Interfaces/ISingleObjectiveSolutionSimilarityCalculator.cs

 r8319 /// public interface ISingleObjectiveSolutionSimilarityCalculator : ISolutionSimilarityCalculator { string SolutionVariableName { get; set; } string QualityVariableName { get; set; } string SolutionVariableName { get; set; } } }
• ## branches/ScatterSearch (trunk integration)/HeuristicLab.Optimization/3.3/Interfaces/ISolutionSimilarityCalculator.cs

 r8319 #endregion using System.Collections.Generic; using HeuristicLab.Core; /// An interface which represents an operator for similarity calculation. /// public interface ISolutionSimilarityCalculator : IItem { public interface ISolutionSimilarityCalculator : IItem, IEqualityComparer { /// /// Calculates the similarity of two solutions.
• ## branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.Knapsack/3.3/KnapsackProblem.cs

 r8319 foreach (KnapsackSimilarityCalculator op in Operators.OfType()) { op.SolutionVariableName = SolutionCreator.BinaryVectorParameter.ActualName; op.QualityVariableName = Evaluator.QualityParameter.ActualName; } }
• ## branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.TestFunctions/3.3/Improvers/SingleObjectiveTestFunctionImprovementOperator.cs

 r8319 /// /// /// It is implemented as described in Gao, F. and Han, L. (2010). Implementing the Nelder-Mead simplex algorithm with adaptive parameters. Computational Optimization and Applications, Vol. 51. Springer.
/// The operator is an implementation of the Nelder-Mead method and conducts relection, expansion, contraction and reduction on the test functions solution. /// It is implemented as described in Laguna, M. and Martí, R. (2003). Scatter Search: Methodology and Implementations in C. Operations Research/Computer Science Interfaces Series, Vol. 24. Springer.
/// The operator uses an implementation of the Nelder-Mead method with adaptive parameters as described in Gao, F. and Han, L. (2010). Implementing the Nelder-Mead simplex algorithm with adaptive parameters. Computational Optimization and Applications, Vol. 51. Springer. and conducts relection, expansion, contraction and reduction on the test functions solution. ///
[Item("SingleObjectiveTestFunctionImprovementOperator", "An operator that improves test functions solutions.")]

 r8319 /// /// /// TODO: add reference and remarks /// It is implemented as described in Duarte, A., Martí, R., and Gortazar, F. (2011). Path Relinking for Large Scale Global Optimization. Soft Computing, Vol. 15. /// The operator incrementally assimilates the initiating solution into the guiding solution by adapting the solution vector's elements. /// [Item("SingleObjectiveTestFunctionPathRelinker", "An operator that relinks paths between test functions solutions.")]
• ## branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionProblem.cs

 r8319 foreach (SingleObjectiveTestFunctionSimilarityCalculator op in Operators.OfType()) { op.SolutionVariableName = SolutionCreator.RealVectorParameter.ActualName; op.QualityVariableName = Evaluator.QualityParameter.ActualName; op.Bounds = Bounds; }