Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4045


Ignore:
Timestamp:
07/19/10 15:24:32 (14 years ago)
Author:
abeham
Message:

#1040

  • Added first possibly working NSGA-II
  • Added Maximization parameter to IMultiObjectiveProblem and IMultiObjectiveSelector
Location:
trunk/sources
Files:
2 added
9 edited

Legend:

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

    r4041 r4045  
    3333namespace HeuristicLab.Algorithms.NSGA2 {
    3434  public class CrowdedTournamentSelector : Selector, IMultiObjectiveSelector, IStochasticOperator {
    35 
     35    public ILookupParameter<BoolArray> MaximizationParameter {
     36      get { return (ILookupParameter<BoolArray>)Parameters["Maximization"]; }
     37    }
     38    public IValueLookupParameter<IntValue> NumberOfSelectedSubScopesParameter {
     39      get { return (IValueLookupParameter<IntValue>)Parameters["NumberOfSelectedSubScopes"]; }
     40    }
     41    public IValueParameter<BoolValue> CopySelectedParameter {
     42      get { return (IValueParameter<BoolValue>)Parameters["CopySelected"]; }
     43    }
     44    public ILookupParameter<IRandom> RandomParameter {
     45      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
     46    }
    3647    public ILookupParameter<ItemArray<DoubleArray>> QualitiesParameter {
    3748      get { return (ILookupParameter<ItemArray<DoubleArray>>)Parameters["Qualities"]; }
     
    4354      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["CrowdingDistance"]; }
    4455    }
    45     public IValueParameter<BoolValue> CopySelectedParameter {
    46       get { return (IValueParameter<BoolValue>)Parameters["CopySelected"]; }
    47     }
    48     public ILookupParameter<IRandom> RandomParameter {
    49       get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
    50     }
    5156    public IValueLookupParameter<IntValue> GroupSizeParameter {
    5257      get { return (IValueLookupParameter<IntValue>)Parameters["GroupSize"]; }
     
    5661      get { return CopySelectedParameter.Value; }
    5762      set { CopySelectedParameter.Value = value; }
    58     }
    59 
    60     public IValueLookupParameter<IntValue> NumberOfSelectedSubScopesParameter {
    61       get { return (IValueLookupParameter<IntValue>)Parameters["NumberOfSelectedSubScopes"]; }
    6263    }
    6364
  • trunk/sources/HeuristicLab.Algorithms.NSGA2/3.3/FastNonDominatedSort.cs

    r4040 r4045  
    3939    private enum DominationResult { Dominates, IsDominated, IsNonDominated };
    4040
    41     public IValueLookupParameter<BoolArray> MaximizationsParameter {
    42       get { return (IValueLookupParameter<BoolArray>)Parameters["Maximizations"]; }
     41    public IValueLookupParameter<BoolArray> MaximizationParameter {
     42      get { return (IValueLookupParameter<BoolArray>)Parameters["Maximization"]; }
    4343    }
    4444
     
    5252
    5353    public FastNonDominatedSort() {
    54       Parameters.Add(new ValueLookupParameter<BoolArray>("Maximizations", "Whether each objective is maximization or minimization."));
     54      Parameters.Add(new ValueLookupParameter<BoolArray>("Maximization", "Whether each objective is maximization or minimization."));
    5555      Parameters.Add(new ScopeTreeLookupParameter<DoubleArray>("Qualities", "The qualities of a solution.", 1));
    5656      Parameters.Add(new ScopeTreeLookupParameter<IntValue>("Rank", "The rank of a solution.", 1));
     
    5858
    5959    public override IOperation Apply() {
    60       BoolArray maximizations = MaximizationsParameter.ActualValue;
     60      BoolArray maximization = MaximizationParameter.ActualValue;
    6161      ItemArray<DoubleArray> qualities = QualitiesParameter.ActualValue;
    6262      if (qualities == null) throw new InvalidOperationException(Name + ": No qualities found.");
     
    7474        dominatedScopes[p] = new List<int>();
    7575        for (int qI = pI + 1; qI < populationSize; qI++) {
    76           DominationResult test = Dominates(qualities[pI], qualities[qI], maximizations);
     76          DominationResult test = Dominates(qualities[pI], qualities[qI], maximization);
    7777          if (test == DominationResult.Dominates) {
    7878            dominatedScopes[p].Add(qI);
     
    137137    }
    138138
    139     /*private bool Dominates(DoubleArray left, DoubleArray right, BoolArray maximizations) {
    140       for (int i = 0; i < left.Length; i++) {
    141         if (IsDominated(left[i], right[i], maximizations[i]))
    142           return false;
    143       }
    144       return true;
    145     }*/
    146 
    147139    private bool IsDominated(double left, double right, bool maximization) {
    148140      return maximization && left < right
  • trunk/sources/HeuristicLab.Algorithms.NSGA2/3.3/HeuristicLab.Algorithms.NSGA2-3.3.csproj

    r4041 r4045  
    7979    <Compile Include="CrowdedTournamentSelector.cs" />
    8080    <Compile Include="CrowdingDistanceAssignment.cs" />
     81    <Compile Include="DefaultCrossover.cs" />
    8182    <Compile Include="FastNonDominatedSort.cs" />
    8283    <Compile Include="HeuristicLabAlgorithmsNSGA2Plugin.cs" />
     
    8485    <Compile Include="NSGA2MainLoop.cs" />
    8586    <Compile Include="Properties\AssemblyInfo.cs" />
     87    <Compile Include="RankAndCrowdingSorter.cs" />
    8688    <None Include="Properties\AssemblyInfo.frame" />
    8789  </ItemGroup>
  • trunk/sources/HeuristicLab.Algorithms.NSGA2/3.3/NSGA2.cs

    r4017 r4045  
    3232using HeuristicLab.Optimization.Operators;
    3333using HeuristicLab.PluginInfrastructure;
     34using HeuristicLab.Selection;
     35using HeuristicLab.Operators;
    3436
    3537namespace HeuristicLab.Algorithms.NSGA2 {
     
    131133      get { return (SolutionsCreator)RandomCreator.Successor; }
    132134    }
     135    private RankAndCrowdingSorter RankAndCrowdingSorter {
     136      get { return (RankAndCrowdingSorter)SolutionsCreator.Successor; }
     137    }
    133138    private NSGA2MainLoop MainLoop {
    134       get { return (NSGA2MainLoop)SolutionsCreator.Successor; }
     139      get { return (NSGA2MainLoop)RankAndCrowdingSorter.Successor; }
    135140    }
    136141    #endregion
     
    143148      Parameters.Add(new ValueParameter<IntValue>("PopulationSize", "The size of the population of solutions.", new IntValue(100)));
    144149      Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction."));
    145       Parameters.Add(new ValueParameter<PercentValue>("CrossoverProbability", "The probability that the crossover operator is applied on two parents.", new PercentValue(0.05)));
     150      Parameters.Add(new ValueParameter<PercentValue>("CrossoverProbability", "The probability that the crossover operator is applied on two parents.", new PercentValue(0.9)));
    146151      Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
    147152      Parameters.Add(new ValueParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new PercentValue(0.05)));
     
    152157      RandomCreator randomCreator = new RandomCreator();
    153158      SolutionsCreator solutionsCreator = new SolutionsCreator();
     159      RankAndCrowdingSorter rankAndCrowdingSorter = new RankAndCrowdingSorter();
    154160      NSGA2MainLoop mainLoop = new NSGA2MainLoop();
    155161      OperatorGraph.InitialOperator = randomCreator;
     
    163169
    164170      solutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name;
    165       solutionsCreator.Successor = mainLoop;
    166 
     171      solutionsCreator.Successor = rankAndCrowdingSorter;
     172
     173      rankAndCrowdingSorter.CrowdingDistanceParameter.ActualName = "CrowdingDistance";
     174      rankAndCrowdingSorter.RankParameter.ActualName = "Rank";
     175      rankAndCrowdingSorter.Successor = mainLoop;
     176
     177      mainLoop.PopulationSizeParameter.ActualName = PopulationSizeParameter.Name;
    167178      mainLoop.SelectorParameter.ActualName = SelectorParameter.Name;
    168179      mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
     
    175186      mainLoop.ResultsParameter.ActualName = "Results";
    176187
    177       foreach (ISelector selector in ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name))
     188      foreach (ISelector selector in ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is ISingleObjectiveSelector)).OrderBy(x => x.Name))
    178189        SelectorParameter.ValidValues.Add(selector);
    179       ISelector proportionalSelector = SelectorParameter.ValidValues.FirstOrDefault(x => x.GetType().Name.Equals("ProportionalSelector"));
    180       if (proportionalSelector != null) SelectorParameter.Value = proportionalSelector;
    181      
    182       // TODO: parameterize selectors
     190      ISelector tournamentSelector = SelectorParameter.ValidValues.FirstOrDefault(x => x.GetType().Name.Equals("CrowdedTournamentSelector"));
     191      if (tournamentSelector != null) SelectorParameter.Value = tournamentSelector;
     192
     193      ParameterizeSelectors();
    183194
    184195      AttachEventHandlers();
     
    193204    #region Events
    194205    protected override void OnProblemChanged() {
    195       // parameterize pretty much everything
     206      ParameterizeStochasticOperator(Problem.SolutionCreator);
     207      ParameterizeStochasticOperator(Problem.Evaluator);
     208      foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     209      ParameterizeSolutionsCreator();
     210      ParameterizeMainLoop();
     211      ParameterizeSelectors();
     212      ParameterizeAnalyzers();
     213      ParameterizeIterationBasedOperators();
     214      UpdateCrossovers();
     215      UpdateMutators();
     216      UpdateAnalyzers();
     217      Problem.Evaluator.QualitiesParameter.ActualNameChanged += new EventHandler(Evaluator_QualitiesParameter_ActualNameChanged);
    196218      base.OnProblemChanged();
    197219    }
    198220    protected override void Problem_SolutionCreatorChanged(object sender, EventArgs e) {
    199       // parameterize SolutionCreator
     221      ParameterizeStochasticOperator(Problem.SolutionCreator);
     222      ParameterizeSolutionsCreator();
    200223      base.Problem_SolutionCreatorChanged(sender, e);
    201224    }
    202225    protected override void Problem_EvaluatorChanged(object sender, EventArgs e) {
    203       // parameterize StochasticOperators
    204       // parameterize SolutionsCreator
    205       // parameterize MainLoop
    206       // parameterize Selectors
    207       // parameterize Analyzers
     226      ParameterizeStochasticOperator(Problem.Evaluator);
     227      ParameterizeSolutionsCreator();
     228      ParameterizeMainLoop();
     229      ParameterizeSelectors();
     230      ParameterizeAnalyzers();
    208231      Problem.Evaluator.QualitiesParameter.ActualNameChanged += new EventHandler(Evaluator_QualitiesParameter_ActualNameChanged);
    209232      base.Problem_EvaluatorChanged(sender, e);
    210233    }
    211234    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
     235      foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
     236      ParameterizeIterationBasedOperators();
     237      UpdateCrossovers();
     238      UpdateMutators();
     239      UpdateAnalyzers();
    212240      base.Problem_OperatorsChanged(sender, e);
    213241    }
     
    215243      base.Problem_Reset(sender, e);
    216244    }
    217 
    218245    private void PopulationSizeParameter_ValueChanged(object sender, EventArgs e) {
    219246      PopulationSize.ValueChanged += new EventHandler(PopulationSize_ValueChanged);
    220       // parameterize Selectors
     247      ParameterizeSelectors();
    221248    }
    222249    private void PopulationSize_ValueChanged(object sender, EventArgs e) {
    223       // parameterize Selectors
    224     }
    225 
     250      ParameterizeSelectors();
     251    }
    226252    private void Evaluator_QualitiesParameter_ActualNameChanged(object sender, EventArgs e) {
    227       // parameterize Analyzers
    228       // parameterize MainLoop
    229       // parameterize Selectors
     253      ParameterizeMainLoop();
     254      ParameterizeSelectors();
     255      ParameterizeAnalyzers();
    230256    }
    231257    #endregion
     
    240266      }
    241267    }
     268    private void ParameterizeSolutionsCreator() {
     269      SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
     270      SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name;
     271    }
     272    private void ParameterizeMainLoop() {
     273      MainLoop.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
     274      MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
     275      MainLoop.QualitiesParameter.ActualName = Problem.Evaluator.QualitiesParameter.ActualName;
     276    }
     277    private void ParameterizeStochasticOperator(IOperator op) {
     278      if (op is IStochasticOperator)
     279        ((IStochasticOperator)op).RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
     280    }
     281    private void ParameterizeSelectors() {
     282      foreach (ISelector selector in SelectorParameter.ValidValues) {
     283        selector.CopySelected = new BoolValue(true);
     284        selector.NumberOfSelectedSubScopesParameter.Value = new IntValue(2 * PopulationSizeParameter.Value.Value);
     285        ParameterizeStochasticOperator(selector);
     286      }
     287      if (Problem != null) {
     288        foreach (IMultiObjectiveSelector selector in SelectorParameter.ValidValues.OfType<IMultiObjectiveSelector>()) {
     289          selector.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
     290          selector.QualitiesParameter.ActualName = Problem.Evaluator.QualitiesParameter.ActualName;
     291        }
     292      }
     293    }
     294    private void ParameterizeAnalyzers() {
     295      // TODO: Parameterize Analyzers
     296    }
     297    private void ParameterizeIterationBasedOperators() {
     298      if (Problem != null) {
     299        foreach (IIterationBasedOperator op in Problem.Operators.OfType<IIterationBasedOperator>()) {
     300          op.IterationsParameter.ActualName = "Generations";
     301          op.MaximumIterationsParameter.ActualName = "MaximumGenerations";
     302        }
     303      }
     304    }
     305    private void UpdateCrossovers() {
     306      ICrossover oldCrossover = CrossoverParameter.Value;
     307      CrossoverParameter.ValidValues.Clear();
     308      foreach (ICrossover crossover in Problem.Operators.OfType<ICrossover>().OrderBy(x => x.Name))
     309        CrossoverParameter.ValidValues.Add(crossover);
     310      if (oldCrossover != null) {
     311        ICrossover crossover = CrossoverParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldCrossover.GetType());
     312        if (crossover != null) CrossoverParameter.Value = crossover;
     313      }
     314    }
     315    private void UpdateMutators() {
     316      IManipulator oldMutator = MutatorParameter.Value;
     317      MutatorParameter.ValidValues.Clear();
     318      foreach (IManipulator mutator in Problem.Operators.OfType<IManipulator>().OrderBy(x => x.Name))
     319        MutatorParameter.ValidValues.Add(mutator);
     320      if (oldMutator != null) {
     321        IManipulator mutator = MutatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMutator.GetType());
     322        if (mutator != null) MutatorParameter.Value = mutator;
     323      }
     324    }
     325    private void UpdateAnalyzers() {
     326      Analyzer.Operators.Clear();
     327      if (Problem != null) {
     328        foreach (IAnalyzer analyzer in Problem.Operators.OfType<IAnalyzer>()) {
     329          foreach (IScopeTreeLookupParameter param in analyzer.Parameters.OfType<IScopeTreeLookupParameter>())
     330            param.Depth = 1;
     331          Analyzer.Operators.Add(analyzer);
     332        }
     333      }
     334    }
    242335    #endregion
    243336  }
  • trunk/sources/HeuristicLab.Algorithms.NSGA2/3.3/NSGA2MainLoop.cs

    r4017 r4045  
    3939      get { return (ValueLookupParameter<IRandom>)Parameters["Random"]; }
    4040    }
    41     public ValueLookupParameter<BoolValue> MaximizationParameter {
    42       get { return (ValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
    43     }
    44     public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
    45       get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
     41    public ValueLookupParameter<BoolArray> MaximizationParameter {
     42      get { return (ValueLookupParameter<BoolArray>)Parameters["Maximization"]; }
     43    }
     44    public ScopeTreeLookupParameter<DoubleArray> QualitiesParameter {
     45      get { return (ScopeTreeLookupParameter<DoubleArray>)Parameters["Qualities"]; }
     46    }
     47    public ValueLookupParameter<IntValue> PopulationSizeParameter {
     48      get { return (ValueLookupParameter<IntValue>)Parameters["PopulationSize"]; }
    4649    }
    4750    public ValueLookupParameter<IOperator> SelectorParameter {
     
    8487      #region Create parameters
    8588      Parameters.Add(new ValueLookupParameter<IRandom>("Random", "A pseudo random number generator."));
    86       Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
    87       Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution."));
     89      Parameters.Add(new ValueLookupParameter<BoolArray>("Maximization", "True if an objective should be maximized, or false if it should be minimized."));
     90      Parameters.Add(new ScopeTreeLookupParameter<DoubleArray>("Qualities", "The vector of quality values."));
     91      Parameters.Add(new ValueLookupParameter<IntValue>("PopulationSize", "The population size."));
    8892      Parameters.Add(new ValueLookupParameter<IOperator>("Selector", "The operator used to select solutions for reproduction."));
    8993      Parameters.Add(new ValueLookupParameter<PercentValue>("CrossoverProbability", "The probability that the crossover operator is applied on a solution."));
     
    105109      ChildrenCreator childrenCreator = new ChildrenCreator();
    106110      UniformSubScopesProcessor uniformSubScopesProcessor = new UniformSubScopesProcessor();
     111      StochasticBranch crossoverStochasticBranch = new StochasticBranch();
    107112      Placeholder crossover = new Placeholder();
    108       StochasticBranch stochasticBranch = new StochasticBranch();
     113      DefaultCrossover noCrossover = new DefaultCrossover();
     114      StochasticBranch mutationStochasticBranch = new StochasticBranch();
    109115      Placeholder mutator = new Placeholder();
    110116      Placeholder evaluator = new Placeholder();
    111117      SubScopesRemover subScopesRemover = new SubScopesRemover();
    112       SubScopesProcessor subScopesProcessor2 = new SubScopesProcessor();
    113       BestSelector bestSelector = new BestSelector();
     118      MergingReducer mergingReducer = new MergingReducer();
     119      RankAndCrowdingSorter rankAndCrowdingSorter = new RankAndCrowdingSorter();
     120      LeftSelector leftSelector = new LeftSelector();
    114121      RightReducer rightReducer = new RightReducer();
    115       MergingReducer mergingReducer = new MergingReducer();
    116122      IntCounter intCounter = new IntCounter();
    117123      Comparator comparator = new Comparator();
     
    123129
    124130      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
    125       resultsCollector1.ResultsParameter.ActualName = "Results";
     131      resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
    126132
    127133      analyzer1.Name = "Analyzer";
    128       analyzer1.OperatorParameter.ActualName = "Analyzer";
     134      analyzer1.OperatorParameter.ActualName = AnalyzerParameter.Name;
    129135
    130136      selector.Name = "Selector";
    131       selector.OperatorParameter.ActualName = "Selector";
     137      selector.OperatorParameter.ActualName = SelectorParameter.Name;
    132138
    133139      childrenCreator.ParentsPerChild = new IntValue(2);
    134140
     141      crossoverStochasticBranch.ProbabilityParameter.ActualName = CrossoverProbabilityParameter.Name;
     142      crossoverStochasticBranch.RandomParameter.ActualName = RandomParameter.Name;
     143
    135144      crossover.Name = "Crossover";
    136       crossover.OperatorParameter.ActualName = "Crossover";
    137 
    138       stochasticBranch.ProbabilityParameter.ActualName = "MutationProbability";
    139       stochasticBranch.RandomParameter.ActualName = "Random";
     145      crossover.OperatorParameter.ActualName = CrossoverParameter.Name;
     146
     147      noCrossover.Name = "Clone parent";
     148      noCrossover.RandomParameter.ActualName = RandomParameter.Name;
     149
     150      mutationStochasticBranch.ProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
     151      mutationStochasticBranch.RandomParameter.ActualName = RandomParameter.Name;
    140152
    141153      mutator.Name = "Mutator";
    142       mutator.OperatorParameter.ActualName = "Mutator";
     154      mutator.OperatorParameter.ActualName = MutatorParameter.Name;
    143155
    144156      evaluator.Name = "Evaluator";
    145       evaluator.OperatorParameter.ActualName = "Evaluator";
     157      evaluator.OperatorParameter.ActualName = EvaluatorParameter.Name;
    146158
    147159      subScopesRemover.RemoveAllSubScopes = true;
    148160
    149       bestSelector.CopySelected = new BoolValue(false);
    150       bestSelector.MaximizationParameter.ActualName = "Maximization";
    151       bestSelector.NumberOfSelectedSubScopesParameter.ActualName = "Elites";
    152       bestSelector.QualityParameter.ActualName = "Quality";
     161      rankAndCrowdingSorter.CrowdingDistanceParameter.ActualName = "CrowdingDistance";
     162      rankAndCrowdingSorter.RankParameter.ActualName = "Rank";
     163
     164      leftSelector.CopySelected = new BoolValue(false);
     165      leftSelector.NumberOfSelectedSubScopesParameter.ActualName = PopulationSizeParameter.Name;
    153166
    154167      intCounter.Increment = new IntValue(1);
     
    158171      comparator.LeftSideParameter.ActualName = "Generations";
    159172      comparator.ResultParameter.ActualName = "Terminate";
    160       comparator.RightSideParameter.ActualName = "MaximumGenerations";
     173      comparator.RightSideParameter.ActualName = MaximumGenerationsParameter.Name;
    161174
    162175      resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
    163       resultsCollector2.ResultsParameter.ActualName = "Results";
     176      resultsCollector2.ResultsParameter.ActualName = ResultsParameter.Name;
    164177
    165178      analyzer2.Name = "Analyzer";
     
    177190      subScopesProcessor1.Operators.Add(new EmptyOperator());
    178191      subScopesProcessor1.Operators.Add(childrenCreator);
    179       subScopesProcessor1.Successor = subScopesProcessor2;
     192      subScopesProcessor1.Successor = mergingReducer;
    180193      childrenCreator.Successor = uniformSubScopesProcessor;
    181       uniformSubScopesProcessor.Operator = crossover;
     194      uniformSubScopesProcessor.Operator = crossoverStochasticBranch;
    182195      uniformSubScopesProcessor.Successor = null;
    183       crossover.Successor = stochasticBranch;
    184       stochasticBranch.FirstBranch = mutator;
    185       stochasticBranch.SecondBranch = null;
    186       stochasticBranch.Successor = evaluator;
     196      crossoverStochasticBranch.FirstBranch = crossover;
     197      crossoverStochasticBranch.SecondBranch = noCrossover;
     198      crossoverStochasticBranch.Successor = mutationStochasticBranch;
     199      crossover.Successor = null;
     200      noCrossover.Successor = null;
     201      mutationStochasticBranch.FirstBranch = mutator;
     202      mutationStochasticBranch.SecondBranch = null;
     203      mutationStochasticBranch.Successor = evaluator;
    187204      mutator.Successor = null;
    188205      evaluator.Successor = subScopesRemover;
    189206      subScopesRemover.Successor = null;
    190       subScopesProcessor2.Operators.Add(bestSelector);
    191       subScopesProcessor2.Operators.Add(new EmptyOperator());
    192       subScopesProcessor2.Successor = mergingReducer;
    193       bestSelector.Successor = rightReducer;
    194       rightReducer.Successor = null;
    195       mergingReducer.Successor = intCounter;
     207      mergingReducer.Successor = rankAndCrowdingSorter;
     208      rankAndCrowdingSorter.Successor = leftSelector;
     209      leftSelector.Successor = rightReducer;
     210      rightReducer.Successor = intCounter;
    196211      intCounter.Successor = comparator;
    197212      comparator.Successor = resultsCollector2;
     
    203218      #endregion
    204219    }
    205 
    206     public override IOperation Apply() {
    207       if (CrossoverParameter.ActualValue == null)
    208         return null;
    209       return base.Apply();
    210     }
    211220  }
    212221}
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/HeuristicLab.Encodings.PermutationEncoding-3.3.csproj

    r3832 r4045  
    112112    <Compile Include="Moves\PermutationMoveAttribute.cs" />
    113113    <Compile Include="Moves\ThreeIndexMove.cs" />
     114    <Compile Include="Moves\ThreeOpt\StochasticSingleInsertionMoveGenerator.cs" />
    114115    <Compile Include="Moves\ThreeOpt\TranslocationMoveAbsoluteAttribute.cs" />
    115116    <Compile Include="Moves\ThreeOpt\ExhaustiveInsertionMoveGenerator.cs">
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/TranslocationMoveSoftTabuCriterion.cs

    r3376 r4045  
    137137                if (attribute.Edge1Source == E3S && attribute.Edge1Target == E1T || attribute.Edge1Source == E1T && attribute.Edge1Target == E3S
    138138                  || attribute.Edge1Source == E2S && attribute.Edge1Target == E3T || attribute.Edge1Source == E3T && attribute.Edge1Target == E2S
    139                   || attribute.Edge1Source == E1S && attribute.Edge1Target == E2T || attribute.Edge1Source == E2T && attribute.Edge1Target == E1S
    140139                  // if previously deleted Edge2Source-Target is readded
    141140                  || attribute.Edge2Source == E3S && attribute.Edge2Target == E1T || attribute.Edge2Source == E1T && attribute.Edge2Target == E3S
    142141                  || attribute.Edge2Source == E2S && attribute.Edge2Target == E3T || attribute.Edge2Source == E3T && attribute.Edge2Target == E2S
    143                   || attribute.Edge2Source == E1S && attribute.Edge2Target == E2T || attribute.Edge2Source == E2T && attribute.Edge2Target == E1S
    144142                  // if previously deleted Edge3Source-Target is readded
    145143                  || attribute.Edge3Source == E3S && attribute.Edge3Target == E1T || attribute.Edge3Source == E1T && attribute.Edge3Target == E3S
    146                   || attribute.Edge3Source == E2S && attribute.Edge3Target == E3T || attribute.Edge3Source == E3T && attribute.Edge3Target == E2S
    147                   || attribute.Edge3Source == E1S && attribute.Edge3Target == E2T || attribute.Edge3Source == E2T && attribute.Edge3Target == E1S) {
     144                  || attribute.Edge3Source == E2S && attribute.Edge3Target == E3T || attribute.Edge3Source == E3T && attribute.Edge3Target == E2S) {
    148145                  isTabu = true;
    149146                  break;
     
    152149                if (attribute.Edge1Source == E3S && attribute.Edge1Target == E1T
    153150                  || attribute.Edge1Source == E2S && attribute.Edge1Target == E3T
    154                   || attribute.Edge1Source == E1S && attribute.Edge1Target == E2T
    155151                  // if previously deleted Edge2Source-Target is readded
    156152                  || attribute.Edge2Source == E3S && attribute.Edge2Target == E1T
    157153                  || attribute.Edge2Source == E2S && attribute.Edge2Target == E3T
    158                   || attribute.Edge2Source == E1S && attribute.Edge2Target == E2T
    159154                  // if previously deleted Edge3Source-Target is readded
    160155                  || attribute.Edge3Source == E3S && attribute.Edge3Target == E1T
    161                   || attribute.Edge3Source == E2S && attribute.Edge3Target == E3T
    162                   || attribute.Edge3Source == E1S && attribute.Edge3Target == E2T) {
     156                  || attribute.Edge3Source == E2S && attribute.Edge3Target == E3T) {
    163157                  isTabu = true;
    164158                  break;
  • trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IMultiObjectiveProblem.cs

    r2866 r4045  
    2020#endregion
    2121
     22using HeuristicLab.Core;
     23
    2224namespace HeuristicLab.Optimization {
    2325  /// <summary>
     
    2527  /// </summary>
    2628  public interface IMultiObjectiveProblem : IProblem {
     29    IParameter MaximizationParameter { get; }
    2730    new IMultiObjectiveEvaluator Evaluator { get; }
    2831  }
  • trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IMultiObjectiveSelector.cs

    r3376 r4045  
    2929  /// </summary>
    3030  public interface IMultiObjectiveSelector : ISelector {
     31    ILookupParameter<BoolArray> MaximizationParameter { get; }
    3132    ILookupParameter<ItemArray<DoubleArray>> QualitiesParameter { get; }
    3233  }
Note: See TracChangeset for help on using the changeset viewer.