Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.8.2: partial functions and undefined values: missing solution #766

Closed
matsc-at-sics-se opened this issue Dec 15, 2023 · 2 comments
Closed
Assignees
Labels
bug resolved Issue is resolved and the feature or fix will be part of next release

Comments

@matsc-at-sics-se
Copy link

[Another facet of #760].

This is expected (warnings omitted):

$ cat /tmp/bug.mzn 
var {2}: A;
var {2}: B;
constraint
    (((((B - A) ^ -1) * 3) = 3) <-> false);
$ minizinc -a /tmp/bug.mzn 
A = 2;
B = 2;
----------
==========

But if I extend the domains, the solution A = B = 2 is lost:

$ cat /tmp/bug.mzn 
var {-2,2}: A;
var {-2,2}: B;
constraint
    (((((B - A) ^ -1) * 3) = 3) <-> false);
$ minizinc -a /tmp/bug.mzn 
A = 2;
B = -2;
----------
A = -2;
B = 2;
----------
==========

If I find more cases, I will add them to this issue.

@Dekker1
Copy link
Member

Dekker1 commented Dec 15, 2023

Thank you for the issue report.

It seems something is going wrong when translating the <expr> = 3 expression. Because the top level is <expr> <-> false. It converts = into !=, removing the outer expression. However, since this now changes the Boolean context in which the partiality is captured into the root context, this causes the whole model to become unsatisfiable when A = B = 2.

This is easy to see if you add a few extra constraints:

var {-2,2}: A;
var {-2,2}: B;
constraint
    (((((B - A) ^ -1) * 3) = 3) <-> false);
    
constraint A = B;
constraint A = 2;

Which gets translated into:

array [1..1] of int: X_INTRODUCED_16_ = [3];
var 2..2: A:: output_var;
var -1..1: X_INTRODUCED_15_ ::var_is_introduced :: is_defined_var;
constraint int_div(1,1,X_INTRODUCED_15_):: defines_var(X_INTRODUCED_15_);
constraint int_lin_ne(X_INTRODUCED_16_,[X_INTRODUCED_15_],3);
solve  satisfy;

@Dekker1 Dekker1 added the bug label Dec 15, 2023
@matsc-at-sics-se
Copy link
Author

This is likely the same issue. MiniZinc finds two solutions with B = 2, but there are two more with B = 0.

$ cat /tmp/latest.mzn 
var {0,2}: B;
var -3.. -2: C;
constraint (((((5 div 0) * C))=B) <-> false);
$ minizinc -a /tmp/latest.mzn 
B = 2;
C = -3;
----------
B = 2;
C = -2;
----------
==========

@Dekker1 Dekker1 self-assigned this Jan 2, 2024
@Dekker1 Dekker1 added the resolved Issue is resolved and the feature or fix will be part of next release label Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug resolved Issue is resolved and the feature or fix will be part of next release
Projects
None yet
Development

No branches or pull requests

2 participants