Main

The preamble to src/main.rs is typical for the programs we've seen so far in this book:

extern crate feruscore;
extern crate rand;
extern crate rayon;

use feruscore::individual::*;
use rand::{thread_rng, Rng};
use rayon::prelude::*;
use std::collections::VecDeque;
use std::fs::File;
use std::fs::{self, DirBuilder};
use std::io::{self, BufWriter};
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::{thread, time};

The program does start, however, with an abnormally large block of constants and statics:

// configuration const POPULATION_SIZE: u16 = 256; // NOTE must be powers of two const CHROMOSOME_SIZE: u16 = 25; // Must be <= 100 const PARENTS: u16 = POPULATION_SIZE / 8; const CHILDREN: u16 = PARENTS ...

Get Hands-On Concurrency with Rust now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.