Implementation of Gene Expression Programming in Rust. Supports SL-GEP (Self-Learning Gene Expression Programming), check out references at the bottom of this README.
Add the GEP Toolkit dependency in your Cargo.toml file:
toml
[dependencies]
gep_toolkit = "0.2.0"
Use KExpression
s as your genetic population chromosomes, and use k_expr.expression(ExpressionTreeType::RGEP)
to build an expression tree and compute it (GEP and PGEP are not supported yet).
```rust use geptoolkit::operations::primitives::*; use geptoolkit::operations::opset::PrimitiveOperationSet; use geptoolkit::kexpr::builder::KExpressions; use geptoolkit::kexpr::core::{ExpressionTreeType, KExpressionParams}; use geptoolkit::k_expr::serialize::KExpressionSer;
fn main() {
let operations: Vec
let args_count = 2;
let set = PrimitiveOperationSet::new(operations, args_count);
let params = KExpressionParams {
root_length: 5,
sub_length: 10,
subs_count: 3,
reuse_sub_expr: true,
..KExpressionParams::default()
};
let ctx = KExpressions::new(set, params);
let k_expr = ctx.new_k_expr();
let root_expr = k_expr.expression(ExpressionTreeType::RGEP);
let args = vec![1.0, 2.0];
println!("{:?}", root_expr.compute_result(&args));
} ```
Note that the library is intended for expression trees generation and computing them. In order to run a simulation, you will need to use a separate GA library. Check out examples.
There's an example of running a GEP simulation on oxigen.