E-CE0602 — Invalid fixed-variable entry
Error Type |
|
|---|---|
Phase |
configuring |
Python exception |
|
Message
A fixed variable must be given as an `int` or `float` for scalar variables, or as a dictionary mapping subscripts to numbers for indexed variables, but got `{type_name}`.
Possible fix: adjust the entry in `fixed_variables`.
({type_name} is the Python type of the offending entry)
Cause
An entry of the fixed_variables argument (of Problem.eval, Problem.generate_random_instance, or the Compiler constructor) was neither a number nor a dictionary.
For example, fixed_variables={"x": [1.0, 0.0]} raises this error because a list is not an accepted form.
Each entry maps a decision variable name to its fixed value: a single number for a scalar variable, or a dictionary from subscripts to numbers for an indexed variable.
Fix
Give each fixed variable in one of the two accepted forms:
problem.eval(
instance_data,
fixed_variables={
"t": 3.0, # scalar variable: a single number
"x": {(0, 1): 1.0}, # indexed variable: subscripts -> numbers
},
)
If you have per-element values in a list or array, convert them to a dictionary keyed by the subscripts, e.g. {i: v for i, v in enumerate(values)}.