We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The IntermediateCrossover is not terminating if it tries to crossover two equal individuals with the maximal value.
IntermediateCrossover
@Override protected int crossover(final MSeq<G> v, final MSeq<G> w) { final Random random = RandomRegistry.random(); final double min = v.get(0).min().doubleValue(); final double max = v.get(0).max().doubleValue(); for (int i = 0, n = min(v.length(), w.length()); i < n; ++i) { final double vi = v.get(i).doubleValue(); final double wi = w.get(i).doubleValue(); double t, s; do { final double a = nextDouble(-_p, 1 + _p, random); final double b = nextDouble(-_p, 1 + _p, random); t = a*vi + (1 - a)*wi; s = b*wi + (1 - b)*vi; System.out.println(format( "min=%s, max=%s, vi=%s, wi=%s, t=%s, s=%s, a=%s, b=%s, p=%s", min, max, vi, wi, t, s, a, b, _p )); } while (t < min || s < min || t >= max || s >= max); v.set(i, v.get(i).newInstance(t)); w.set(i, w.get(i).newInstance(s)); } return 2; }
With two equal individuals to crossover, the while-Loop will not terminate with maximal values.
while
min=0.0, max=100.0, vi=100.0, wi=100.0, t=100.0, s=100.0, a=0.060927758442538615, b=0.30894420728757566, p=0.0 min=0.0, max=100.0, vi=100.0, wi=100.0, t=100.0, s=100.0, a=0.9357120721578135, b=0.5412833594065434, p=0.0 min=0.0, max=100.0, vi=100.0, wi=100.0, t=100.0, s=100.0, a=0.7560184530335406, b=0.6390527838043711, p=0.0 min=0.0, max=100.0, vi=100.0, wi=100.0, t=100.0, s=100.0, a=0.7442361608972529, b=0.025760472728500128, p=0.0 min=0.0, max=100.0, vi=100.0, wi=100.0, t=100.0, s=100.0, a=0.8100080637707349, b=0.4297138951658802, p=0.0 min=0.0, max=100.0, vi=100.0, wi=100.0, t=100.0, s=100.0, a=0.02417624509603533, b=0.43765099704303234, p=0.0 min=0.0, max=100.0, vi=100.0, wi=100.0, t=100.0, s=100.0, a=0.11362305896001412, b=0.9704788776706555, p=0.0 min=0.0, max=100.0, vi=100.0, wi=100.0, t=100.0, s=100.0, a=0.480805088126826, b=0.3683165017056297, p=0.0 min=0.0, max=100.0, vi=100.0, wi=100.0, t=100.0, s=100.0, a=0.5278484685192272, b=0.36546356885717, p=0.0 min=0.0, max=100.0, vi=100.0, wi=100.0, t=100.0, s=100.0, a=0.20217221236223726, b=0.28337988416641846, p=0.0 min=0.0, max=100.0, vi=100.0, wi=100.0, t=100.0, s=100.0, a=0.9605925711966199, b=0.011420085223559528, p=0.0 min=0.0, max=100.0, vi=100.0, wi=100.0, t=100.0, s=100.0, a=0.9265911385512179, b=0.9814060743806482, p=0.0 ...
Is related to #701
The text was updated successfully, but these errors were encountered:
#718: Add unit test for reproducing error.
e7a4c47
#718: First fix of non-terminating 'IntermediateCrossover'.
4cda39b
#718: Check gene validity before crossover.
3482357
Merge pull request #721 from jenetics/issues/JENETICS-718-intermediat…
205ab9b
…e_crossover_non_terminating #718: Non-terminating 'IntermediateCrossover'
Merged into r6.0.1.
Sorry, something went wrong.
jenetics
No branches or pull requests
The
IntermediateCrossover
is not terminating if it tries to crossover two equal individuals with the maximal value.With two equal individuals to crossover, the
while
-Loop will not terminate with maximal values.Is related to #701
The text was updated successfully, but these errors were encountered: