Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/11/17 20:07:13 (7 years ago)
Author:
pkimmesw
Message:

#2665 PooledPushProgram reduces memory usage and increases performance

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Generators/CodeGenerator.cs

    r14745 r14746  
    55  using HeuristicLab.Core;
    66  using HeuristicLab.Problems.ProgramSynthesis.Push.Configuration;
     7  using HeuristicLab.Problems.ProgramSynthesis.Push.Data.Pool;
    78  using HeuristicLab.Problems.ProgramSynthesis.Push.Expressions;
    89  using HeuristicLab.Random;
     
    1819  public static class CodeGenerator {
    1920
    20     public static PushProgram RandomProgram(int maxPoints, IRandom random = null, IReadonlyPushConfiguration pushGpConfiguration = null, IDictionary<string, Expression> customExpressions = null) {
     21    public static PushProgram RandomProgram(IManagedPool<PushProgram> pool, int maxPoints, IRandom random = null, IReadonlyPushConfiguration pushGpConfiguration = null, IDictionary<string, Expression> customExpressions = null) {
    2122      var code = RandomCode(maxPoints, random, pushGpConfiguration, customExpressions);
    2223
    23       return new PushProgram(code.ToArray());
    24     }
    25 
    26     public static PushProgram RandomExpandExpression(int maxPoints, IRandom random = null, IReadonlyPushConfiguration pushGpConfiguration = null, IDictionary<string, Expression> customExpressions = null) {
    27       var program = RandomProgram(maxPoints, random, pushGpConfiguration, customExpressions);
    28 
    29       return new PushProgram(program);
     24      return PushProgram.Create(pool, code.ToArray());
    3025    }
    3126
Note: See TracChangeset for help on using the changeset viewer.