You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gabriele Rossi <el...@mail.com> on 2018/02/16 21:11:48 UTC

[MATH][MATH-1451] Infinite loop for CycleCrossover with duplicates

Hello,
I posted following issue and was suggested to mail here by Gilles:
https://issues.apache.org/jira/browse/MATH-1451

I've found an infinite loop when recombining two integers Chromosomes admitting duplicates with CycleCrossover class.

For example, recombining example Chromosomes it works fine, but, if you substitute all "8" with "7", you run into an infinite loop while mating.
I attached to the issue the self-contained unit test (JUnit) for a better comprehension (issue a mvn clean install to run).

I'd suggest to either:
- reduce scope to permutations not allowing duplicates (strictly ordered), which should be stated by documentation and checked as a precondition by code.
- patch it, creating a CycleCrossoverDuplicates: I quickly applied a patch, which I'd be happy to provide, nonetheless could be less efficient than original algorithm due to more complex checks. And programmed by someone who has no knowledge of this code, either :)

Let me know if I can contribute in any way.

Thanks for your attention,

Gabriele Rossi

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [MATH][MATH-1451] Infinite loop for CycleCrossover with duplicates

Posted by Gilles <gi...@harfang.homelinux.org>.
Hi Gabriele.

On Fri, 16 Feb 2018 22:11:48 +0100, Gabriele Rossi wrote:
> Hello,
> I posted following issue and was suggested to mail here by Gilles:
> https://issues.apache.org/jira/browse/MATH-1451
>
> I've found an infinite loop when recombining two integers Chromosomes
> admitting duplicates with CycleCrossover class.
>
> For example, recombining example Chromosomes it works fine, but, if
> you substitute all "8" with "7", you run into an infinite loop while
> mating.
> I attached to the issue the self-contained unit test (JUnit) for a
> better comprehension (issue a mvn clean install to run).
>
> I'd suggest to either:
> - reduce scope to permutations not allowing duplicates (strictly
> ordered), which should be stated by documentation and checked as a
> precondition by code.
> - patch it, creating a CycleCrossoverDuplicates: I quickly applied a
> patch, which I'd be happy to provide, nonetheless could be less
> efficient than original algorithm due to more complex checks. And
> programmed by someone who has no knowledge of this code, either :)
>
> Let me know if I can contribute in any way.

First of all, thanks for your interest.

Quoting my comment on JIRA:
---CUT---
This is to say that if you are a heavy user of the genetics
package, and are able, and willing, to maintain it, you are
welcome to signal it on the "dev" ML. The ensuing discussion
would clarify whether a new "Commons Genetics" component would
be acceptable to the project leaders.
---CUT---

In other words, please indicate why and how you'd be willing
to contribute to the continuation of this functionality.

On the one hand, I'm not a user of the "o.a.c.m.genetics",
and on the other, I have some doubt that it is flexible
enough to compete with other packages out there that do
genetic algorithms/programming.
[This is to explain why at this point I won't commit
changes in that package.]

A sure thing (IMHO) is that the package should be turned
into a (maven) module, similar to what was done for those
functionalities moved to [RNG], [Numbers], [Statistics]
(even it would stay in a "legacy" [Math] component).
[The bug you refer to would of course be fixed along the
way.]

Please note that, independently of this discussion, you
are most are welcome to help with the other issues (and
migration tasks) concerning the math-related utilities.[1]

Best regards,
Gilles

[1] See e.g. those JIRA projects:
       https://issues.apache.org/jira/projects/NUMBERS
       https://issues.apache.org/jira/projects/STATISTICS


> Thanks for your attention,
>
> Gabriele Rossi
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org