E-CE0605 — Invalid constraint detection configuration

Error Type

Compile Error

Phase

configuring constraint detection

Python exception

TypeError (builtin)

Message

Expected a `ConstraintDetectionConfig` or a `bool` for `constraint_detection`, but got `{type_name}`.

Possible fix: pass `ConstraintDetectionConfig(...)`, `True`, or `False` (`False` disables constraint hint detection).

({type_name} is the Python type of the offending value)

Cause

The constraint_detection argument (of Problem.eval, Problem.generate_random_instance, or Compiler.eval_problem) was neither a ConstraintDetectionConfig object nor a bool. For example, constraint_detection="onehot" or constraint_detection=["onehot"] raises this error. True selects the default configuration, False disables constraint hint detection, and None (the default) also selects the default configuration.

Fix

Pass a ConstraintDetectionConfig, a bool, or omit the argument:

import jijmodeling as jm

instance = problem.eval(instance_data)                             # default detection
instance = problem.eval(instance_data, constraint_detection=False) # disable detection
instance = problem.eval(
    instance_data,
    constraint_detection=jm.ConstraintDetectionConfig(constraint_hints=["onehot"]),
)

If you meant to select which hints to detect, wrap them in ConstraintDetectionConfig(constraint_hints=[...]) instead of passing them directly.