E-CE0203 — Decision variable subscript out of range

Error Type

Compile Error

Phase

compiling the problem into an OMMX instance

Python exception

jijmodeling.ModelingError

Message

Subscript `{subscript}` for decision variable `{name}` is not covered by the {what} (`{shape}`)

Cause

A decision variable was addressed with a subscript that is not covered by its declared domain or by a bound supplied for it; the message names which of the two failed. When the variable’s domain does not cover the subscript, the variable was addressed outside its declared shape or key set — for example in a constraint that iterates further than the variable’s declared size, or in a Compiler.get_decision_variable_by_name lookup. When the bound given for the variable is what fails, the subscript is within the variable’s domain, but the lower- or upper-bound array or dict supplied for the variable has no entry at that subscript. Out-of-range entries in fixed_variables are reported as E-CE0018 instead.

Fix

Keep every subscript within the variable’s declaration: check the shape/keys the variable was declared with, and make loop ranges and lookups respect them. When a bound is what fails to cover the subscript, supply a bound array or dict with an entry for every subscript in the variable’s domain, or use a single scalar bound.