Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2857


Ignore:
Timestamp:
02/24/10 11:44:05 (14 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • worked on algorithms
Location:
trunk/sources
Files:
6 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj

    r2852 r2857  
    5252    <None Include="HeuristicLabOptimizationPlugin.cs.frame" />
    5353    <Compile Include="Algorithm.cs" />
     54    <Compile Include="IManipulationOperator.cs" />
     55    <Compile Include="ICrossoverOperator.cs" />
     56    <Compile Include="IStochasticSolutionCreator.cs" />
     57    <Compile Include="IStochasticOperator.cs" />
    5458    <Compile Include="ISolutionCreator.cs" />
    5559    <Compile Include="SingleObjectiveProblem.cs" />
  • trunk/sources/HeuristicLab.Optimization/3.3/IProblem.cs

    r2852 r2857  
    2222using HeuristicLab.Core;
    2323using System;
     24using HeuristicLab.Common;
    2425
    2526namespace HeuristicLab.Optimization {
     
    3334    event EventHandler SolutionCreatorChanged;
    3435    event EventHandler EvaluatorChanged;
     36    event EventHandler<EventArgs<Type>> OperatorsChanged;
    3537  }
    3638}
  • trunk/sources/HeuristicLab.Optimization/3.3/ISolutionCreator.cs

    r2852 r2857  
    2727  /// An interface which represents an operator for creating new solutions.
    2828  /// </summary>
    29   public interface ISolutionCreator : IOperator {
    30     ILookupParameter<IRandom> RandomParameter { get; }
    31   }
     29  public interface ISolutionCreator : IOperator { }
    3230}
  • trunk/sources/HeuristicLab.Optimization/3.3/Problem.cs

    r2852 r2857  
    2525using HeuristicLab.Parameters;
    2626using System;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Optimization {
     
    100101        EvaluatorChanged(this, EventArgs.Empty);
    101102    }
     103    public event EventHandler<EventArgs<Type>> OperatorsChanged;
     104    protected virtual void OnOperatorsChanged(Type operatorType) {
     105      if (OperatorsChanged != null)
     106        OperatorsChanged(this, new EventArgs<Type>(operatorType));
     107    }
    102108  }
    103109}
  • trunk/sources/HeuristicLab.Permutation/3.3/HeuristicLab.Permutation-3.3.csproj

    r2854 r2857  
    9090      <SubType>Code</SubType>
    9191    </Compile>
     92    <Compile Include="IPermutationCrossoverOperator.cs" />
     93    <Compile Include="IPermutationManipulationOperator.cs" />
    9294    <Compile Include="MaximalPreservativeCrossover.cs" />
    9395    <Compile Include="OrderBasedCrossover.cs" />
  • trunk/sources/HeuristicLab.Permutation/3.3/PermutationCrossover.cs

    r2834 r2857  
    2222using HeuristicLab.Core;
    2323using HeuristicLab.Operators;
     24using HeuristicLab.Optimization;
    2425using HeuristicLab.Parameters;
    2526using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3132  [Item("PermutationCrossover", "A base class for permutation crossover operators.")]
    3233  [EmptyStorableClass]
    33   public abstract class PermutationCrossover : SingleSuccessorOperator {
    34     public LookupParameter<IRandom> RandomParameter {
     34  public abstract class PermutationCrossover : SingleSuccessorOperator, IPermutationCrossoverOperator {
     35    public ILookupParameter<IRandom> RandomParameter {
    3536      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
    3637    }
  • trunk/sources/HeuristicLab.Permutation/3.3/PermutationManipulator.cs

    r2834 r2857  
    2222using HeuristicLab.Core;
    2323using HeuristicLab.Operators;
     24using HeuristicLab.Optimization;
    2425using HeuristicLab.Parameters;
    2526using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3132  [Item("PermutationManipulator", "A base class for permutation manipulation operators.")]
    3233  [EmptyStorableClass]
    33   public abstract class PermutationManipulator : SingleSuccessorOperator {
    34     public LookupParameter<IRandom> RandomParameter {
     34  public abstract class PermutationManipulator : SingleSuccessorOperator, IPermutationManipulationOperator {
     35    public ILookupParameter<IRandom> RandomParameter {
    3536      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
    3637    }
  • trunk/sources/HeuristicLab.Permutation/3.3/Tests/HeuristicLab.Permutation-3.3.Tests.csproj

    r2854 r2857  
    8686      <Name>HeuristicLab.Operators-3.3</Name>
    8787    </ProjectReference>
     88    <ProjectReference Include="..\..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
     89      <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
     90      <Name>HeuristicLab.Optimization-3.3</Name>
     91    </ProjectReference>
    8892    <ProjectReference Include="..\..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
    8993      <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project>
  • trunk/sources/HeuristicLab.Routing.TSP/3.3/TSP.cs

    r2852 r2857  
    2626using HeuristicLab.Permutation;
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using System;
    2829
    2930namespace HeuristicLab.Routing.TSP {
  • trunk/sources/HeuristicLab.SGA/3.3/SGA.cs

    r2852 r2857  
    106106
    107107    protected override void OnProblemChanged() {
    108       Problem.SolutionCreator.RandomParameter.ActualName = "Random";
     108      if (Problem.SolutionCreator is IStochasticSolutionCreator) ((IStochasticSolutionCreator)Problem.SolutionCreator).RandomParameter.ActualName = "Random";
    109109      populationCreator.SolutionCreatorParameter.Value = Problem.SolutionCreator;
    110110      populationCreator.SolutionEvaluatorParameter.Value = Problem.Evaluator;
     
    115115    }
    116116    protected override void Problem_SolutionCreatorChanged(object sender, EventArgs e) {
    117       Problem.SolutionCreator.RandomParameter.ActualName = "Random";
     117      if (Problem.SolutionCreator is IStochasticSolutionCreator) ((IStochasticSolutionCreator)Problem.SolutionCreator).RandomParameter.ActualName = "Random";
    118118      populationCreator.SolutionCreatorParameter.Value = Problem.SolutionCreator;
    119119      base.Problem_SolutionCreatorChanged(sender, e);
Note: See TracChangeset for help on using the changeset viewer.