E-IG0104 — Invalid value range dict
Error Type |
|
|---|---|
Phase |
configuring random instance generation (the |
Python exception |
|
Message
Cannot interpret the given dict as a value range ({reason}).
Possible fix: use a bounds dict of the form `{"start": {"Included": 0.0}, "end": {"Included": 1.0}}`, or pass a `(lower, upper)` tuple (the upper bound is exclusive).
({reason} is the underlying parse error, e.g. missing field `end` or unknown variant `included` )
Cause
A dictionary was passed as the value entry of a random-generation hint, but it does not have the shape of a bounds dict; the parenthesized reason in the message pinpoints the first offending part.
A bounds dict must contain both a "start" and an "end" key, and each of them must be a bound written as {"Included": v}, {"Excluded": v} (with numeric v), or the string "Unbounded".
Typical mistakes are omitting one of the two keys, misspelling the bound tags (for example lowercase "included"), or using a non-numeric endpoint.
Fix
Write both keys with properly tagged bounds, or use one of the simpler equivalent forms:
import jijmodeling as jm
problem.generate_random_dataset(
options={
"c": {"value": {"start": {"Included": 0.0}, "end": {"Excluded": 1.0}}},
# equivalently (the tuple's upper bound is exclusive):
"d": {"value": jm.generation.value.closed_open(0.0, 1.0)},
"e": {"value": (0.0, 1.0)},
},
)
The helper functions in jm.generation.value (closed, open, closed_open, at_least, at_most, …) construct these dicts for you and are less error-prone than writing them by hand.