- Timestamp:
- 03/11/17 20:07:13 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Tests/Benchmark/ProblemTests.cs
r14744 r14746 147 147 var instance = new BenchmarkSuiteInstanceProvider(); 148 148 var data = instance.LoadData(descriptor); 149 var provider = new ManagedPoolProvider<PushProgram>(1024); 150 provider.InitDummyPartition(() => new PushProgram()); 149 151 150 152 Parallel.For(0, iterations, i => { 151 153 var execCounter = 0; 152 var program = CodeGenerator.RandomExpandExpression(maxProgramSizeLimit, random); 154 155 var pushProgramPool = provider.CreatePool(); 156 var program = CodeGenerator.RandomProgram(pushProgramPool, maxProgramSizeLimit, random); 157 153 158 var results = new double[data.OriginalTrainingCount]; 154 159 155 160 using (var interpreter = pool.GetInstance(random)) { 161 interpreter.PushProgramPool = pushProgramPool; 162 156 163 for (var j = 0; j < data.OriginalTrainingCount; j++) { 157 164 var example = data.Examples[i]; … … 162 169 163 170 interpreter.Run(program); 164 165 var diff = GetDiff(example.OutputInt, interpreter.IntegerStack) + 166 GetDiff(example.OutputFloat, interpreter.FloatStack) + 167 GetDiff(example.OutputBoolean, interpreter.BooleanStack); 171 pushProgramPool.Dispose(); 172 173 var diff = GetDiff(example.OutputInt, interpreter.IntegerStack) 174 + GetDiff(example.OutputFloat, interpreter.FloatStack) 175 + GetDiff(example.OutputBoolean, interpreter.BooleanStack); 168 176 169 177 results[j] = diff; … … 171 179 execCounter += interpreter.ExecCounter; 172 180 interpreter.Clear(); 181 pushProgramPool = provider.CreatePool(); 173 182 } 174 183 }
Note: See TracChangeset
for help on using the changeset viewer.