E-IG0108 — List option for a non-category-label

Error Type

Instance Generation Error

Phase

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

Python exception

ValueError (builtin)

Message

The generation option for `{name}` is a list, but only category labels accept a list of keys.

Possible fix: pass a dict hint such as `{"keys": [...]}` or `{"value": (0.0, 1.0)}` instead.

({name} is the key of the offending entry in options=)

Cause

An entry of the options= dictionary was a bare list, but its name is not a category label of the problem. A bare list such as options={"C": ["a", "b"]} is shorthand for options={"C": {"keys": ["a", "b"]}}, and this shorthand is accepted only for category labels. For placeholders (including partial dictionaries) and for names that are not defined in the problem, the entry must be a hint dict.

Fix

Write the option for the placeholder as a hint dict. For example, to restrict a partial dictionary D keyed by category label C to a subset of keys:

problem.generate_random_dataset(
    options={
        "C": ["X", "Y", "Z"],
        "D": {"keys": ["X", "Y"]},
    },
)

If the name was meant to be a category label, check its spelling against the names of the problem’s category labels.