namespace HeuristicLab.BenchmarkSuite.Problems { using System.Linq; using Common; using Core; using HeuristicLab.Problems.ProgramSynthesis.Base.Erc; using Persistence.Default.CompositeSerializers.Storable; [StorableClass] public class ProblemData : NamedItem { public ProblemData() { ErcOptions = new ErcOptions(); // default does nothing } [StorableConstructor] protected ProblemData(bool deserializing) : base(deserializing) { } public ProblemData(ProblemData origin, Cloner cloner) : base(origin, cloner) { TrainingCount = origin.TrainingCount; TestCount = origin.TestCount; BestResult = origin.BestResult; WorstResult = origin.WorstResult; InputArgumentTypes = origin.InputArgumentTypes; OutputArgumentTypes = origin.OutputArgumentTypes; if (origin.Examples != null) Examples = origin.Examples.Select(cloner.Clone).ToArray(); EnabledDataTypes = origin.EnabledDataTypes; ErcOptions = cloner.Clone(origin.ErcOptions); } [Storable] public int TrainingCount { get; set; } [Storable] public int TestCount { get; set; } [Storable] public double BestResult { get; set; } [Storable] public double WorstResult { get; set; } [Storable] public ExampleArgumentType[] InputArgumentTypes { get; set; } [Storable] public ExampleArgumentType[] OutputArgumentTypes { get; set; } public int TotalArgumentCount { get { return InputArgumentTypes.Length + OutputArgumentTypes.Length; } } [Storable] public Example[] Examples { get; set; } [Storable] public DataTypes EnabledDataTypes { get; set; } /// /// Max Size” gives the maximum number of instructions that can appear in an individual’s genome /// [Storable] public int MaxSize { get; set; } /// /// “Eval Limit” is the number of steps of the Push interpreter that are executed before stopping a /// program’s execution; programs halted in this way may still achieve good results if they print or /// return results before they are stopped /// [Storable] public int EvalLimit { get; set; } /// /// Specifies constant values and value ranges required to solve a certain problem /// [Storable] public ErcOptions ErcOptions { get; set; } public override IDeepCloneable Clone(Cloner cloner) { return new ProblemData(this, cloner); } } }