0

I'm trying to make a custom operator function for the Op enum in the radiate crate for genetic programming but I can't. Can someone give me some example for that?

I'm trying to implement for example like this:

struct sqrtplusone;
impl operation for sqrtplusone
{
    
}

But I can't find any trait similar as operation to customize it and also I don't know what to specified after it.

in this example they're using their predefine operator at

    let store = vec![
    (NodeType::Vertex, vec![Op::add(), Op::sub(), Op::mul(),Op::pow()]),
    (NodeType::Leaf, vec![Op::var(0)]),
];

link to example i want to specifine

and i trying to using my custom operator, not in their scope of predefine operations

I'm trying to write a program for discorver an equation for the logic of robot, I found that using a whole neural network is infesible in such a small chip so I'm trying to turn it into an algorithm

4
  • 2
    I don't even see any "Op enum" in this crate. Commented Oct 18 at 17:22
  • 1
    In general you can't define custom operators in Rust, so you'll have to give a little more details what exactly you mean. Commented Oct 18 at 17:25
  • 1
    @cdhowie yes it is, in their example in github.com/pkalivas/radiate/blob/master/examples/trees/… they have use: ``` let store = vec![ (NodeType::Vertex, vec![Op::add(), Op::sub(), Op::mul(),Op::pow()]), (NodeType::Leaf, vec![Op::var(0)]), ]; ``` Commented Oct 18 at 17:50
  • 1
    I didn't say it's not accessible from that crate, I said I don't see it in that crate. It looks like it's actually in the radiate_gp crate. Anyway, it seems like Op::Fn will let you specify any function you want. Commented Oct 18 at 18:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.