E-TE0607 — Wrong number of arguments to range
Error Type |
|
|---|---|
Phase |
building expressions from Python |
Python exception |
|
Message
`jijmodeling.range` takes one, two, or three positional arguments.
Possible fix: call it in one of the following forms:
- `range(stop)`
- `range(start, stop)`
- `range(start, stop, step)`
Cause
jm.range was called with no positional arguments, or with four or more.
It mirrors Python’s built-in range and accepts exactly one, two, or three arguments: stop, start, stop, or start, stop, step.
Fix
Call it with one, two, or three integer-valued expressions:
N = problem.Natural("N")
jm.range(N) # 0, 1, ..., N-1
jm.range(1, N) # 1, 2, ..., N-1
jm.range(0, N, 2) # 0, 2, 4, ..., N-1 or N-2
Each argument may be a plain number, a placeholder, or any expression evaluating to an integer without decision variables.