Questions relating to the Google CP-SAT solver, available through OR-Tools.
Questions tagged [cp-sat-solver]
105 questions
0
votes
1 answer
Optimizing ortools cp-sat for best speed
I have a very simple program in C++ with Or-tools cp-sat solver that is taking quite long to solve. on average I am getting anywhere between 500-950 randomization per second.
Here is the code
#include
#include…

Krishna
- 924
- 1
- 7
- 28
0
votes
1 answer
Counting the number of occurrences in an IntVar list in ortools
I am trying to solve a kind of an employee scheduling problem. There is a list of employee that works 24 hours shifts, 8 days in a month. I need to reduce the spread of employee count each day, but i am unable to get it to work. Because every…

Yunus Emre ÖRCÜN
- 65
- 2
- 11
0
votes
0 answers
AddAtMostOne or-tools but add at most x instead of one
I'm following https://developers.google.com/optimization/scheduling/employee_scheduling / https://developers.google.com/optimization/scheduling/job_shop in python to help me with a task. [] I want to add a constraint similar to AddAtMostOne, but I…

data24
- 21
- 2
0
votes
1 answer
Getting variable constraint value
How would I find the constraint value of a variable using SAT_INTEGER_PROGRAMMING given a feasible solution. Essentially solution_value() but for constraint.
Looked through documentation and nothing that helps with that above

Mona
- 23
- 3
0
votes
1 answer
How to run the solving process step by step
When we have defined a relatively complicated model, the solving process could be long.
One way is to cut the long solving process into phases. We can find a quick and feasible solution first with an initial objective, AND then resume the solving…

John
- 1,779
- 3
- 25
- 53
0
votes
1 answer
AddNoOverlap2D takes no arguments?
i have a python plugin i'm trying to write some parts of in C#
but adding no overlap 2D seems to confuse me.
in python it takes
model.AddNoOverlap2D(x_intervals,y_intervals)
in C# i tried but the function takes no arguments? so tried to run it…

Sonny Hansen
- 620
- 1
- 5
- 18
0
votes
1 answer
Is AddMaxEquality not compatible with OnlyEnforceIf in CP-SAT solver
When we would like to combine AddMaxEquality and OnlyEnforceIf in the model formulation, we consistently get cp_model.MODEL_INVALID.
Are these two not compatible with each other yet? If not, is there any work around?
from ortools.sat.python import…

John
- 1,779
- 3
- 25
- 53
0
votes
1 answer
How to create a bool variable to indicate if another integer variable is between two specific values
In ortools cp-sat, how could we link an boolean decision variable to whether an integer variable value is between two given values.
from ortools.sat.python import cp_model
def get(x):
return solver.Value(x)
model =…

John
- 1,779
- 3
- 25
- 53
0
votes
1 answer
Maximizing the individual distance between 2D points with OR tools CP-SAT
I am trying to write write an algorithm which maximizes the sum of Euclidian distance between 2D points.
Based on (and thanks to) this discussion, I want to put the whole thing in for loop so that this can be done for multiple points.
Here is what I…

Ken Adams
- 25
- 4
0
votes
0 answers
Can I add variables to a 2D knapsack problem that can take multiple values?
this is my first question on stack overflow and I am quite new to OR, so bear with me.
I am trying to solve what could be considered a rectangular 2D knapsack problem with a twist. In order to solve the problem, I need to fill out the entire…
0
votes
1 answer
Algorithm to parse an expression and assinging a value that satisfies the conditions
The requirement is to parse a complex expression and assign the value to the variable that satisfies the condition. For e.g.
((!(($weatherResult.cityName=="Seattle")||($weatherResult.cityName=="Portland")))&&($weatherResult.cityName=="Folsom"))
So…

Vignesh
- 3
- 2
0
votes
0 answers
OR-Tools employee scheduling: Consecutive shift only if employee worked the 1st shift
I have been sitting with the or tools shift scheduling sat
https://github.com/google/or-tools/blob/master/examples/dotnet/ShiftSchedulingSat.cs
Currently an employee can work a max of 3 consecutive days- working
An employee can work between 45 and…

Predator1987
- 45
- 4
0
votes
0 answers
Google Or tools Employee scheduling based on required number of employees to work in that shift
I am having an issue regarding scheduling in google or tools.
I am trying to build scheduler based on how many employees needed for a shift so during the day I need 10 and then from 17:00 to 20:00 (night shift) I may need anything from 10% to 100%…

Predator1987
- 45
- 4
0
votes
0 answers
Google OR: Assigning a shift in a row
The following problem arose, I wrote a restriction that some shift must be scheduled twice during the week, And this is not entirely correct, I need the shifts to go in a row, and only the last day on which the train operates is issued. That is, if…

Rnisa
- 1
- 1
0
votes
1 answer
Restriction on saving the number of change days Google OR-Tools
I started studying Google OR-Tools and decided to try to make a task from examples, adding my own restrictions. And it’s impossible to make one of them, which determines that after the worker leaves for a shift, it should remain for a random number…

Qumel
- 1