File "<ipython-input-38-265bc4b2dac2>", line 59…
- User
File "", line 59 cross_sols=binary_crossover(binary_variables,sols,nc,fitness_values,with_revision=False,selection_pct) ^ SyntaxError: positional argument follows keyword argument
- Assistant
The error message you're encountering indicates that there is a syntax error in your function call. Specifically, a positional argument has been placed after a keyword argument in the function call, which isn't allowed in Python.
Here's the relevant part of your code:
cross_sols = binary_crossover(binary_variables, sols, nc, fitness_values, with_revision=False, selection_pct)In this line,
with_revision=Falseis a keyword argument that is placed beforeselection_pct, which seems to be a positional argument. In Python, all positional arguments must come before any keyword arguments in a function call.To fix this issue, simply reorder the arguments so that all positional arguments appear before any keyword arguments. Here's the corrected line:
cross_sols = binary_crossover(binary_variables, sols, nc, fitness_values, selection_pct, with_revision=False)In this corrected version,
selection_pctis now treated as a positional argument before the keyword argumentwith_revision.