public static void main(final String[] args) {
		final Knapsack knapsack = Knapsack.of(15, new Random(123));

		// Configure and build the evolution engine.
		final Engine<BitGene, Double> engine = Engine.builder(knapsack)
			.populationSize(500)
			.survivorsSelector(new TournamentSelector<>(5))
			.offspringSelector(new RouletteWheelSelector<>())
			.alterers(
				new Mutator<>(0.115),
				new SinglePointCrossover<>(0.16))
			.build();

		// Create evolution statistics consumer.
		final EvolutionStatistics<Double, ?>
			statistics = EvolutionStatistics.ofNumber();

		final Phenotype<BitGene, Double> best = engine.stream()
			// Truncate the evolution stream after 7 "steady"
			// generations.
			.limit(bySteadyFitness(7))
			// The evolution will stop after maximal 100
			// generations.
			.limit(100)
			// Update the evaluation statistics after
			// each generation
			.peek(statistics)
			// Collect (reduce) the evolution stream to
			// its best phenotype.
			.collect(toBestPhenotype());

		System.out.println(statistics);
		System.out.println(best);
	}
Factory method for creating <i>same</i> Knapsack problems for testing
purpose.

@param itemCount the number of knapsack items in the basic set
@param random the random engine used for creating random knapsack items.
       This allows to create reproducible item sets and reproducible
       {@code Knapsack} problems, respectively.
@return a {@code Knapsack} problem object (for testing purpose).
jenetics.example/src/main/java/io/jenetics/example/Knapsack.java