Index: branches/IslandALPS/IslandALPS/3.3/IslandALPSAlgorthmsMainLoop.cs
===================================================================
--- branches/IslandALPS/IslandALPS/3.3/IslandALPSAlgorthmsMainLoop.cs	(revision 13613)
+++ branches/IslandALPS/IslandALPS/3.3/IslandALPSAlgorthmsMainLoop.cs	(revision 13615)
@@ -116,7 +116,5 @@
       get { return (LookupParameter<IntValue>)Parameters["IslandEvaluatedSolutions"]; }
     }
-    public LookupParameter<IntValue> IslandGenerations {
-      get { return (LookupParameter<IntValue>)Parameters["IslandGenerations"]; }
-    }
+
     #endregion
 
@@ -204,5 +202,4 @@
 
       Parameters.Add(new LookupParameter<IntValue>("LayerEvaluatedSolutions", "The number of times a solution has been evaluated."));
-      Parameters.Add(new LookupParameter<IntValue>("IslandGenerations", "The number of generations calculated on one island."));
       //TODO: make long ?
       Parameters.Add(new LookupParameter<IntValue>("IslandEvaluatedSolutions", "The number of times a solution has been evaluated on one island."));
@@ -226,8 +223,7 @@
 
       var processIslandsUssp = new UniformSubScopesProcessor() {Name = "Process Islands", Parallel = new BoolValue(true)};
-      var initIslandGenerationsAss = new Assigner() {Name = "Init Island Generations"};
       var initIslandEvaluationsAss = new Assigner() {Name = "Init Island Evaluations"};
 
-      var incrementGenerationDr = new DataReducer() { Name = "Increment Generations" };
+      var incrementGenerationDr = new IntCounter() { Name = "Increment Generations" };
       var incrementEvaluatedSolutionDr = new DataReducer() { Name = "Increment Evaluated Solutions" };
 
@@ -255,7 +251,8 @@
       var alpsMainOperator = new AlpsGeneticAlgorithmMainOperator();
 
-      var incrementIslandGeneration = new IntCounter() {Name = "incrementIslandGeneration" };
       var setIslandEvaluatedSolutions = new DataReducer() {Name = "Set IslandEvaluatedSolutions" };
-       
+
+      var migrationThresholdCounter = new IntCounter() {Name = "Increment Counter for Migrations"};
+      var migrationThresholdAss = new Assigner() {Name = "Reset Counter for Migrations"};
       var migrationCounter = new IntCounter() {Name = "Increment  Migrations"};
       var selectforMigrationUssp = new UniformSubScopesProcessor();
@@ -273,5 +270,4 @@
       globalVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Migrations",new IntValue(0)));
 
-      islandVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>(IslandGenerations.Name, new IntValue(0)));
       islandVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("OpenLayers", new IntValue(1)));
       islandVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("IslandResults"));
@@ -292,14 +288,8 @@
       resultsCollector.CopyValue = new BoolValue(false);
 
-      initIslandGenerationsAss.LeftSideParameter.ActualName = IslandGenerations.Name;
-      initIslandGenerationsAss.RightSideParameter.Value = new IntValue(0);
-
       initIslandEvaluationsAss.LeftSideParameter.ActualName = IslandEvaluatedSolutions.Name;
       initIslandEvaluationsAss.RightSideParameter.Value = new IntValue(0);
 
-      incrementGenerationDr.TargetParameter.ActualName = "Generations";
-      incrementGenerationDr.ParameterToReduce.ActualName = IslandGenerations.Name;
-      incrementGenerationDr.TargetOperation.Value = new ReductionOperation(ReductionOperations.Sum);
-      incrementGenerationDr.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Min);
+      incrementGenerationDr.ValueParameter.ActualName = "Generations";
 
       incrementEvaluatedSolutionDr.ParameterToReduce.ActualName = IslandEvaluatedSolutions.Name;
