E-TE0002 — len_at with non-zero index on a jagged array

Error Type

Type Error

Phase

type checking the model

Python exception

jijmodeling.TypeError

Message

`len_at({index})` is not allowed on a jagged array; only `len_at(0)` is supported.

Possible fix: to get inner lengths, subscript the array first.

Cause

You called .len_at(i) with i > 0 on a jagged array. Because inner rows of a jagged array have varying lengths, only the outermost length (len_at(0)) is well defined.

Fix

Use .len_at(0) for the outer length. To get the length of an inner row, subscript first:

n_rows = A.len_at(0)      # OK
row_len = A[i].len_at(0)  # length of row i, instead of A.len_at(1)