E-IG0105 — Invalid value range hint

Error Type

Instance Generation Error

Phase

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

Python exception

TypeError (builtin)

Message

Cannot interpret a value of type `{type_name}` as a value range.

Possible fix: pass one of the following:
  - a number
  - a `range` with step 1
  - a `(lower, upper)` tuple (either side may be `None`; the upper bound is exclusive)
  - `None`
  - a bounds dict

({type_name} is the Python type name of the rejected value)

Cause

The value entry of a random-generation hint was a value that cannot be understood as a range of numbers. Accepted forms are: an int or float (a fixed constant), a Python range with step 1, a (lower, upper) tuple whose elements are numbers or None (the upper bound is exclusive; None means unbounded on that side), None (fall back to the default), a (start, end) pair of bound dicts, or a bounds dict of the form {"start": ..., "end": ...}. Anything else — for example a string or a list — is rejected with this error.

Fix

Pass the value range in one of the accepted forms:

import jijmodeling as jm

problem.generate_random_dataset(
    options={
        "c": {"value": (0.0, 1.0)},                             # 0.0 <= c < 1.0
        "d": {"value": jm.generation.value.closed(-1.0, 1.0)},  # -1.0 <= d <= 1.0
        "e": {"value": 3.5},                                    # constant 3.5
    },
)