namespace HeuristicLab.Problems.ProgramSynthesis { using System.Diagnostics; using System.Linq; using HeuristicLab.Common; using HeuristicLab.Optimization; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; [StorableClass] public abstract class PlushPushProblem : PushProblemBase { protected PlushPushProblem(IPushEvaluator evaluator) : base(evaluator) { InitEncoding(); InitOperators(); } protected PlushPushProblem(bool deserializing) : base(deserializing) { } protected PlushPushProblem(PushProblemBase original, Cloner cloner) : base(original, cloner) { } private void InitEncoding() { Encoding.ErcOptionsParameter = Config.ErcOptionsParameter; Encoding.InstructionsParameter = Config.InstructionsParameter; Encoding.MaxCloseParameter = Config.MaxCloseParameter; Encoding.CloseBiasLevelParameter = Config.CloseBiasLevelParameter; } private void InitOperators() { if (!Operators.OfType().Any()) { Operators.Add(new PushExpressionFrequencyAnalyzer()); } if (!Operators.OfType().Any()) { Operators.Add(new IndividualZeroErrorAnalyzer()); } } protected override PushProgram MapIndividual(Individual individual) { var plushVector = individual.PlushVector(); var program = plushVector.PushProgram; if (program == null) Debugger.Break(); return program; } } }