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

namespace EvoBoat.EvoAlg.ZOProg
{
    public class ZeroOneProgProblem<S> : IProblem<S, BoolVector>
        where S : ISolution<BoolVector>
    {
        public string Name { get; set; }
        public Func<BoolVector, double> Func { get; set; }

        protected double? optimum;
        public double? Optimum
        {
            get { return optimum; }
        }

        protected int dimension;
        public int Dimension
        {
            get { return dimension; }
        }

        public override string ToString()
        {
            return Name;
        }

        public virtual double Evaluate(BoolVector x)
        {
            return Func(x);
        }
        public virtual double Evaluate(S sol)
        {
            sol.Fit = Func(sol.Content);
            return sol.Fit;
        }

        public virtual bool IsFeasible(BoolVector x)
        {
            return true;
        }
    }
}
