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

pycsp3 fails to solve anything #29

Closed
felixbinder opened this issue Aug 5, 2022 · 4 comments
Closed

pycsp3 fails to solve anything #29

felixbinder opened this issue Aug 5, 2022 · 4 comments

Comments

@felixbinder
Copy link

I am using Python 3.9.7 on MacOS 12.4 (21F79) on Apple Silicon. Trying to solve anything will result in UNKNOWN returned by the solver. The solver log file is empty.

To reproduce, the following example from the documentation fails to work:

from pycsp3 import *

n = 4
R, G, B = colors = 0, 1, 2

# x[i] is the color of the ith node
x = VarArray(size=n, dom=colors)
print("Array x: ", x)
print("Domain of any variable: ", x[0].dom)
satisfy(
    x[0] != x[2],

    x[1] != x[3]
);
if solve() is SAT:
    print(values(x))
satisfy(
    x[0] != x[1],

    x[1] == x[2],
    
    x[2] != x[3],
    
    x[3] == x[0]
);
if solve() is SAT:
    print(values(x))
if solve(sols=ALL) is SAT:
    print("Number of solutions: ", n_solutions())
print(solve())
```.

Running this results in the following output:

(base) felixbinder@Felixs-MacBook-Pro tools_block_construction_human_experiments % /Users/felixbinder/opt/anaconda3/bin/python "/Users/felixbinder/Cloud/Grad School/Fan L
ab/Block_Construction/tools_block_construction_human_experiments/stimuli/BIBD_test_main.py"
Array x: [x[0], x[1], x[2], x[3]]
Domain of any variable: 0 1 2
UNKNOWN


I've installed pycsp3 by running `sudo pip3 install pycsp3`. 
@felixbinder
Copy link
Author

felixbinder commented Aug 5, 2022

I originally did not have Java installed, but after installing the latest Java from oracle.com nothing has changed (JRE).

@felixbinder
Copy link
Author

And I see the same behavior for both ACE and choco

@felixbinder
Copy link
Author

Update: after installing the Java Development Kit 18 it now works. Feel free to close this issue, but I am leaving it open to suggest that you add error messages if JDK is not installed and as note clearly in the documentation that JDK needs to be installed (I only saw it in the Windows install section—macOS doesn't include it anymore, I believe).

@xcsp3team
Copy link
Owner

I will try to think about this at the next update of the doc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants