E-TE0618 — Wrong number of data type arguments

Error Type

Type Error

Phase

declaring a placeholder data type

Python exception

TypeError (builtin)

Message

`DataType.{constructor}[...]` was given {given} type argument(s), but it takes {expected}.

Possible fix: write it as {usage}.

Cause

DataType.PARTIAL_DICT or DataType.TOTAL_DICT was subscripted with the wrong number of arguments. Each takes exactly a key type and a value type, as in DataType.PARTIAL_DICT[key, value].

Fix

Give the constructor both a key type and a value type. For example, DataType.PARTIAL_DICT[float] is missing its key type:

import jijmodeling as jm

problem = jm.Problem("example")
N = problem.Natural("N")
weights = problem.Placeholder("weights", dtype=jm.DataType.PARTIAL_DICT[N, float], ndim=1)