From 3458e7a9bfc24d60644788abbf0d8c454296ad3b Mon Sep 17 00:00:00 2001 From: salmjak Date: Sun, 24 Jul 2016 15:43:39 +0200 Subject: [PATCH 1/3] Update Optimizer.cs --- UnityNEAT/Assets/SharpNEAT/Optimizer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/UnityNEAT/Assets/SharpNEAT/Optimizer.cs b/UnityNEAT/Assets/SharpNEAT/Optimizer.cs index 51aa1dd..2b40f65 100644 --- a/UnityNEAT/Assets/SharpNEAT/Optimizer.cs +++ b/UnityNEAT/Assets/SharpNEAT/Optimizer.cs @@ -16,6 +16,8 @@ public class Optimizer : MonoBehaviour { public int Trials; public float TrialDuration; public float StoppingFitness; + public bool Group_Eval = false; + public int Group_Size = 0; bool EARunning; string popFileSavePath, champFileSavePath; From cf3c6203518bcf2f614bc7cbc22b6582e0ccec28 Mon Sep 17 00:00:00 2001 From: salmjak Date: Sun, 24 Jul 2016 15:47:05 +0200 Subject: [PATCH 2/3] Update UnityParallelListEvaluator.cs --- .../Assets/SharpNEAT/Core/UnityParallelListEvaluator.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/UnityNEAT/Assets/SharpNEAT/Core/UnityParallelListEvaluator.cs b/UnityNEAT/Assets/SharpNEAT/Core/UnityParallelListEvaluator.cs index 47634b4..a58ecfa 100644 --- a/UnityNEAT/Assets/SharpNEAT/Core/UnityParallelListEvaluator.cs +++ b/UnityNEAT/Assets/SharpNEAT/Core/UnityParallelListEvaluator.cs @@ -58,6 +58,7 @@ private IEnumerator evaluateList(IList genomeList) Utility.Log("Iteration " + (i + 1)); _phenomeEvaluator.Reset(); dict = new Dictionary(); + int curr_group_size = _optimizer.Group_Size; foreach (TGenome genome in genomeList) { @@ -80,8 +81,12 @@ private IEnumerator evaluateList(IList genomeList) // fitnessDict.Add(phenome, new FitnessInfo[_optimizer.Trials]); //} Coroutiner.StartCoroutine(_phenomeEvaluator.Evaluate(phenome)); - - + if(_optimizer.Group_Eval){ + if(curr_group_size%_optimizer.Group_Size == 0){ + yield return new WaitForSeconds(_optimizer.TrialDuration); + } + } + curr_group_size++; } } From 831f4907c69471485f0aae76c7f0e427f67fa8c7 Mon Sep 17 00:00:00 2001 From: salmjak Date: Sun, 24 Jul 2016 15:59:16 +0200 Subject: [PATCH 3/3] Update UnityParallelListEvaluator.cs --- UnityNEAT/Assets/SharpNEAT/Core/UnityParallelListEvaluator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnityNEAT/Assets/SharpNEAT/Core/UnityParallelListEvaluator.cs b/UnityNEAT/Assets/SharpNEAT/Core/UnityParallelListEvaluator.cs index a58ecfa..0b5771d 100644 --- a/UnityNEAT/Assets/SharpNEAT/Core/UnityParallelListEvaluator.cs +++ b/UnityNEAT/Assets/SharpNEAT/Core/UnityParallelListEvaluator.cs @@ -81,12 +81,12 @@ private IEnumerator evaluateList(IList genomeList) // fitnessDict.Add(phenome, new FitnessInfo[_optimizer.Trials]); //} Coroutiner.StartCoroutine(_phenomeEvaluator.Evaluate(phenome)); + curr_group_size++; if(_optimizer.Group_Eval){ if(curr_group_size%_optimizer.Group_Size == 0){ yield return new WaitForSeconds(_optimizer.TrialDuration); } } - curr_group_size++; } }