Ignore:
Timestamp:
02/03/21 22:03:22 (16 months ago)
Author:
bburlacu
Message:

#3048: Disable the ContextAware and DeterministicBest crossovers in the SymbolicDataAnalysisMultiObjectiveProblem.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisMultiObjectiveProblem.cs

    r17180 r17832  
    2121
    2222using System.Linq;
     23using HEAL.Attic;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     27using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2628using HeuristicLab.Optimization;
    2729using HeuristicLab.Parameters;
    28 using HEAL.Attic;
    2930
    3031namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    3132  [StorableType("E9876DF8-ACFA-41C8-93B7-FA40C57CE459")]
    3233  public abstract class SymbolicDataAnalysisMultiObjectiveProblem<T, U, V> : SymbolicDataAnalysisProblem<T, U, V>, ISymbolicDataAnalysisMultiObjectiveProblem
    33     where T : class,IDataAnalysisProblemData
     34    where T : class, IDataAnalysisProblemData
    3435    where U : class, ISymbolicDataAnalysisMultiObjectiveEvaluator<T>
    3536    where V : class, ISymbolicDataAnalysisSolutionCreator {
     
    9798        op.MaximizationParameter.ActualName = MaximizationParameterName;
    9899      }
     100
     101      // these two crossover operators are compatible with single-objective problems only so we remove them from the operators collection
     102      bool pred(IItem x) {
     103        return x is SymbolicDataAnalysisExpressionDeterministicBestCrossover<T> || x is SymbolicDataAnalysisExpressionContextAwareCrossover<T>;
     104      };
     105      Operators.RemoveAll(pred);
     106      // if a multi crossover is present, remove them from its operator collection
     107      var cx = Operators.FirstOrDefault(x => x is MultiSymbolicDataAnalysisExpressionCrossover<T>);
     108      if (cx != null) {
     109        var multiCrossover = (MultiSymbolicDataAnalysisExpressionCrossover<T>)cx;
     110        var items = multiCrossover.Operators.Where(pred).Cast<ISymbolicExpressionTreeCrossover>().ToList();
     111        foreach (var item in items) {
     112          multiCrossover.Operators.Remove(item);
     113        }
     114      }
    99115    }
    100116  }
Note: See TracChangeset for help on using the changeset viewer.