public void TestAbKeyboard()
        {
            var keyboard = new Keyboard(new[]{2},SetUtil.NewHash('a','b'));

            var firstPos = new KeyboardPosition(0,0);
            var secondPos = new KeyboardPosition(0,1);
            var times = new TransitionTimes(keyboard);
            times[firstPos, secondPos] = 1;
            times[firstPos, firstPos] = 2;
            times[secondPos, secondPos] = 2;
            times[secondPos, firstPos] = 2;
            var goodLayout = new KeyboardLayout("ab", keyboard);
            var badLayout = new KeyboardLayout("ba",keyboard);
            var occurrences = new double[keyboard.AllChars.Count, keyboard.AllChars.Count];
            var corpus = new Corpus(occurrences, 1000,keyboard);
            corpus['a', 'b'] = 100;
            var goodScore = KeyboardEPAlgorithm.Score(goodLayout, corpus, times);
            var badScore = KeyboardEPAlgorithm.Score(badLayout, corpus, times);
            Assert.That(goodScore > badScore);
        }
        KeyboardEPAlgorithm GetTestAlgorithm()
        {
            const int width = 3;
            const int height = 3;
            const int keyboardKeyCount = width * height;
            var keyboard = new Keyboard(Enumerable.Range(0, height).Select(_ => width).ToArray(),
                Keyboard.StandardKeyboard.AllChars.Take(keyboardKeyCount).ToHashSet());
            var timeBuilder = TransitionTimeBuilder.GetEmpty(keyboard);
            var fractions = new double[keyboardKeyCount, keyboardKeyCount];
            for (var i = 0; i < keyboardKeyCount; i++)
            {
                for (var j = i; j < keyboardKeyCount; j++)
                {
                    var miliseconds = i + j * keyboardKeyCount;
                    timeBuilder[i, j].AddMeasurement(miliseconds);
                    fractions[i, j] = miliseconds;
                }
            }

            var corpus = new Corpus(fractions, keyboardKeyCount, keyboard);
            var algorithm = new KeyboardEPAlgorithm(corpus, timeBuilder.Times, GetLogger());
            algorithm.SetLayout(KeyboardLayout.Random(keyboard));
            return algorithm;
        }
 void AddNamedCorpus(string name, Corpus corpus)
 {
     corpi.Add(Tuple.Create(corpus,name));
 }