@@ -308,5 +298,4 @@
       incrementEvaluatedSolutionDr.TargetOperation.Value = new ReductionOperation(ReductionOperations.Sum);
 
-      incrementIslandGeneration.ValueParameter.ActualName = IslandGenerations.Name;
       setIslandEvaluatedSolutions.ParameterToReduce.ActualName = LayerEvaluatedSolutionsParameter.Name;
       setIslandEvaluatedSolutions.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum);
@@ -314,6 +303,9 @@
       setIslandEvaluatedSolutions.TargetParameter.ActualName = IslandEvaluatedSolutions.Name;
 
+
+      migrationThresholdCounter.ValueParameter.ActualName = "MigrationThreshold";
+      
       migrateComparator.Comparison.Value = ComparisonType.GreaterOrEqual;
-      migrateComparator.LeftSideParameter.ActualName = IslandGenerations.Name;
+      migrateComparator.LeftSideParameter.ActualName = "MigrationThreshold";
       migrateComparator.RightSideParameter.ActualName = MigrationIntervalParameter.Name;
       migrateComparator.ResultParameter.ActualName = "Migrate";
@@ -322,4 +314,7 @@
 
       migrationCounter.ValueParameter.ActualName = "Migrations";
+      migrationThresholdAss.LeftSideParameter.ActualName = "MigrationThreshold";
+      migrationThresholdAss.RightSideParameter.Value = new IntValue(0);
+
       selectforMigrationUssp.Depth = new IntValue(2);
       emigrantSelector.OperatorParameter.ActualName = EmigrantsSelectorParameter.Name;
@@ -376,6 +371,5 @@
       initGlobalAnalyzerPlacerholder.Successor = resultsCollector;
       resultsCollector.Successor = processIslandsUssp;
-      processIslandsUssp.Operator = initIslandGenerationsAss;
-      initIslandGenerationsAss.Successor = initIslandEvaluationsAss;
+      processIslandsUssp.Operator = initIslandEvaluationsAss;
       initIslandEvaluationsAss.Successor = matingPoolCreator;
       matingPoolCreator.Successor = matingPoolUssp;
@@ -393,14 +387,17 @@
       islandAnalyzerPlaceholder.Successor = islandResultsCollector;
       islandResultsCollector.Successor = setIslandEvaluatedSolutions;
-      setIslandEvaluatedSolutions.Successor = incrementIslandGeneration;
-      incrementIslandGeneration.Successor = migrateComparator;
-      migrateComparator.Successor = migrateCondBranch;
-      migrateCondBranch.FalseBranch = matingPoolCreator;
-      migrateCondBranch.TrueBranch = null;
+      setIslandEvaluatedSolutions.Successor = null;
 
       processIslandsUssp.Successor = incrementGenerationDr;
       incrementGenerationDr.Successor = incrementEvaluatedSolutionDr;
-      incrementEvaluatedSolutionDr.Successor = migrationCounter;
-      
+      incrementEvaluatedSolutionDr.Successor = migrationThresholdCounter;
+
+      migrationThresholdCounter.Successor = migrateComparator;
+
+      migrateComparator.Successor = migrateCondBranch;
+      migrateCondBranch.FalseBranch = null;
+      migrateCondBranch.TrueBranch = migrationThresholdAss;
+      migrationThresholdAss.Successor = migrationCounter;
+
       migrationCounter.Successor = selectforMigrationUssp;
       selectforMigrationUssp.Operator = emigrantSelector;
@@ -411,5 +408,8 @@
       replaceforMigrationUssp.Operator = immigrantSelector;
       immigrantSelector.Successor = null;
-      replaceforMigrationUssp.Successor = globalAnalyzerPlacerholder;
+      replaceforMigrationUssp.Successor = null;
+
+      migrateCondBranch.Successor = globalAnalyzerPlacerholder;
+
 
       globalAnalyzerPlacerholder.Successor = groupingOperator;
