using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EvoBoat.EvoAlg.IntProg
{
    public class IntVectorSolutionFactory<P, S> : SolutionFactory<P, S, IntVector>
        where P : IntProgProblem<S>
        where S : class, ISolution<IntVector>, new()
    {
        public IntVectorSolutionFactory(P problem, int seed = 0) : base(problem, seed)
        { }

        public override S CreateEmpty()
        {
            return new S() { Content = new int[Problem.Dimension] };
        }

        public override S CreateRandom()
        {
            int[] values = new int[Problem.Dimension];
            for (int j = 0; j < Problem.Dimension; j++)
                values[j] = Rand.Next(Problem.Lowers[j], Problem.Uppers[j]);
            return new S() { Content = values };
        }
    }
}
