Coder Social home page Coder Social logo

mithi / rusty-genes Goto Github PK

View Code? Open in Web Editor NEW
138.0 8.0 14.0 39.16 MB

Genetic algorithm implementation in Rust with animated visualizations in Python

License: MIT License

Python 29.17% Rust 70.83%
genetic-algorithm rust travelling-salesman-problem travelling-salesman

rusty-genes's Introduction

Rusty Genes

$ curl https://sh.rustup.rs -sSf | sh
$ cd citydna
$ cargo test -- --nocapture
$ cargo build
$ cargo run ./data/specs/specs1.csv ./data/cities/cities0.csv
$ cargo run ./data/specs/specsABC.csv ./data/cities/citiesA.csv > ./NEW_OUTPUT.csv

REFERENCES

33Mudy961bUk9zz35p68g9fE3uuHLRduRp

rusty-genes's People

Contributors

big-c-note avatar mikong avatar mithi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rusty-genes's Issues

Swap Population Creation and Challenger Selection in run()

https://github.com/mithi/rusty-genes/blob/rusty-genes/citydna/src/simulation.rs

        assert!(skip > 0, "skip must be 1 or larger");

        let mut population = random_population(self.population_size, &self.cities);
        let mut champion = find_fittest(&population);

        for i in 0..self.iterations {

            let challenger = find_fittest(&population);
            population = self.generate_population(population);
            debug_print(debug_level, skip, i + 1, &population, &champion, &challenger, self.number_of_cities);

            if champion.fitness <= challenger.fitness {
                champion = challenger;
            }
        }

        self.fitness = champion.fitness;
        self.dna = champion.dna;

        if debug_level >= 2 { self.print(); }
    }

You may want to swap let challenger = find_fittest(&population); and population = self.generate_population(population);

In that way you are getting the challenger from the newest generated population. As written, in the last iteration, you would be looking at the challenger from the previous iteration.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.