Changeset 14834 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Interpreter/PushInterpreterPool.cs
- Timestamp:
- 04/10/17 00:27:31 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Interpreter/PushInterpreterPool.cs
r14777 r14834 14 14 public readonly ManagedPoolProvider<PooledList<Expression>> ExpressionListPoolProvider; 15 15 16 17 16 public PushInterpreterPool(IReadOnlyPushConfiguration config = null) 18 17 : this(Environment.ProcessorCount * 2, 1024, null, config) { 19 18 } 20 19 21 public PushInterpreterPool(int size, int p ushProgramPoolPartitionSize, int? maxPartitionCount = null, IReadOnlyPushConfiguration config = null) {20 public PushInterpreterPool(int size, int poolPartitionSize, int? maxPartitionCount = null, IReadOnlyPushConfiguration config = null) { 22 21 PushGpConfiguration = config ?? new PushConfiguration(); 23 22 24 PushProgramPoolProvider = new ManagedPoolProvider<PushProgram>(p ushProgramPoolPartitionSize, () => new PushProgram(), maxPartitionCount);25 LoopStatePoolProvider = new ManagedPoolProvider<LoopState>(p ushProgramPoolPartitionSize, () => new LoopState(), maxPartitionCount);26 ExpressionListPoolProvider = new ManagedPoolProvider<PooledList<Expression>>(p ushProgramPoolPartitionSize * 2, () => new PooledList<Expression>(), maxPartitionCount);23 PushProgramPoolProvider = new ManagedPoolProvider<PushProgram>(poolPartitionSize, () => new PushProgram(), maxPartitionCount); 24 LoopStatePoolProvider = new ManagedPoolProvider<LoopState>(poolPartitionSize, () => new LoopState(), maxPartitionCount); 25 ExpressionListPoolProvider = new ManagedPoolProvider<PooledList<Expression>>(poolPartitionSize * 2, () => new PooledList<Expression>(), maxPartitionCount); 27 26 28 27 pool = new ObjectPool<PooledPushInterpreter>(() => { … … 35 34 36 35 public PooledPushInterpreter Create(IRandom random = null) { 37 var interpreter = this.pool.Allocate();38 interpreter.Random = random ?? new FastRandom();36 var interpreter = pool.Allocate(); 37 interpreter.Random = random ?? new MersenneTwister(); 39 38 40 39 return interpreter; … … 42 41 43 42 public void Free(PooledPushInterpreter interpreter) { 44 this.pool.Free(interpreter);43 pool.Free(interpreter); 45 44 } 46 45 }
Note: See TracChangeset
for help on using the changeset viewer.