Changeset 13615


Ignore:
Timestamp:
02/09/16 11:14:25 (6 years ago)
Author:
pkuelzer
Message:

#2558 removed island generations parameter
changed operator graph so analyzer get executed each generation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/IslandALPS/IslandALPS/3.3/IslandALPSAlgorthmsMainLoop.cs

    r13604 r13615  
    116116      get { return (LookupParameter<IntValue>)Parameters["IslandEvaluatedSolutions"]; }
    117117    }
    118     public LookupParameter<IntValue> IslandGenerations {
    119       get { return (LookupParameter<IntValue>)Parameters["IslandGenerations"]; }
    120     }
     118
    121119    #endregion
    122120
     
    204202
    205203      Parameters.Add(new LookupParameter<IntValue>("LayerEvaluatedSolutions", "The number of times a solution has been evaluated."));
    206       Parameters.Add(new LookupParameter<IntValue>("IslandGenerations", "The number of generations calculated on one island."));
    207204      //TODO: make long ?
    208205      Parameters.Add(new LookupParameter<IntValue>("IslandEvaluatedSolutions", "The number of times a solution has been evaluated on one island."));
     
    226223
    227224      var processIslandsUssp = new UniformSubScopesProcessor() {Name = "Process Islands", Parallel = new BoolValue(true)};
    228       var initIslandGenerationsAss = new Assigner() {Name = "Init Island Generations"};
    229225      var initIslandEvaluationsAss = new Assigner() {Name = "Init Island Evaluations"};
    230226
    231       var incrementGenerationDr = new DataReducer() { Name = "Increment Generations" };
     227      var incrementGenerationDr = new IntCounter() { Name = "Increment Generations" };
    232228      var incrementEvaluatedSolutionDr = new DataReducer() { Name = "Increment Evaluated Solutions" };
    233229
     
    255251      var alpsMainOperator = new AlpsGeneticAlgorithmMainOperator();
    256252
    257       var incrementIslandGeneration = new IntCounter() {Name = "incrementIslandGeneration" };
    258253      var setIslandEvaluatedSolutions = new DataReducer() {Name = "Set IslandEvaluatedSolutions" };
    259        
     254
     255      var migrationThresholdCounter = new IntCounter() {Name = "Increment Counter for Migrations"};
     256      var migrationThresholdAss = new Assigner() {Name = "Reset Counter for Migrations"};
    260257      var migrationCounter = new IntCounter() {Name = "Increment  Migrations"};
    261258      var selectforMigrationUssp = new UniformSubScopesProcessor();
     
    273270      globalVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Migrations",new IntValue(0)));
    274271
    275       islandVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>(IslandGenerations.Name, new IntValue(0)));
    276272      islandVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("OpenLayers", new IntValue(1)));
    277273      islandVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("IslandResults"));
     
    292288      resultsCollector.CopyValue = new BoolValue(false);
    293289
    294       initIslandGenerationsAss.LeftSideParameter.ActualName = IslandGenerations.Name;
    295       initIslandGenerationsAss.RightSideParameter.Value = new IntValue(0);
    296 
    297290      initIslandEvaluationsAss.LeftSideParameter.ActualName = IslandEvaluatedSolutions.Name;
    298291      initIslandEvaluationsAss.RightSideParameter.Value = new IntValue(0);
    299292
    300       incrementGenerationDr.TargetParameter.ActualName = "Generations";
    301       incrementGenerationDr.ParameterToReduce.ActualName = IslandGenerations.Name;
    302       incrementGenerationDr.TargetOperation.Value = new ReductionOperation(ReductionOperations.Sum);
    303       incrementGenerationDr.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Min);
     293      incrementGenerationDr.ValueParameter.ActualName = "Generations";
    304294
    305295      incrementEvaluatedSolutionDr.ParameterToReduce.ActualName = IslandEvaluatedSolutions.Name;
     
    308298      incrementEvaluatedSolutionDr.TargetOperation.Value = new ReductionOperation(ReductionOperations.Sum);
    309299
    310       incrementIslandGeneration.ValueParameter.ActualName = IslandGenerations.Name;
    311300      setIslandEvaluatedSolutions.ParameterToReduce.ActualName = LayerEvaluatedSolutionsParameter.Name;
    312301      setIslandEvaluatedSolutions.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum);
     
    314303      setIslandEvaluatedSolutions.TargetParameter.ActualName = IslandEvaluatedSolutions.Name;
    315304
     305
     306      migrationThresholdCounter.ValueParameter.ActualName = "MigrationThreshold";
     307     
    316308      migrateComparator.Comparison.Value = ComparisonType.GreaterOrEqual;
    317       migrateComparator.LeftSideParameter.ActualName = IslandGenerations.Name;
     309      migrateComparator.LeftSideParameter.ActualName = "MigrationThreshold";
    318310      migrateComparator.RightSideParameter.ActualName = MigrationIntervalParameter.Name;
    319311      migrateComparator.ResultParameter.ActualName = "Migrate";
     
    322314
    323315      migrationCounter.ValueParameter.ActualName = "Migrations";
     316      migrationThresholdAss.LeftSideParameter.ActualName = "MigrationThreshold";
     317      migrationThresholdAss.RightSideParameter.Value = new IntValue(0);
     318
    324319      selectforMigrationUssp.Depth = new IntValue(2);
    325320      emigrantSelector.OperatorParameter.ActualName = EmigrantsSelectorParameter.Name;
     
    376371      initGlobalAnalyzerPlacerholder.Successor = resultsCollector;
    377372      resultsCollector.Successor = processIslandsUssp;
    378       processIslandsUssp.Operator = initIslandGenerationsAss;
    379       initIslandGenerationsAss.Successor = initIslandEvaluationsAss;
     373      processIslandsUssp.Operator = initIslandEvaluationsAss;
    380374      initIslandEvaluationsAss.Successor = matingPoolCreator;
    381375      matingPoolCreator.Successor = matingPoolUssp;
     
    393387      islandAnalyzerPlaceholder.Successor = islandResultsCollector;
    394388      islandResultsCollector.Successor = setIslandEvaluatedSolutions;
    395       setIslandEvaluatedSolutions.Successor = incrementIslandGeneration;
    396       incrementIslandGeneration.Successor = migrateComparator;
    397       migrateComparator.Successor = migrateCondBranch;
    398       migrateCondBranch.FalseBranch = matingPoolCreator;
    399       migrateCondBranch.TrueBranch = null;
     389      setIslandEvaluatedSolutions.Successor = null;
    400390
    401391      processIslandsUssp.Successor = incrementGenerationDr;
    402392      incrementGenerationDr.Successor = incrementEvaluatedSolutionDr;
    403       incrementEvaluatedSolutionDr.Successor = migrationCounter;
    404      
     393      incrementEvaluatedSolutionDr.Successor = migrationThresholdCounter;
     394
     395      migrationThresholdCounter.Successor = migrateComparator;
     396
     397      migrateComparator.Successor = migrateCondBranch;
     398      migrateCondBranch.FalseBranch = null;
     399      migrateCondBranch.TrueBranch = migrationThresholdAss;
     400      migrationThresholdAss.Successor = migrationCounter;
     401
    405402      migrationCounter.Successor = selectforMigrationUssp;
    406403      selectforMigrationUssp.Operator = emigrantSelector;
     
    411408      replaceforMigrationUssp.Operator = immigrantSelector;
    412409      immigrantSelector.Successor = null;
    413       replaceforMigrationUssp.Successor = globalAnalyzerPlacerholder;
     410      replaceforMigrationUssp.Successor = null;
     411
     412      migrateCondBranch.Successor = globalAnalyzerPlacerholder;
     413
    414414
    415415      globalAnalyzerPlacerholder.Successor = groupingOperator;
Note: See TracChangeset for help on using the changeset viewer.