Changeset 12106


Ignore:
Timestamp:
03/03/15 11:56:58 (6 years ago)
Author:
jkarder
Message:

#2332: fixed build fail

  • algorithms add generic similarity calculators if needed (i.e. problem does not provide similarity calculators)
  • added pragmas to suppress obsolete warnings
Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.RAPGA/3.3/RAPGA.cs

    r12102 r12106  
    206206      }
    207207      if (Parameters.ContainsKey("SimilarityCalculator")) {
     208#pragma warning disable 0618
    208209        var oldParameter = (IConstrainedValueParameter<ISingleObjectiveSolutionSimilarityCalculator>)Parameters["SimilarityCalculator"];
     210#pragma warning restore 0618
    209211        Parameters.Remove(oldParameter);
    210212        var newParameter = new ConstrainedValueParameter<ISolutionSimilarityCalculator>("SimilarityCalculator", "The operator used to calculate the similarity between two solutions.", new ItemSet<ISolutionSimilarityCalculator>(oldParameter.ValidValues));
     
    508510        SimilarityCalculatorParameter.ValidValues.Add(similarityCalculator);
    509511
     512      if (!SimilarityCalculatorParameter.ValidValues.Any()) {
     513        SimilarityCalculatorParameter.ValidValues.Add(new QualitySimilarityCalculator { QualityVariableName = Problem.Evaluator.QualityParameter.ActualName });
     514        SimilarityCalculatorParameter.ValidValues.Add(new NoSimilarityCalculator());
     515      }
     516
    510517      if (oldSimilarityCalculator != null) {
    511518        ISolutionSimilarityCalculator similarityCalculator = SimilarityCalculatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldSimilarityCalculator.GetType());
  • trunk/sources/HeuristicLab.Algorithms.ScatterSearch/3.3/ScatterSearch.cs

    r12102 r12106  
    163163      #region Backwards compatible code, remove with 3.4
    164164      if (Parameters.ContainsKey("SimilarityCalculator")) {
     165#pragma warning disable 0618
    165166        var oldParameter = (IConstrainedValueParameter<ISingleObjectiveSolutionSimilarityCalculator>)Parameters["SimilarityCalculator"];
     167#pragma warning restore 0618
    166168        Parameters.Remove(oldParameter);
    167169        var newParameter = new ConstrainedValueParameter<ISolutionSimilarityCalculator>("SimilarityCalculator", "The operator used to calculate the similarity between two solutions.", new ItemSet<ISolutionSimilarityCalculator>(oldParameter.ValidValues));
     
    408410        SimilarityCalculatorParameter.ValidValues.Add(similarityCalculator);
    409411
     412      if (!SimilarityCalculatorParameter.ValidValues.Any()) {
     413        SimilarityCalculatorParameter.ValidValues.Add(new QualitySimilarityCalculator { QualityVariableName = Problem.Evaluator.QualityParameter.ActualName });
     414        SimilarityCalculatorParameter.ValidValues.Add(new NoSimilarityCalculator());
     415      }
     416
    410417      if (oldSimilarityCalculator != null) {
    411418        ISolutionSimilarityCalculator similarityCalculator = SimilarityCalculatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldSimilarityCalculator.GetType());
  • trunk/sources/HeuristicLab.Optimization.Operators/3.3/SingleObjectiveSolutionSimilarityCalculator.cs

    r12085 r12106  
    3131  [Item("SimilarityCalculator", "A base class for items that perform similarity calculation between two solutions.")]
    3232  [StorableClass]
     33#pragma warning disable 0618
    3334  public abstract class SingleObjectiveSolutionSimilarityCalculator : SolutionSimilarityCalculator, ISingleObjectiveSolutionSimilarityCalculator {
     35#pragma warning restore 0618
    3436    [StorableConstructor]
    3537    protected SingleObjectiveSolutionSimilarityCalculator(bool deserializing) : base(deserializing) { }
Note: See TracChangeset for help on using the changeset viewer.