Skip to content

Commit 749b4dc

Browse files
committed
fixed bug in handling of sorting named examples
1 parent 69379bb commit 749b4dc

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

  • core/src/main/kotlin/org/evomaster/core/search/gene/collection

core/src/main/kotlin/org/evomaster/core/search/gene/collection/EnumGene.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,15 @@ class EnumGene<T : Comparable<T>>(
8282

8383
val list = elements
8484
.toList() // need ordering to specify index of selection, so Set would not do
85-
.sorted() // sort, to make meaningful list comparisons
8685
.map { if (it is String) it.intern() as T else it } //if strings, make sure to intern them
86+
.run {
87+
if(valueNames == null){
88+
sorted() // sort, to make meaningful list comparisons, but only if examples are not named.
89+
// otherwise we lose vector alignment
90+
} else {
91+
this
92+
}
93+
}
8794

8895
/*
8996
we need to make sure that, if we are adding a list that has content equal to

0 commit comments

Comments
 (0)