Skip to content

pymoo/moead-arguments

Pack Severity Fix Versions
pymoo error unsafe, with xpd check --fix --unsafe-fixes pymoo 0.5+

These MOEAD arguments raise, because MOEAD sets the population size from the reference directions. Drop pop_size, and change the number of directions to change the population.

algorithm = MOEAD(ref_dirs, pop_size=100, decomposition="pbi")
algorithm = MOEAD(ref_dirs, decomposition=PBI())

The rule reports two MOEAD arguments that raise.

Argument What happens
pop_size= TypeError, "got multiple values for keyword argument 'pop_size'", because MOEAD sets the population to the number of reference directions itself since pymoo 0.5.0
decomposition= given as a string such as "pbi", the form of pymoo 0.4 AttributeError in the first generation, "'str' object has no attribute 'do'"

xpd check --fix --unsafe-fixes applies the fixes of this rule. Check the result, because an unsafe fix can change what the code does.

The unsafe fix drops pop_size, and writes PBI(), Tchebicheff(), WeightedSum(), ASF() or PerpendicularDistance() for the texts "pbi", "tchebi", "weighted-sum", "asf" and "perp_dist", in a file that imports that class from its module in pymoo.decomposition. The old call raised. "auto", "aasf" and other texts have no fix.

MOEAD sets pop_size to the number of reference directions since pymoo 0.5.0, and passing it raises TypeError, "got multiple values for keyword argument 'pop_size'". Drop pop_size, and change the number of directions to change the population.

See all rules in the pymoo pack.