[mlpack-git] [mlpack/mlpack] NeuralEvolution - implemented gene, genome (#686)

Marcus Edel notifications at github.com
Sat Jul 2 18:27:44 EDT 2016


> +
> +  // Get link index by innovation id.
> +  ssize_t GetLinkIndex(ssize_t innovId) const {
> +    for(ssize_t i=0; i < NumLink(); ++i) {
> +        if (aLinkGenes[i].InnovationId() == innovId) {
> +            return i;
> +        }
> +    }
> +
> +    return -1;  // Id start from 0.
> +  }
> +
> +  // Whether link exist and enabled.
> +  bool ContainEnabledLink(ssize_t innovId) const {
> +    for(ssize_t i=0; i < NumLink(); ++i) {
> +        if (aLinkGenes[i].InnovationId() == innovId &&

If we split the if condition, we could return right after we found the neuron with the specified `innovId`, enabled or not.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/686/files/554a279b0089e4385dfb40077e578d6ae2a42ece#r69383407
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160702/9fc546b3/attachment.html>


More information about the mlpack-git mailing list