diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f090c72..e5e8cd6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,20 +1,23 @@ name: Publish -on: ['workflow_dispatch'] +on: ["workflow_dispatch"] + +env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }} jobs: - publish: - runs-on: ubuntu-latest - environment: publish + publish: + runs-on: ubuntu-latest + environment: publish - steps: - - uses: actions/checkout@v4 - - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: nightly - - name: "Publish common" - run: cargo +nightly publish -p genetic-rs-common --token ${{ secrets.CARGO_TOKEN }} - - name: "Publish macros" - run: cargo +nightly publish -p genetic-rs-macros --token ${{ secrets.CARGO_TOKEN }} - - name: "Publish main" - run: cargo +nightly publish -p genetic-rs --cfg publish --token ${{ secrets.CARGO_TOKEN }} \ No newline at end of file + steps: + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: nightly + - name: "Publish common" + run: cargo +nightly publish -p genetic-rs-common + - name: "Publish macros" + run: cargo +nightly publish -p genetic-rs-macros + - name: "Publish main" + run: cargo +nightly publish -p genetic-rs --config publish diff --git a/README.md b/README.md index 3e22faa..4c90a04 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,11 @@ A small framework for managing genetic algorithms. ### Features -First off, this crate comes with the `builtin`, `crossover`, and `genrand` features by default. If you want it to be parallelized (which is true in most cases), you can add the `rayon` feature. If you want your crossover to be speciated, you can add the `speciation` feature. +First off, this crate comes with the `builtin`, `genrand`, `crossover`, `knockout`, and `speciation` features by default. If you want the simulation to be parallelized (which is most usecases), add the `rayon` feature. There are also some convenient macros with the `derive` feature. ### How to Use > [!NOTE] -> If you are interested in implementing NEAT with this, or just want a more complex example, try out the [neat](https://crates.io/crates/neat) crate +> If you are interested in implementing NEAT with this, or just want a more complex example, check out the [neat](https://crates.io/crates/neat) crate Here's a simple genetic algorithm: @@ -33,7 +33,7 @@ impl RandomlyMutable for MyGenome { } } -// allows us to use `Vec::gen_random` for the initial population. note that `Vec::gen_random` has a slightly different function signature depending on whether the `rayon` feature is enabled. +// allows us to use `Vec::gen_random` for the initial population. note that with the `rayon` feature, we can also use `Vec::par_gen_random`. impl GenerateRandom for MyGenome { fn gen_random(rng: &mut impl Rng) -> Self { Self { field1: rng.random() } @@ -50,7 +50,7 @@ fn main() { let mut rng = rand::rng(); let mut sim = GeneticSim::new( // you must provide a random starting population. - // size will be preserved in builtin nextgen fns, but it is not required to keep a constant size if you were to build your own nextgen function. + // size will be preserved in builtin repopulators, but it is not required to keep a constant size if you were to build your own. // in this case, the compiler can infer the type of `Vec::gen_random` because of the input of `my_fitness_fn`. Vec::gen_random(&mut rng, 100), FitnessEliminator::new_with_default(my_fitness_fn),