Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/13/15 16:52:31 (10 years ago)
Author:
pfleck
Message:

#2027 Used new termination-operator and -criteria in OSGA.

Location:
branches/TerminationCriteria/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/TerminationCriteria/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3.csproj

    r12301 r12304  
    199199    </BootstrapperPackage>
    200200  </ItemGroup>
     201  <ItemGroup>
     202    <ProjectReference Include="..\..\HeuristicLab.Termination\3.3\HeuristicLab.Termination-3.3.csproj">
     203      <Project>{5AB79EEE-33AC-4E7A-8AF1-E409AB63A3D3}</Project>
     204      <Name>HeuristicLab.Termination-3.3</Name>
     205    </ProjectReference>
     206  </ItemGroup>
    201207  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    202208  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  • branches/TerminationCriteria/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs

    r12012 r12304  
    3333using HeuristicLab.PluginInfrastructure;
    3434using HeuristicLab.Random;
     35using HeuristicLab.Termination;
    3536
    3637namespace HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm {
     
    114115    private IFixedValueParameter<BoolValue> FillPopulationWithParentsParameter {
    115116      get { return (IFixedValueParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }
     117    }
     118    private IValueParameter<MultiTerminationCriterion> TerminationCriteriaParameter {
     119      get { return (IValueParameter<MultiTerminationCriterion>)Parameters["TerminationCriteria"]; }
    116120    }
    117121    #endregion
     
    264268      Parameters.Add(new ValueParameter<IntValue>("MaximumEvaluatedSolutions", "The maximum number of evaluated solutions (approximately).", new IntValue(int.MaxValue)));
    265269      Parameters.Add(new FixedValueParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded.", new BoolValue(false)) { Hidden = true });
     270      Parameters.Add(new ValueParameter<MultiTerminationCriterion>("TerminationCriteria", "The termination criteria which sould be checked.", new MultiTerminationCriterion()));
    266271
    267272      RandomCreator randomCreator = new RandomCreator();
     
    321326      ParameterizeComparisonFactorModifiers();
    322327
     328      var maximumGenerationsTerminationCriteria = new MaximumIterationsTerminationCriterion();
     329      maximumGenerationsTerminationCriteria.IterationsParameter.ActualName = "Generations";
     330      maximumGenerationsTerminationCriteria.MaximumIterationsParameter.ActualName = "MaximumGenerations";
     331      TerminationCriteriaParameter.Value.Operators.Add(maximumGenerationsTerminationCriteria);
     332
    323333      qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
    324334      selectionPressureAnalyzer = new ValueAnalyzer();
  • branches/TerminationCriteria/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainLoop.cs

    r12012 r12304  
    2727using HeuristicLab.Parameters;
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using HeuristicLab.Termination;
    2930
    3031namespace HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm {
     
    159160      OffspringSelectionGeneticAlgorithmMainOperator mainOperator = new OffspringSelectionGeneticAlgorithmMainOperator();
    160161      IntCounter generationsCounter = new IntCounter();
    161       Comparator maxGenerationsComparator = new Comparator();
    162       Comparator maxSelectionPressureComparator = new Comparator();
    163       Comparator maxEvaluatedSolutionsComparator = new Comparator();
     162      //Comparator maxGenerationsComparator = new Comparator();
     163      //Comparator maxSelectionPressureComparator = new Comparator();
     164      //Comparator maxEvaluatedSolutionsComparator = new Comparator();
    164165      Placeholder comparisonFactorModifier = new Placeholder();
    165166      Placeholder analyzer2 = new Placeholder();
    166       ConditionalBranch conditionalBranch1 = new ConditionalBranch();
    167       ConditionalBranch conditionalBranch2 = new ConditionalBranch();
    168       ConditionalBranch conditionalBranch3 = new ConditionalBranch();
     167      var termination = new TerminationOperator();
     168      //ConditionalBranch conditionalBranch1 = new ConditionalBranch();
     169      //ConditionalBranch conditionalBranch2 = new ConditionalBranch();
     170      //ConditionalBranch conditionalBranch3 = new ConditionalBranch();
    169171
    170172      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class OffspringSelectionGeneticAlgorithm expects this to be called Generations
     
    208210      generationsCounter.ValueParameter.ActualName = "Generations";
    209211
    210       maxGenerationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
    211       maxGenerationsComparator.LeftSideParameter.ActualName = "Generations";
    212       maxGenerationsComparator.ResultParameter.ActualName = "TerminateMaximumGenerations";
    213       maxGenerationsComparator.RightSideParameter.ActualName = MaximumGenerationsParameter.Name;
    214 
    215       maxSelectionPressureComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
    216       maxSelectionPressureComparator.LeftSideParameter.ActualName = "SelectionPressure";
    217       maxSelectionPressureComparator.ResultParameter.ActualName = "TerminateSelectionPressure";
    218       maxSelectionPressureComparator.RightSideParameter.ActualName = MaximumSelectionPressureParameter.Name;
    219 
    220       maxEvaluatedSolutionsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
    221       maxEvaluatedSolutionsComparator.LeftSideParameter.ActualName = EvaluatedSolutionsParameter.Name;
    222       maxEvaluatedSolutionsComparator.ResultParameter.ActualName = "TerminateEvaluatedSolutions";
    223       maxEvaluatedSolutionsComparator.RightSideParameter.ActualName = "MaximumEvaluatedSolutions";
     212      //maxGenerationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
     213      //maxGenerationsComparator.LeftSideParameter.ActualName = "Generations";
     214      //maxGenerationsComparator.ResultParameter.ActualName = "TerminateMaximumGenerations";
     215      //maxGenerationsComparator.RightSideParameter.ActualName = MaximumGenerationsParameter.Name;
     216
     217      //maxSelectionPressureComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
     218      //maxSelectionPressureComparator.LeftSideParameter.ActualName = "SelectionPressure";
     219      //maxSelectionPressureComparator.ResultParameter.ActualName = "TerminateSelectionPressure";
     220      //maxSelectionPressureComparator.RightSideParameter.ActualName = MaximumSelectionPressureParameter.Name;
     221
     222      //maxEvaluatedSolutionsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
     223      //maxEvaluatedSolutionsComparator.LeftSideParameter.ActualName = EvaluatedSolutionsParameter.Name;
     224      //maxEvaluatedSolutionsComparator.ResultParameter.ActualName = "TerminateEvaluatedSolutions";
     225      //maxEvaluatedSolutionsComparator.RightSideParameter.ActualName = "MaximumEvaluatedSolutions";
    224226
    225227      comparisonFactorModifier.Name = "Update ComparisonFactor (placeholder)";
     
    229231      analyzer2.OperatorParameter.ActualName = AnalyzerParameter.Name;
    230232
    231       conditionalBranch1.Name = "MaximumSelectionPressure reached?";
    232       conditionalBranch1.ConditionParameter.ActualName = "TerminateSelectionPressure";
    233 
    234       conditionalBranch2.Name = "MaximumGenerations reached?";
    235       conditionalBranch2.ConditionParameter.ActualName = "TerminateMaximumGenerations";
    236 
    237       conditionalBranch3.Name = "MaximumEvaluatedSolutions reached?";
    238       conditionalBranch3.ConditionParameter.ActualName = "TerminateEvaluatedSolutions";
     233      //conditionalBranch1.Name = "MaximumSelectionPressure reached?";
     234      //conditionalBranch1.ConditionParameter.ActualName = "TerminateSelectionPressure";
     235
     236      //conditionalBranch2.Name = "MaximumGenerations reached?";
     237      //conditionalBranch2.ConditionParameter.ActualName = "TerminateMaximumGenerations";
     238
     239      //conditionalBranch3.Name = "MaximumEvaluatedSolutions reached?";
     240      //conditionalBranch3.ConditionParameter.ActualName = "TerminateEvaluatedSolutions";
    239241      #endregion
    240242
     
    246248      resultsCollector1.Successor = mainOperator;
    247249      mainOperator.Successor = generationsCounter;
    248       generationsCounter.Successor = maxGenerationsComparator;
    249       maxGenerationsComparator.Successor = maxSelectionPressureComparator;
    250       maxSelectionPressureComparator.Successor = maxEvaluatedSolutionsComparator;
    251       maxEvaluatedSolutionsComparator.Successor = comparisonFactorModifier;
     250      generationsCounter.Successor = comparisonFactorModifier; //maxGenerationsComparator;
     251      //maxGenerationsComparator.Successor = maxSelectionPressureComparator;
     252      //maxSelectionPressureComparator.Successor = maxEvaluatedSolutionsComparator;
     253      //maxEvaluatedSolutionsComparator.Successor = comparisonFactorModifier;
    252254      comparisonFactorModifier.Successor = analyzer2;
    253       analyzer2.Successor = conditionalBranch1;
    254       conditionalBranch1.FalseBranch = conditionalBranch2;
    255       conditionalBranch1.TrueBranch = null;
    256       conditionalBranch1.Successor = null;
    257       conditionalBranch2.FalseBranch = conditionalBranch3;
    258       conditionalBranch2.TrueBranch = null;
    259       conditionalBranch2.Successor = null;
    260       conditionalBranch3.FalseBranch = mainOperator;
    261       conditionalBranch3.TrueBranch = null;
    262       conditionalBranch3.Successor = null;
     255      analyzer2.Successor = termination; //conditionalBranch1;
     256      //conditionalBranch1.FalseBranch = conditionalBranch2;
     257      //conditionalBranch1.TrueBranch = null;
     258      //conditionalBranch1.Successor = null;
     259      //conditionalBranch2.FalseBranch = conditionalBranch3;
     260      //conditionalBranch2.TrueBranch = null;
     261      //conditionalBranch2.Successor = null;
     262      //conditionalBranch3.FalseBranch = mainOperator;
     263      //conditionalBranch3.TrueBranch = null;
     264      //conditionalBranch3.Successor = null;
     265      termination.ContinueBranch = mainOperator;
    263266      #endregion
    264267    }
  • branches/TerminationCriteria/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/Plugin.cs.frame

    r12012 r12304  
    4040  [PluginDependency("HeuristicLab.Random", "3.3")]
    4141  [PluginDependency("HeuristicLab.Selection", "3.3")]
     42  [PluginDependency("HeuristicLab.Termination", "3.3")]
    4243  public class HeuristicLabAlgorithmsOffspringSelectionGeneticAlgorithmPlugin : PluginBase {
    4344  }
Note: See TracChangeset for help on using the changeset viewer.