Changeset 18186


Ignore:
Timestamp:
01/12/22 14:49:45 (9 days ago)
Author:
pfleck
Message:

#3040 Added first version of SegmentOptimization Mutators.

Location:
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj

    r18092 r18186  
    176176    <Compile Include="Mutators\MultiSymbolicDataAnalysisExpressionManipulator.cs" />
    177177    <Compile Include="Interfaces\ISymbolicDataAnalysisExpressionManipulator.cs" />
     178    <Compile Include="Mutators\SegmentOptimization\SamplingSegmentOptimizationManipulator.cs" />
    178179    <Compile Include="Mutators\SymbolicDataAnalysisExpressionManipulator.cs" />
    179180    <Compile Include="Crossovers\SymbolicDataAnalysisExpressionDiversityPreservingCrossover.cs" />
     
    205206    <Compile Include="Interpreter\SymbolicDataAnalysisExpressionTreeNativeInterpreter.cs" />
    206207    <Compile Include="Mutators\SubVectorImprovementManipulator.cs" />
     208    <Compile Include="Mutators\SegmentOptimization\SegmentOptimizationMutator.cs" />
    207209    <Compile Include="SegmentOptimization\SegmentOptimizationProblem.cs" />
    208210    <Compile Include="Selectors\DiversitySelector.cs" />
     
    463465    </ProjectReference>
    464466  </ItemGroup>
    465   <ItemGroup />
     467  <ItemGroup>
     468    <PackageReference Include="OneOf">
     469      <Version>3.0.205</Version>
     470    </PackageReference>
     471  </ItemGroup>
    466472  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    467473  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SegmentOptimization/SegmentOptimizationProblem.cs

    r18098 r18186  
    2929using HeuristicLab.Optimization;
    3030using HeuristicLab.Parameters;
     31using HeuristicLab.PluginInfrastructure;
    3132using HeuristicLab.Problems.Instances;
    3233using HeuristicLab.Problems.Instances.Types;
     
    8182      });
    8283      #endregion
     84
     85      var optMutators = ApplicationManager.Manager.GetInstances<SegmentOptimizationMutator>();
     86      Encoding.ConfigureOperators(optMutators);
     87      Operators.AddRange(optMutators);
    8388    }
    8489    private SegmentOptimizationProblem(SegmentOptimizationProblem original, Cloner cloner)
     
    126131      var knownBounds = KnownBoundsParameter.Value;
    127132      var aggregation = aggregationParameter.Value.Value;
    128 
    129133      var solution = individual.IntegerVector(Encoding.Name);
     134      return Evaluate(solution, data, knownBounds, aggregation);
     135    }
     136
     137    public static double Evaluate(IntegerVector solution, DoubleMatrix data, IntRange knownBounds, Aggregation aggregation) {
    130138      var bounds = new IntRange(solution.Min(), solution.Max());
    131 
    132139      double target = BoundedAggregation(data, knownBounds, aggregation);
    133140      double prediction = BoundedAggregation(data, bounds, aggregation);
    134 
    135141      return Math.Pow(target - prediction, 2);
    136142    }
Note: See TracChangeset for help on using the changeset viewer.