Skip to content

MiniZinc type error when using 'solve_with_API=True' in XOR linear CP model #394

Description

@davidGG271

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:

  1. Go to the following test file:
    tests/unit/cipher_modules/models/cp/mzn_models/mzn_xor_linear_model_test.py
  2. 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)
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions