E-IG0109 — Non-string category label key

Error Type

Instance Generation Error

Phase

configuring random instance generation (the options= argument of Problem.generate_random_dataset / Problem.generate_random_instance)

Python exception

TypeError (builtin)

Message

The keys listed for category label `{name}` must all be strings.

Possible fix: write each key as a string, such as `["a", "b"]`.

({name} is the name of the category label)

Cause

The options= entry for a category label was given as a bare list (shorthand for {"keys": [...]}), but at least one element of the list is not a string, e.g. options={"C": [1, 2]}. Random generation only accepts string keys for category labels.

Fix

Write each key as a string:

problem.generate_random_dataset(options={"C": ["1", "2"]})

Alternatively, pass {"size": n} to let the generator choose n keys for you.