Changeset 14747 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Interpreter/PushInterpreterPool.cs
- Timestamp:
- 03/12/17 13:16:56 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Interpreter/PushInterpreterPool.cs
r14744 r14747 1 1 namespace HeuristicLab.Problems.ProgramSynthesis.Push.Interpreter { 2 2 using System; 3 4 using HeuristicLab.Problems.ProgramSynthesis.Push.Data.Pool;5 3 using HeuristicLab.Core; 6 4 using HeuristicLab.Problems.ProgramSynthesis.Push.Configuration; 5 using HeuristicLab.Problems.ProgramSynthesis.Push.Data.Pool; 6 using HeuristicLab.Problems.ProgramSynthesis.Push.Expressions; 7 7 using HeuristicLab.Random; 8 8 9 9 public class PushInterpreterPool { 10 10 private readonly ObjectPool<PooledPushInterpreter> pool; 11 private ManagedPoolProvider<PushProgram> pushProgramPoolProvider; 11 12 12 13 public PushInterpreterPool(PushConfiguration config = null) 13 : this(Environment.ProcessorCount * 2, config) {14 : this(Environment.ProcessorCount * 2, 1024, null, config) { 14 15 } 15 16 16 public PushInterpreterPool(int size, PushConfiguration config = null) {17 this.PushGpConfiguration = config ?? new PushConfiguration();17 public PushInterpreterPool(int size, int pushProgramPoolPartitionSize, int? maxPartitionCount = null, PushConfiguration config = null) { 18 PushGpConfiguration = config ?? new PushConfiguration(); 18 19 19 this.pool = new ObjectPool<PooledPushInterpreter>(() => new PooledPushInterpreter(this, this.PushGpConfiguration), size); 20 pushProgramPoolProvider = new ManagedPoolProvider<PushProgram>(pushProgramPoolPartitionSize, maxPartitionCount); 21 pushProgramPoolProvider.InitDummyPartition(() => new PushProgram()); 22 23 pool = new ObjectPool<PooledPushInterpreter>(() => new PooledPushInterpreter(this, PushGpConfiguration, pushProgramPoolProvider), size); 20 24 } 21 25
Note: See TracChangeset
for help on using the changeset viewer.