May 2019
Intermediate to advanced
698 pages
17h 21m
English
Examples include the traveling salesman problem, where a tour of the shortest path connecting n cities has to be found. With a O(n!) runtime complexity, only 20 cities prove to be computationally very expensive, but it can be solved well enough for a very large n by starting off with a random order of cities (tour), and then repeatedly recombining or randomly changing (mutating) several of these tours only to select the best ones and restarting the process with these.
Using the rsgenetic crate (https://crates.io/crates/rsgenetic), implementing the solution becomes a matter of implementing the TspTour trait, which requires a fitness() function to be supplied so that a solution can be evaluated, the ...
Read now
Unlock full access