rsgenetic

Library Archived

A library providing genetic algorithm execution.

Checked · Sources

Downloads
56
Dependents
0
Stars
77
Forks
19
Contributors
7
Commits
198
Latest release
1.8.1 ·

Why Archived

GitHub reports the repository as archived.

Exact rules: Instant archive. The check on applied thresholds version 9.

Every rule outcome, as the check records it
  • instant-archive: repository is archived

About

From the project README ·

Summary and Features

RsGenetic is a framework for executing genetic algorithms in Rust. It is designed to have a simple but modular API.

Examples and Documentation

Documentation is available here.

Implementing the Fitness trait

Note that, if your fitness type is an integer type, you do not need to write a wrapper struct around this integer. See the types module documentation for more details.

use rsgenetic::pheno::*;
use std::cmp::Ordering;

#[derive(Eq, PartialEq, PartialOrd, Ord)]
struct MyFitness {
    value: i32,
}

impl Fitness for MyFitness {
    // The zero value for our custom type
    fn zero() -> MyFitness {
        MyFitness { value: 0 }
    }

    // The absolute difference between two instances
    fn abs_diff(&self, other: &MyFitness) -> MyFitness {
        MyFitness {
            value: (self.value - other.value).abs()
        }
    }
}
Implementing the Phenotype trait

Note that we use an integer type as the fitness type parameter to make this example more simple. Replace it with your custom type if needed. In this example, we try to find individuals with two integer components that sum to a target value.

Read the full README

This example is far-fetched, but simplified to show how easy it is to define new individuals and implement the Phenotype trait.

use rsgenetic::pheno::*;

const TARGET: i32 = 100;

#[derive(Copy, Clone)]
struct MyPheno {
    x: i32,
    y: i32,
}

impl Phenotype<i32> for MyPheno {
    // How fit is this individual?
    fn fitness(&self) -> i32 {
        TARGET - (self.x + self.y)
    }

    // Have two individuals create a new individual
    fn crossover(&self, other: &MyPheno) -> MyPheno {
        MyPheno {
            x: self.x,
            y: other.y,
        }
    }

    // Mutate an individual, changing its state
    fn mutate(&self) -> MyPheno {
        MyPheno {
            x: self.x + 1,
            y: self.y - 1,
        }
    }
}
Creating and running a Simulator
use rsgenetic::pheno::*;
use rsgenetic::sim::*;
use rsgenetic::sim::seq::Simulator;
use rsgenetic::sim::select::*;

const TARGET: i32 = 100;

#[derive(Copy, Clone)]
struct MyPheno {
    x: i32,
    y: i32,
}

impl Phenotype<i32> for MyPheno {
    // How fit is this individual?
    fn fitness(&self) -> i32 {
        TARGET - (self.x + self.y)
    }

    // Have two individuals create a new individual
    fn crossover(&self, other: &MyPheno) -> MyPheno {
        MyPheno {
            x: self.x,
            y: other.y,
        }
    }

    // Mutate an individual, changing its state
    fn mutate(&self) -> MyPheno {
        MyPheno {
            x: self.x + 1,
            y: self.y - 1,
        }
    }
}

fn main() {
    let mut population = (0..100).map(|i| MyPheno { x: i, y: 100 - i }).collect();
    let mut s = Simulator::builder(&mut population)
                    .set_selector(Box::new(StochasticSelector::new(10)))
                    .set_max_iters(50)
                    .build();
    s.run();
    let result = s.get().unwrap(); // The best individual
}

See the examples directory in the repository for more elaborate examples.

Note

