@Test
  public void candidatesCountDuplicatesTest() {
    for (int parameters : new int[] {1, 2, 5}) {
      for (int choices : new int[] {1, 2, 5}) {
        for (int candidatesCount : new int[] {10, 100}) {
          for (int steps : new int[] {0, 1, 10, 100}) {
            try {
              //				System.out.println("parameters: " + parameters + ", choices: " + choices + ",
              // candidatesCount: " + candidatesCount + ", steps: " + steps);
              List<List<String>> input = GeneratorTestUtils.prepareInput(parameters, choices);
              AdaptiveRandomAlgorithm<String> algorithm =
                  new AdaptiveRandomAlgorithm<String>(0, candidatesCount, Integer.MAX_VALUE, true);
              algorithm.initialize(input, EMPTY_CONSTRAINTS);
              for (int i = 0; i < steps; i++) {
                algorithm.getNext();
              }

              List<List<String>> candidates = algorithm.getCandidates();
              assertEquals(Math.min(candidatesCount, productSize(input)), candidates.size());
            } catch (GeneratorException e) {
              fail("Unexpected GeneratorException: " + e.getMessage());
            }
          }
        }
      }
    }
  }
  @Test
  public void candidatesCountNoDuplicatesTest() {
    for (int parameters : new int[] {1, 2, 5}) {
      for (int choices : new int[] {1, 2, 5}) {
        for (int candidatesCount : new int[] {1, 10, 100}) {
          for (int steps : new int[] {0, 1, 10, 100}) {
            try {
              List<List<String>> input = GeneratorTestUtils.prepareInput(parameters, choices);
              AdaptiveRandomAlgorithm<String> algorithm =
                  new AdaptiveRandomAlgorithm<String>(0, candidatesCount, Integer.MAX_VALUE, false);
              algorithm.initialize(input, EMPTY_CONSTRAINTS);
              for (int i = 0; i < steps; i++) {
                algorithm.getNext();
              }

              List<List<String>> candidates = algorithm.getCandidates();
              assertTrue(candidates.size() <= candidatesCount);
            } catch (GeneratorException e) {
              fail("Unexpected GeneratorException: " + e.getMessage());
            }
          }
        }
      }
    }
  }
  @Test
  public void candidatesUniformityTest() {
    for (int parameters : new int[] {1, 2, 5}) {
      for (int choices : new int[] {1, 2, 5}) {
        for (int candidatesCount : new int[] {1, 10, 100}) {
          for (int steps : new int[] {0, 1, 10, 100, 1000}) {
            try {
              List<List<String>> input = GeneratorTestUtils.prepareInput(parameters, choices);
              AdaptiveRandomAlgorithm<String> algorithm =
                  new AdaptiveRandomAlgorithm<String>(0, candidatesCount, Integer.MAX_VALUE, true);
              algorithm.initialize(input, EMPTY_CONSTRAINTS);
              for (int i = 0; i < steps; i++) {
                algorithm.getNext();
              }

              List<List<String>> candidates = algorithm.getCandidates();
              if (sampleUniform(candidates, input) == false) {
                fail(
                    "Failed uniformity test for:\n"
                        + " parameters = "
                        + parameters
                        + "\nchoices = "
                        + choices
                        + "\ncandidatesCount = "
                        + candidatesCount
                        + "\nsteps = "
                        + steps);
              }
            } catch (GeneratorException e) {
              fail("Unexpected GeneratorException: " + e.getMessage());
            }
          }
        }
      }
    }
  }