namespace HeuristicLab.Problems.ProgramSynthesis.Push.Problem.BenchmarkSuite { using HeuristicLab.BenchmarkSuite; using HeuristicLab.BenchmarkSuite.Problems; using HeuristicLab.Common; using HeuristicLab.Core; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; using HeuristicLab.Problems.Instances; using HeuristicLab.Problems.ProgramSynthesis.Push.Configuration; using HeuristicLab.Problems.ProgramSynthesis.Push.Evaluator; using HeuristicLab.Problems.ProgramSynthesis.Push.Expressions; using HeuristicLab.Problems.ProgramSynthesis.Push.Solution; using HeuristicLab.Problems.ProgramSynthesis.Push.Solution.BenchmarkSuite; using HeuristicLab.Problems.ProgramSynthesis.Push.Stack; [StorableClass] [Creatable(CreatableAttribute.Categories.GeneticProgrammingProblems, Priority = 180)] [Item("Plush Push Problem", "")] public class PlushPushBenchmarkSuiteProblem : PlushPushProblem, IProblemInstanceConsumer { public PlushPushBenchmarkSuiteProblem() : base(new PushBenchmarkSuiteEvaluator()) { Parameters.Add(PushEvaluator.DataParameter); Parameters.Add(PushEvaluator.DataBoundsParameter); if (PushEvaluator.Data == null) { var defaultProblem = new NumberIO(); Load(defaultProblem.CreateProblemData()); } } [StorableConstructor] protected PlushPushBenchmarkSuiteProblem(bool deserializing) : base(deserializing) { } protected PlushPushBenchmarkSuiteProblem(PlushPushBenchmarkSuiteProblem original, Cloner cloner) : base(original, cloner) { } public override IDeepCloneable Clone(Cloner cloner) { return new PlushPushBenchmarkSuiteProblem(this, cloner); } public new PushBenchmarkSuiteEvaluator PushEvaluator { get { return (PushBenchmarkSuiteEvaluator)base.PushEvaluator; } } public void Load(ProblemData data) { PushEvaluator.LoadData(data); Name = "[Push][Plush] " + data.Name; Description = data.Description; BestKnownQuality = data.BestResult; Config.MaxProgramLength = data.MaxSize; Config.EvalPushLimit = data.EvalLimit; Config.ErcOptions = data.ErcOptions; Config.FloatStringFormat = data.FloatStringFormat; Config.SetEnabledStacks((StackTypes)data.EnabledDataTypes); Config.InitInExpressions(data.TotalInputArgumentCount); Encoding.MinLength = 0; Encoding.MaxLength = data.MaxSize / 2; } protected override PushSolution CreatePushSolution( PushProgram program, double bestQuality, IRandom random, IReadOnlyPushConfiguration config) { return new PushBenchmarkSuiteSolution(program, bestQuality, random, config, (PushBenchmarkSuiteEvaluator)PushEvaluator.Clone()); } } }