예제 #1
0
        /// <summary>
        /// PickANumber is meant to be very simple.  A few numbers (bit patterns) that should have an output of 1, all others have an output of 0
        /// </summary>
        /// <param name="trueVectors">These are the bit patterns that will return an output of 1</param>
        public PAN_Evaluator(int inputArrSize, bool[][] trueVectors)
        {
            _trueVectors = trueVectors;

            _allCases = new Tuple <double[], double> [Convert.ToInt32(Math.Pow(2, inputArrSize)) + 1];

            for (int cntr = 0; cntr < _allCases.Length; cntr++)
            {
                bool[] input = UtilityCore.ConvertToBase2(cntr, inputArrSize);

                bool isTrueCase = trueVectors.Any(o => UtilityCore.IsArrayEqual(o, input));

                _allCases[cntr] = Tuple.Create(
                    input.Select(o => o ? 1d : 0d).ToArray(),
                    isTrueCase ? 1d : 0d);
            }

            _allCases[_allCases.Length - 1] = Tuple.Create(
                Enumerable.Range(0, inputArrSize).Select(o => .5).ToArray(),
                0d);

            _maxScore = Math.Pow(ERRORMULT, inputArrSize);
        }