Wrong Numpy Array Type When Using Choice in MixedVariableMating #503
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
When using the
MixedVariableGA
withMixedVariableMating
(default) with aChoice(options=["const", "cosine"])
variable, I noticed that the following stepwas generating
"cosin"
instead of"cosine"
, then I realised that theX[mut, k] = v
affectation withing the_do
ofChoiceRandomMutation
was transforming"cosine"
(correct sampled value) to"cosin"
.This helped me understand that
X
was a numpy array, which was probably set with a default type not compatible with any object (looked like a fixed memory reservation looking at the truncation of"cosine"
to"cosin"
).Going back to the
MixedVariableMating
class, the_parents
are by default created withoutdtype
, I suggest to usedtype="O"
for variables of typeChoice
(looking at the doc/code, it can be any object in the list passed toChoice(options=[...])
:This resolved this quite problematic bug in my use of PyMOO.