using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EvoBoat.EvoAlg.BBO;

namespace EvoBoat.EvoAlg.ZOProg
{
    public class ZO_BBOAlg<P, S> : BBOAlg<P, S, BoolVector, bool>
        where P : ZeroOneProgProblem<S>
        where S : VecSolution<BoolVector, bool>, new()
    {
        public ZO_BBOAlg() : base()
        { }

        public ZO_BBOAlg(P problem, int seed = 0) : base(problem, seed)
        {
            this.Factory = new BoolVectorSolutionFactory<P, S>(problem);
        }

        public override void SetFactory()
        {
            if (Problem == null)
                throw new ArgumentNullException("Please assign the problem instance before set the factory");
            this.Factory = new BoolVectorSolutionFactory<P, S>(Problem);
        }

        public override S Mutate(S sol, int index)
        {
            return ZO_GA<P,S>.MutationFunc(this, sol, index);
        }
    }
}
