# Questions tagged [or-tools]

Questions related to or-tools, Google's open-source software suite for optimization

170 questions
Filter by
Sorted by
Tagged with
88 views

### Assignment of colored boxes to groups

I am working on a problem that I think can be solved as an extension to the assignment problem, but am open to hear about other ways to solve. PROBLEM There are a lot of colored boxes. For each color ...
• 23
1 vote
61 views

### Information shared among workers in OR-tools CP-SAT

I stumbled upon this video while using OR-Tools CP-SAT solver https://www.youtube.com/watch?v=lmy1ddn4cyw At around 12:10, the part of multithreaded solvers starts. I understand these solvers are ...
107 views

### CP-SAT: Workarounds for OnlyEnforceIf with Linear Expressions

Background I've written a solver that selects a subset of people from a larger pool such that the subset has at least X people per attribute (Gender/Job/Country etc. X differs per attribute). This ...
• 41
1 vote
69 views

### Vehicle Routing Problem OR-tools - Distance between solutions / vehicles

I have an alternative problem which I reckon can be solved using OR-tools. For this problem, apart from the distance between nodes within a solution, I also need the distance between the n-th node of ...
• 11
87 views

### Solving a weighted XOR-SAT problem

I want to solve a variant of the weighted XOR-SAT problem. Concretely, Given $n$ boolean variables $x_1,\ldots,x_n$ each of which is assigned a non-negative cost $c_1,\ldots,c_n\in\mathbb{R}_{\ge 0}$ ...
• 123
1 vote
70 views

### Implementing soft time window constraints with time_matrix dependent on vehicle types

I am solving a CVRPTWPD using Google ORTools. Here, objective is to minimize the travelled distance and not time. I have start locations for each vehicle but arbitrary end locations are possible. I ...
• 201
63 views

### How to set the parameters for GLOP for a DUAL_FEASIBLE case

Now I have a linear programming model, I have tried to formulate this model with or-tools, and then solve it with the GLOP but failed. After reaching the 15-minute time limit, the status of GLOP is ...
• 105
1 vote
139 views

### Google Cloud Fleet Routing... what types of VRPs does it cover?

I'm familiar with solving VRPs in Google's ortools. Has anybody used Google's new Cloud Fleet Routing capability (separate from ...
• 763
126 views

### Or-Tools：glop or clp to solve a LP

I have a linear programming problem where I use Or-Tools interface in Java for modeling. When using SCIP, I sometimes encounter memory errors and the solving time is relatively long. Later, I changed ...
• 105
140 views

### Or-Tools: Process finished with exit code 132 (interrupted by signal 4: SIGILL)

Now I am using Or-Tools via the Java interface to solve a LP. ModelBuilder model = new ModelBuilder(); ModelSolver solver = new ModelSolver("SCIP"); ...
• 105
1 vote
482 views

### Google-OR Tools: Assignment minimizing overlapping members

I'm rusty on constraint optimization and am looking for help in this particular use case. There are individuals who are each member to several teams. This is a fixed many-to-many relationship and is ...
271 views

### OR-Tools CP-SAT solver: is it possible to name a constraint like in GUROBI

I try to implement cp model with OR-tools CP-SAT solver. Please, is it possible to name constraints for being able to manage conflict later like for variables: ...
• 65
1 vote
84 views

### How to cmpute IIS using the Or-Tools solver?

I'm trying to solve a MIP using Google Or-Tools, but it's showing that the model is infeasible. I'd like to know if there is a convenient way to analyze which constraint or variable bounds are causing ...
• 105
1 vote
90 views

### Output a readable model file and control the solver parameters in Or-Tools

I am using Java to call the API of or-tools in IntelliJ IDEA to solve a mixed-integer programming problem. There are some modeling statements such as ...
• 105
1 vote
61 views

### Evaluation of linear expression with docplex based on a solution

For a CpModel using docplex, is there any function to evaluate a linear expression based on the variables values in the final solution? For example, for ...
• 11
1 vote
111 views

### Non integer linear objective in or-tools CP-SAT

It seems that or-tools' CP-SAT solvers allows for non-integer coefficients in a linear objective expression. Am I correct, or is it just that the solver doesn't check for integrity and rounds the ...
1 vote
97 views

