Questions relating to the Google CP-SAT solver, available through OR-Tools.
Questions tagged [cp-sat-solver]
105 questions
0
votes
1 answer
Limit the output variables of CP-SAT solver
The following data is given as df:
id
class
country
weigths
a
1
US
20
b
2
US
5
a
2
CH
5
a
1
CH
10
b
1
CH
5
c
1
US
10
b
2
GER
15
a
2
CH
5
c
1
US
15
a
1
US
10
The goal is to create an alternative allocation of the columns…

Robert Kl
- 1
- 1
0
votes
0 answers
Clustering of sites using OR tools (CP solver)
I am trying to make clusters of sites based on their distance from each other. I am using or tools cp solver to achieve this. The program runs fine for 40 to 50 number of sites but when i try to run for about 200 sites with each cluster containing…

zxcv
- 79
- 1
- 6
0
votes
1 answer
CP-SAT create a bool variable which represents whether a sum of variables is greater than 0
I have this piece of code in which im trying to make a variable teacher_doesnt_work that represents if Sum(classes_by_teacher[t] is 0 or not.
classes_by_teacher = {}
for t in all_teachers:
cur_classes = []
for d in all_days:
for p in…

mikecarti
- 3
- 2
0
votes
1 answer
AddBoolOr and AddImplication in cp_sat solver
Hi I have difficulty understand the following code, can anyone help to explain? Thanks in advance!
model.AddBoolOr(x, y.Not(), b)
model.AddImplication(b, x)
model.AddImplication(b, y)

Mark Spencer
- 5
- 1
0
votes
0 answers
Python OR-Tools constraint programming variable setup
I'm completely new to constraint programming and am having trouble setting up this problem. Using the below dataset, which is a simple representation of a much larger problem, I would like to generate every combination subject to a set of…

guest12102012
- 43
- 4
0
votes
1 answer
OR-Tools CP-Sat with Pyinstaller
Model works pretty fine on my pc using VS Code. Once I create an exe with pyinstaller and try to run the .exe nothing works. A small window appears for 1 sec and nothing else. I also tried some tk msg box and nothing happens.
Here are the imports of…

SixtyCorrupted
- 13
- 3
0
votes
1 answer
Resource Constrained Scheduling Project Using Pyschedule
Introduction:
I am working on a Resource Constraint Project Scheduling Problem (RCPS) and I was looking for some guidance. This is an optimization problem at its root.
Currently, I am using a library called Pyschedule where I can define an…
0
votes
0 answers
Parking problem -pickup and delivery with ordering
I am trying to solve an optimization problem, using the CP-Sat solver of Ortools, that is very similar to a standard Pickup and Delivery example but with a twist that I cannot figure out how to solve. A simplified version of my problem would be:
I…

Kaqmak
- 11
- 4
0
votes
0 answers
How to add a constraint in Google OR-Tools to limit, in the example of the job shop problem, the number of jobs that can be active at the same time?
In the example of the job shop problem (https://developers.google.com/optimization/scheduling/job_shop), the result of the optimization provides that all three jobs to be optimized are simultaneously active from time 3 to time 8. The problem I have…

Vincenzo De Leo
- 1
- 2
0
votes
1 answer
How to get consistent ortools assignment results?
The problem is to assign items into a few regions. Each item pairs have a crossing number, and the objective is to minimize the crossing of items across the regions. Each item also has a size and there is a limitation for the size of each region.
I…

yuansy
- 1
0
votes
1 answer
OR-Tools CP-SAT solver: count successive NewBoolVar occurrences
In a simple range I try to get the amount of successive assignments for a variable. The values should be between 6-12 or should be 0. For example in the case a hospital has 24 shifts and an employee should work between 6 and 12 hours or not at…

Jan Koekepan
- 81
- 1
- 9
0
votes
1 answer
Google OR Tools - Create Constraint that accesses domain values
Trying to create a Product Configurator using Google OR tools.
I got a few examples working, but cant figure out how to create string domains and access their values.
var colorValues = new string[] { "Red", "Green", "Blue" };
var sizeValues = new…

Sunny
- 932
- 8
- 22
0
votes
1 answer
ORTools CP-SAT Solver. Constraint to require two lists of variables to be drawn from the same set of integers
I have two lists of variables M and T. I would like to create a constraint where the set of unique values between M and T are identical.
From the solution variables I would like:
set(T) == set(M) -> True
So far, I have tried creating a matrix of…

Patrick Bray
- 13
- 4
0
votes
2 answers
Conceptual question about or-tools shift scheduling example
I have a conceptual question about this scheduling example:
https://github.com/google/or-tools/blob/master/examples/python/shift_scheduling_sat.py
It models the domain problem as a 3-dimensional tensor [employee, shift, day] of boolean flags,…

Bartosz
- 732
- 9
- 30
0
votes
1 answer
How to sort variables in Or-tools?
I'm using or-tools to solve a CP problem. The solver gives a feasible solution as below . It means:
X1=345, X2=437, ..., X6=1150, X7=716, X8=788...etc.
random_list=[345, 437, 801, 981, 1068, 1150, 716, 788, 860, 982, 1069, 1151, 717, 789, 861,…

MindHacks
- 931
- 2
- 7
- 9