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

CP-SAT solver stopped working on Windows after updating to ortools 9.10 #4225

Closed
vaidzelevich opened this issue May 9, 2024 · 10 comments
Closed
Assignees
Labels
Lang: Python Python wrapper issue OS: Windows Windows OS
Milestone

Comments

@vaidzelevich
Copy link

What version of OR-Tools and what language are you using?
Version: v9.10
Language: Python

Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)
CP-SAT

What operating system (Linux, Windows, ...) and version?
Windows

What did you do?
The following simple script silently stops at the line status = solver.solve(model). There is nothing in the console.

from ortools.sat.python import cp_model


def simple_sat_program():
    model = cp_model.CpModel()

    num_vals = 3
    x = model.new_int_var(0, num_vals - 1, "x")
    y = model.new_int_var(0, num_vals - 1, "y")
    z = model.new_int_var(0, num_vals - 1, "z")

    model.add(x != y)
    
    solver = cp_model.CpSolver()
    solver.parameters.log_search_progress = True
    status = solver.solve(model)

    if status == cp_model.OPTIMAL or status == cp_model.FEASIBLE:
        print(f"x = {solver.value(x)}")
        print(f"y = {solver.value(y)}")
        print(f"z = {solver.value(z)}")
    else:
        print("No solution found.")


simple_sat_program()

What did you expect to see
Optimal values of x, y, z

What did you see instead?
Nothing.

@lperron
Copy link
Collaborator

lperron commented May 9, 2024

strange, I just created a venv, installed ortools and ran the ortools/sat/samples without any problem.

Which python version ?

CpSolverResponse summary:
status: OPTIMAL
objective: NA
best_bound: NA
integers: 0
booleans: 0
conflicts: 0
branches: 0
propagations: 0
integer_propagations: 0
restarts: 0
lp_iterations: 0
walltime: 0.0207079
usertime: 0.020708
deterministic_time: 0
gap_integral: 0
solution_fingerprint: 0x9b9ccaae26ad3f85

x = 1
y = 0
z = 0
@vaidzelevich
Copy link
Author

Python 3.11.1

@lperron
Copy link
Collaborator

lperron commented May 9, 2024

try another python version ? I used 3.12.3

@apavelm
Copy link

apavelm commented May 10, 2024

It looks like there are some breaking changes in CpSolver in 9.10 that doesn't work. But in python it doesn't reboot the server like in .NET #4224

@vaidzelevich
Copy link
Author

Now everything is working fine. Updating the build tool for Visual Studio seems to help.

P.S. thanks for such a wonderful library.

@apavelm
Copy link

apavelm commented May 10, 2024

P.S. thanks for such a wonderful library.

I agree, the library is really great!

@nhuet
Copy link

nhuet commented May 10, 2024

This is still not working for me on python 3.11 + windows + ortools 9.10. IMHO This should not be closed.

@nhuet
Copy link

nhuet commented May 10, 2024

And i have the same issue with python 3.12 also. Error shown:

Segmentation fault
@lperron
Copy link
Collaborator

lperron commented May 10, 2024 via email

@Mizux Mizux self-assigned this May 11, 2024
@Mizux Mizux added OS: Windows Windows OS Lang: Python Python wrapper issue labels May 11, 2024
@Mizux Mizux added this to the v9.10 milestone May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Lang: Python Python wrapper issue OS: Windows Windows OS
5 participants