using HeuristicLab.Problems.ProgramSynthesis;

namespace HeuristicLab.BenchmarkSuite.Problems {
  public class SumOfSquares : BenchmarkSuiteDataDescriptor {
    private const string name = "Sum of Squares - Hard";
    private const string fileName = "SumOfSquares.csv";
    private const string description = "Given integer n, return the sum of squaring each integer in the range[1, n].";

    protected override string FileName { get { return fileName; } }
    public override string Name { get { return name; } }
    public override string Description { get { return description; } }
    protected override int InputArgumentCount { get { return 1; } }
    protected override int OutputArgumentCount { get { return 1; } }

    public override ProblemData CreateProblemData() {
      return new ProblemData(ProblemType.SumOfSquares) {
        Name = Name,
        Description = Description,
        ProgramExecutionBudget = 15000000,
        Examples = CloneExamples(),
        BestResult = 0,
        WorstResult = 1000000000, // 338350,
        InputArgumentTypes = new[] { ExampleArgumentType.Integer },
        OutputArgumentTypes = new[] { ExampleArgumentType.Integer },
        TrainingCount = 50,
        TestCount = 100,
        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean,
        MaxSize = 400,
        EvalLimit = 4000,
        ErcOptions = {
          ErcProbability = 0.05,
          IntegerErcOptions = new IntegerErcOptions(
            new IntegerRangeErc(-100, 100))
        }
      };
    }

    protected override Example ParseExample(string[] input, string[] output) {
      return new Example {
        InputArgs = input,
        OutputArgs = output,
        InputInteger = ExampleArgumentConverter.ConvertIntegers(input[0]),
        OutputInteger = ExampleArgumentConverter.ConvertIntegers(output[0]),
      };
    }
  }
}