Describe the bug
The BaseDomain.update method does not behave correctly when a variable changes type. Specifically, if a key is defined as a range variable in the original domain and as a fixed variable in the updating domain, the update does not properly override the original definition.
To Reproduce
domain1 = CartesianDomain({"x": [0, 1], "y": [0, 1], "t": 0})
domain2 = CartesianDomain({"x": 0, "z": 0})
new_domain = domain1.update(domain2)
print(new_domain.domain_dict)
Expected behavior
new_domain should reflect the values in domain2 when keys overlap. In particular, since "x" is defined as a fixed variable in domain2, it should override the ranged definition in domain1. Therefore, the expected domain is:
{"t": 0, "x": 0, "z": 0, "y": [0, 1]}
Instead, "x" keeps its original ranged definition from domain1, and the output is:
{'t': 0, 'x': (0, 1), 'z': 0, 'y': (0, 1)}
Describe the bug
The
BaseDomain.updatemethod does not behave correctly when a variable changes type. Specifically, if a key is defined as a range variable in the original domain and as a fixed variable in the updating domain, the update does not properly override the original definition.To Reproduce
Expected behavior
new_domainshould reflect the values indomain2when keys overlap. In particular, since"x"is defined as a fixed variable indomain2, it should override the ranged definition indomain1. Therefore, the expected domain is:{"t": 0, "x": 0, "z": 0, "y": [0, 1]}Instead,
"x"keeps its original ranged definition fromdomain1, and the output is:{'t': 0, 'x': (0, 1), 'z': 0, 'y': (0, 1)}