When running the linear CP XOR model using the Python MiniZinc API (solve_with_API=True), the solver fails with a MiniZinc type error due to already defined variables. This issue does not occur when using the external solver execution (solve_with_API=False), even though both paths are expected to be handled uniformly via solve_for_ARX.
Steps to Reproduce:
- Go to the following test file:
tests/unit/cipher_modules/models/cp/mzn_models/mzn_xor_linear_model_test.py
- In the method
def test_find_one_xor_linear_trail_with_fixed_weight() modify the call to find_one_xor_linear_trail_with_fixed_weight as follows:
trail = mzn.find_one_xor_linear_trail_with_fixed_weight(3, solve_external=False, solve_with_API=True)
- Run the test
pytest -v -s tests/unit/cipher_modules/models/cp/mzn_models/mzn_xor_linear_model_test.py::test_find_one_xor_linear_trail_with_fixed_weight
Expected Behavior:
The model should solve correctly using the MiniZinc Python API, in the same way it does when solve_with_API=False
Actual Behavior:
The test fails with the following MiniZinc error:
minizinc.error.MiniZincError: Error: type error: identifier rot_0_0_i already defined
When running the linear CP XOR model using the Python MiniZinc API (solve_with_API=True), the solver fails with a MiniZinc type error due to already defined variables. This issue does not occur when using the external solver execution (solve_with_API=False), even though both paths are expected to be handled uniformly via solve_for_ARX.
Steps to Reproduce:
tests/unit/cipher_modules/models/cp/mzn_models/mzn_xor_linear_model_test.pydef test_find_one_xor_linear_trail_with_fixed_weight()modify the call tofind_one_xor_linear_trail_with_fixed_weightas follows:trail = mzn.find_one_xor_linear_trail_with_fixed_weight(3, solve_external=False, solve_with_API=True)pytest -v -s tests/unit/cipher_modules/models/cp/mzn_models/mzn_xor_linear_model_test.py::test_find_one_xor_linear_trail_with_fixed_weightExpected Behavior:
The model should solve correctly using the MiniZinc Python API, in the same way it does when
solve_with_API=FalseActual Behavior:
The test fails with the following MiniZinc error:
minizinc.error.MiniZincError: Error: type error: identifier rot_0_0_i already defined