### Scheduling repeated tasks with minimum duty cycles

Several tasks need to run repeatedly in a channel, one at a time, over a repeating time frame of length $T$. Associated to each task $i$ is the duration $L_i$ the task will take to run, and a maximum ...
• 111
76 views

### Formulating assignment problem with people attributes that need to be balanced per assignment attribute in or-tools, CP-sat

I'm trying to do an assignment problem with the following characteristics: I have two sets that need to be matched with each other, set A (Students) and set B (Class combinations). Set A and B have ...
• 41
139 views

### Using binary variable or integer variable in Constraint Programming (CP)?

I am trying to solve an assignment problem by Constraint Programming (CP). Let us consider a task assignment problem that have $|M|$ tasks and $|N|$ machines, each task has different processing time ...
• 707
123 views

### Numerically stable way to optimize a lexicographical preference between two objective functions?

I am solving a mixed-integer program whose decision variables are $x \in \{0, 1\}^n$ and $y \in \mathbb{R}^m$, where $0 \leq y_j \leq u_j$ for constant upper bounds. My primary objective function is ...
• 534
43 views

### Adding synchronisation constraint in Prize-collecting VRPTW

I am solving a Prize Collecting VRPTW. In my problem, each node represents a visit that needs to be made within a certain time window, and the "prize" for each node is the time spent at the ...
• 33
114 views

### Team Orienteering Problem with Time Windows infeasible using CP-SAT solver in Google OR-Tool

I am developing a TOPTW where there are a set of N nodes. Each node i is associated with a visit time, which is also the score Si. The starting point and the end point of each tour is fixed, which is ...
• 33
152 views

### Are there any hidden differences in OR-Tools' default parameters for a MIP model in Python vs C++?

or-tools-discuss cross post here. As a disclaimer -- I am very aware that OR-Tools' Python code are just wrappers around their C++ source code. I'm just getting an odd discrepancy between a model ...
• 140
106 views

### Rearrange 'x' piles of items into eight possible locations/bins based on item colour and length

I have an optimisation problem that I believe is a variant of the 'bin packing problem with precedence', but I'm unsure of if that is the correct paradigm to work with and I'm not having a huge amount ...
242 views

### TSP problem using Google's OR tools

This is the Travelling Salesperson Problem code from Google's OR tools. I used a simple instance that is defined in the data dictionary and has optimal value (sum of Euclidean distances) of 36.26 for ...
• 163
84 views

### how the number of employees affects the married employee scheduling problem

My scheduling problem has a specific pattern of 2 days of work followed by 2 days off. Additionally, there is a week off after every 4 weeks of work. The scheduling matrix (P) has five different ...
1 vote
140 views

### Routing problem - How can I make use of the Clarke and Wright algorithm for a CVRP, when using the ortools library?

TL;DR: How can I specify to ortools to use only the Clarke and Wright algorithm. Hello, I'm trying to solve a CVRP. When exploring the my options, I stumble by the ortools library, it gets the job ...
184 views

### how to count the number of values that are greater than zero in OR-Tools

I am using OR-Tools for an employees scheduling problem. I have a dictionary that is defined as an IntVar, where such dictionary contains the number of hours that will be assigned to each employee, ...
• 31
396 views

### Does OptaPlanner give equally good results when comparing with commercially available MIP solvers?

I want to solve a Mixed Integer problem with several constraints. Gurobi or Google OR tools solve such problems. Though I am not sure, I think they use an exact method such as branch and bound or ...
• 123
146 views

### Constraint programming problem with matrix of integers

I am trying to solve the following problem. Suppose $A$ is an $m \times n$ matrix of integers with entries in $\{1, \dots, k\}$. There are two kinds of constraints on the entries of this matrix: For ...
1k views

### What exactly does the AddHint() method in Google OR-Tools' CP-SAT solver do?

I have an optimization problem that I am solving with CP-SAT and I am using the Python interface. Moreover, I know a good feasible solution coming from a heuristic and I want the solver to start its ...
• 199
253 views

### [OR-Tools][CP-SAT] Implement an indicator function in a constraint

Good morning ! I would like to implement this constraint using CP-SAT (see image below). x_i,j is a boolean variable, a and b are given. The problem is that I don't know how to implement the ...
1 vote
579 views

