pymoo/moead-arguments
| Rule | moead-arguments |
|---|---|
| Pack | pymoo |
| Severity | error |
| Fix | unsafe, with xpd check --fix --unsafe-fixes |
| Library versions | pymoo 0.5 and later |
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())What the rule reports
Section titled “What the rule reports”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'" |
How to fix it
Section titled “How to fix it”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.
Message
Section titled “Message”xpd prints this message with the issue. A name that starts with $ stands for code from your file.
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.Browse the other rules of the pymoo pack.