This library is currently in maintenance mode. There have been some indications that the API needs an update to be more flexible, which would require an incrementation of the major version number (#23, #30). Unfortunately, I currently do not have the time to implement such a redesign. I will however continue to reply to issues and merge pull requests, but features might not be implemented by me, depending on their size.

License

Licensed under either of

  • Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

Contribution

Contributions are always welcome. Take a look at the issues for any enhancements that need to be done or bugs that need to be fixed. If you encounter any bugs while using the library, feel free to open an issue and/or fix the bug, and submit pull requests.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Runs on
GPU support unknown
What shows it
  • no dependency or feature matches a backend row
Native code
None found
  • No native code found
Python bindings
No Python binding crate found
License
Apache-2.0 OR MIT

Compare with similar projects

Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.

rsgenetic beside the projects that share a topic with it
ProjectDownloadsDependentsStarsLatest releaseRuns on (GPU)Native codeLicense
rsgenetic This page Archived

A library providing genetic algorithm execution.

56 downloads over 30 days 0 77 1.8.1 GPU support unknown No native code found Apache-2.0 OR MIT
leiden-rs Listed

High-performance Leiden community detection algorithm for graphs in Rust

41,983 downloads over 30 days 10 Not measured 0.8.1 GPU support unknown No native code found Apache-2.0 OR MIT
radiate Listed

A Rust library for genetic algorithms and artificial evolution.

Python bindings

971 downloads over 30 days 0 257 1.3.2 GPU support unknown No native code found MIT
genevo Listed Dormant

genevo provides building blocks to run simulations of optimization and search problems using genetic algorithms (GA). Execute genetic algorithm (GA) simulations in a customizable and extensible way.

372 downloads over 30 days 1 185 0.7.1 GPU support unknown No native code found Apache-2.0 OR MIT
oxigen Listed Dormant

Fast, parallel, extensible and adaptable genetic algorithm library.

89 downloads over 30 days 0 183 2.2.2 GPU support unknown No native code found MPL-2.0
treeboost Listed

Gradient-boosted decision trees for tabular data: trains a baseline model in one call, with full control over boosting modes and configs, and Scalar, AVX-512, SVE2, WGPU and CUDA backends.

Python bindings

18 downloads over 30 days 0 9 0.1.2 CUDA, WebGPU No native code found Apache-2.0
revonet Listed Dormant

Rust implementation of real-coded genetic algorithm for solving optimization problems and training of neural networks. The latter is also known as neuroevolution.

9 downloads over 30 days 0 20 0.2.1 GPU support unknown No native code found GPL-3.0

Measurements and sources

Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.

Sources6 sources
Adoption0 active dependents, 0 new dependents in 365 days1 not measured
Adoption measurements
SignalValueSourceFetchedCounts
Active dependents0crates.io database dumpYes
New dependents (365 days)0crates.io database dumpYes
Peak active dependents0crates.io database dumpYes
Active dependents as a share of the peak1crates.io database dumpYes
Binary downloads per releaseNot measuredYes
MaintenanceLatest human commit: 5 years ago3 not measured
Maintenance measurements
SignalValueSourceFetchedCounts
Latest human commit2021-01-22GitHub repositoryYes
Latest release2021-01-21crates.io database dumpYes
First release2015-12-12crates.io database dumpYes
Latest version1.8.1crates.io database dumpYes
Days the oldest outside issue waits for a reply0GitHub repositoryYes
Maintainer replies over 365 days0GitHub repositoryYes
Repository archivedtrueGitHub repositoryYes
Repository gonefalseGitHub repositoryYes
Release commit or manifest in the repotruecrates.io packageYes
Published docstruecrates.io database dumpYes
Latest release fails cargo checkNot measuredYes
Build check dateNot measuredYes
Build check toolchainNot measuredYes
SecurityUnpatched vulnerabilities: none
Security measurements
SignalValueSourceFetchedCounts
Unpatched vulnerabilities past the grace windownoneRustSec advisory databaseYes
RustSec unmaintained advisorynoneRustSec advisory databaseYes
Deprecation noticenonecrates.io database dumpYes
Deprecated requirementnonecrates.io database dumpYes
Distribution52 releases, 56 downloads over 30 days5 not measured
Distribution measurements
SignalValueSourceFetchedCounts
Releases52crates.io database dumpYes
Downloads over 30 days56crates.io database dumpYes
Binary downloads over the last 3 releasesNot measuredYes
Homebrew installs on request over 365 daysNot measuredYes
Repology repository familiesNot measuredYes
Docker pull growth over 90 daysNot measuredYes
Docker pulls at the growth baselineNot measuredYes
Every version a prereleasefalsecrates.io database dumpYes
Every version 0.0.xfalsecrates.io database dumpYes
Every version yankedfalsecrates.io database dumpYes
Crate deleted from crates.iofalsecrates.io database dumpYes
Repository77 stars, 19 forks, 7 contributors, 198 commits. Stars alone never qualify a project.
Repository measurements
SignalValueSourceFetchedCounts
GitHub stars77GitHub repositoryYes — one part of the repository route
GitHub forks19GitHub repositoryYes — one part of the repository route
Contributors with a GitHub account7GitHub contributorsYes — one part of the repository route
Commits on the default branch198GitHub repositoryNo
Repository's main crate left out of the entrynonecrates.io database dumpYes
Facts that never count
Facts that never count measurements
SignalValueSourceFetchedCounts
LicenseApache-2.0 OR MITcrates.io database dumpNo
Runs on, from listed crates and their direct dependenciesGPU support unknowncrates.io database dumpNo
What shows each backendno dependency or feature matches a backend rowcrates.io database dumpNo
Native code, from listed crates and their dependenciesNo native code foundcrates.io database dumpNo
Python bindings, from direct dependencies of listed cratesNo Python binding crate foundcrates.io database dumpNo
Crates that depend on a listed crate directly0crates.io database dumpNo

Corrections and review history

Report a correction

No correction applies to this entry.

Judgments

A judgment enters only through an approved issue and a merged pull request.

No judgment applies to this entry.