Closed wjsuijlenh closed 3 months ago
I didn't attempt to fix the problem at the source of the process generating the expression. I now impose some reasonable rules simplifying expressions, as e.g., abs(neg(.)) => abs(.) I have pushed the code, and now, regarding your example, you should get the same expressions. (we plan to make an update on Pypi by the end of August)
best.
Nice! Thanks. I tried this morning's master branch (67ff8626) and it works now as expected.
Dear PyCSP3 developers,
I came across a strange XML generation behaviour regarding an intension expression of the form
z == abs(x[y] - x[i]) for i in range(n)
, where x, y, z are variables and n is a constant. The generated expression in XML becomeseq(z,abs(neg(sub(aux_gb[0],%0))))
.I did not expect to see a
neg
in here.If I swap the places places of
x[y]
andx[i]
, I geteq(z,dist(aux_gb[0], %0))
, which is perfect!My guess is that you intended that the first case also had a similar conversion.
Here is a small self-contained Python code that demonstrates the behaviour
On today's master (9af123e1) this generates the following XML
To summarize, I would have expected that in the XML above, the first generated intension constraint would
neg
operation