### About circuit constraints in OR - tools

I am trying to implement a scheduling problem to solve with CP-SAT from OR-tools. There, in particular, for every machine I want to add a time transition constraint from every task that is performed ...
• 199
152 views

### CP-SAT's NumBooleans() parameter

The solver API for CP-SAT offers the attribute NumBooleans, which is documented as "Returns the number of boolean variables managed by the SAT solver". ...
• 181
1 vote
109 views

### Alternative Approaches to Assignment Problem

I have a real world use case where I aim to optimize the assignment of trucks to orders of different sizes over a time window by minimizing some cost function (e.g. total distance traveled). The below ...
• 13
149 views

### Reformulate this constraint optimization problem such that I do not have to divide 2 variables?

I have a constraint optimization problem as follows: I need to assign $m$ tasks to $n$ days, with $n \geq m$. Each day can host 0 to $m$ tasks. Each task either belongs to type $A$ or $B$. I want to ...
• 19
330 views

### Relevance of order of model construction in CP-SAT

Question 1: Is ortool's CP-SAT sensitive to the order in which a model is constructed? In other words, does it matter which variables and constraints come first? I am seeing a high performance ...
• 181
1 vote
83 views

### Multiplicity-Constraint in Constraint Programming Solvers

I need to solve a CSP with a constraint imposing upper bounds on the multiplicity of variables in a list. More precisely, I need a constraint of the form ...
• 113
1 vote
665 views

### OR-Tools: Nonlinear constraints?

I have inherited a reasonably simple ortools-based optimizer (Python) with linear relationships that I need to non-linear-ize, and I have no idea how to do that. The relevant part of my problem looks ...
272 views

### Adding linear penalties for multiple assignments

I have a multiple assignment problem, with an added cost for "repeat assignments". For example, consider the cost matrix: ...
• 153
1 vote
632 views

### TypeError: unsupported operand type(s) for *: 'IntVar' and 'float' in ortools [closed]

I am trying to implement a constraint as follows: ...
• 201
911 views

### Google-OR tools vs Pyomo and other commercial Solvers for solving a simple maximum flow problem

I have implemented a Pyomo model for solving maximum flow problem as a subroutine of an algorithm. However, the approach does not scale very well because Pyomo does not provide a very good way to re-...
• 392
142 views

### Control load per trip in multi trip VRP in ORTools

I have implemented multitrip VRP in ortools (To be specific, solved CVRPTW with virtual depots). Maximum number of trips per vehicle is limited to 2. I want to put a hard constraint that load carried ...
• 201
1 vote
206 views

### Applying weights to assignment problems for linear MIP solvers

In previous posts, A & B, I posed the Movie Theater Problem. In short, the movie theater problem encompasses assigning viewers to seats such that the distance between viewers is maximized, however,...
• 541
186 views

### Google OR Tools: Iterative Assignment Problem

This question is a Google OR-Tools specific implementation of recommendation from a previous question. In short, the movie theater problem encompasses assigning viewers to seats such that the distance ...
• 541
163 views

### Mixed Integer Programming: Iterative assignment problem

I have a real world problem, which is analogous to the below toy problem, which I call 'The Movie Theater Problem' (TMTP.) In TMTP, movie viewers are assigned seats which principally balances two ...
• 541
277 views

### Or-tools : CVRP multiple time window with multiple location

I am using or-tools to solve a CVRP with multiple time window, and multiple location. Meaning that a customer can move during the day. I can't achieve to add constraint like if i deliver the customer ...
• 31
398 views

### Simplex method for multiple objectives

I am a user of Google OR Tools, which can interface with many LP & MIP solvers, plus it's own SAT based constraint programming solver. My question, in the context of OR-Tools, is: how should I ...
• 541
1 vote
157 views

### Simple Constraint Programming Problem: docplex works but equivalent ortools model is infeasible

I have a simple constraint programming model which can be solved using the docplex library, however I am struggling to implement the same model using ...
• 145
I'm using the OR-Tools CP-SAT solver on a list of $n$ boolean variables $x_i$. I'm trying to maximize the minimal distance between two true variables in this list, as illustrated by the following ...