E-TE0602 — Callable used as an expression takes no arguments
Error Type |
|
|---|---|
Phase |
building expressions from Python |
Python exception |
|
Message
A callable used as an expression must take at least one argument, but this one takes none.
Possible fix: add index parameters (e.g. `lambda i: ...`).
Cause
A callable (a function or a lambda) was passed where an expression is expected, but its signature declares no parameters.
Callables are accepted as index-dependent expressions: JijModeling calls them with one index expression per parameter to build the body, so a callable with zero parameters leaves no place to feed the index in.
A typical trigger is writing jm.sum(N, lambda: x[0]) or N.map(lambda: c) instead of lambda i: ....
Fix
Give the callable one parameter per index it should receive:
jm.sum(N, lambda i: x[i])
W.items().map(lambda k, w: w * x[k])
If the body, say c, does not actually depend on the index, you can just specify plain c without lambda.