private int CountCombinations5() { ClearDevelopedSystem(); int count = 0; int[] i = new int[5]; for (i[0] = 0; i[0] < ((RaceSelection) _selection[0]).Count; ++i[0]) { for (i[1] = 0; i[1] < ((RaceSelection) _selection[1]).Count; ++i[1]) { for (i[2] = 0; i[2] < ((RaceSelection) _selection[2]).Count; ++i[2]) { for (i[3] = 0; i[3] < ((RaceSelection) _selection[3]).Count; ++i[3]) { for (i[4] = 0; i[4] < ((RaceSelection) _selection[4]).Count; ++i[4]) { Limitation limitation = new Limitation(5, FirstRace); limitation.AddHorse(0, ((RaceSelection) _selection[0]).Get(i[0])); limitation.AddHorse(1, ((RaceSelection) _selection[1]).Get(i[1])); limitation.AddHorse(2, ((RaceSelection) _selection[2]).Get(i[2])); limitation.AddHorse(3, ((RaceSelection) _selection[3]).Get(i[3])); limitation.AddHorse(4, ((RaceSelection) _selection[4]).Get(i[4])); _weightStatisticsForTheFullSystem.Add(limitation); int countPassingGroups = 0; for (int k = 0; k < _group.Count; ++k) { if (((LimitationGroup) _group[k]).IsMatchingAllTheLimitations(limitation) == true) { ++countPassingGroups; } } if (countPassingGroups >= _minNumberOfMatchingGroups && countPassingGroups <= _maxNumberOfMatchingGroups) { ++count; _developedSystem.Add(limitation); _weightStatisticsForTheDevelopedSystem.Add(limitation); } } } } } } return _developedSystem.Count; }
private int CountCombinations4() { ClearDevelopedSystem(); int count = 0; int[] i = new int[4]; for (i[0] = 0; i[0] < ((RaceSelection) _selection[0]).Count; ++i[0]) { for (i[1] = 0; i[1] < ((RaceSelection) _selection[1]).Count; ++i[1]) { for (i[2] = 0; i[2] < ((RaceSelection) _selection[2]).Count; ++i[2]) { for (i[3] = 0; i[3] < ((RaceSelection) _selection[3]).Count; ++i[3]) { var limitation = new Limitation(4, FirstRace); limitation.AddHorse(0, ((RaceSelection) _selection[0]).Get(i[0])); limitation.AddHorse(1, ((RaceSelection) _selection[1]).Get(i[1])); limitation.AddHorse(2, ((RaceSelection) _selection[2]).Get(i[2])); limitation.AddHorse(3, ((RaceSelection) _selection[3]).Get(i[3])); _weightStatisticsForTheFullSystem.Add(limitation); int countPassingGroups = 0; for (int k = 0; k < _group.Count; ++k) { if (_group[k].IsMatchingAllTheLimitations(limitation) == true) { ++countPassingGroups; } } bool isPassingWeights = true; int value = _weightStatisticsForTheFullSystem.GetTotalValue(limitation); int weight = _weightStatisticsForTheFullSystem.GetTotalWeight(limitation); if (value > 0 && _valueWeightLimitationForTheFullSystem.ContainsWeight(value)) { isPassingWeights = false; } if (weight > 0 && _weightWeightLimitationForTheFullSystem.ContainsWeight(weight)) { isPassingWeights = false; } if (countPassingGroups >= _minNumberOfMatchingGroups && countPassingGroups <= _maxNumberOfMatchingGroups && isPassingWeights) { ++count; _developedSystem.Add(limitation); _weightStatisticsForTheDevelopedSystem.Add(limitation); } } } } } return _developedSystem.Count; }