Questions tagged [or-tools]

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

Filter by
Sorted by
Tagged with
25 votes
3 answers
10k views

What is the purpose of libraries like Pyomo and Google OR tools?

I'm new to the OR world, and trying to learn the various tools available. I originally thought that Pyomo and Google OR tools were open source alternatives to commercial solvers like Gurobi or CPLEX. ...
Skander H.'s user avatar
  • 2,139
16 votes
1 answer
2k views

Warm start CPLEX using google or-tools

I have been trying to use the SetHint python API in google or-tools to warm start MIPs and solve it using CPLEX. It looks like my hints are accepted by the SetHint function but I am not sure whether ...
Palaniappan Chellappan's user avatar
15 votes
4 answers
1k views

Case Studies and Real Problems for Teaching Optimization and Modelling

It is that dreadful time of the year when I am prepping classes and over the last few terms I came to the realization that I need to significantly beef up the practice-oriented content of my lectures. ...
CMichael's user avatar
  • 1,333
11 votes
6 answers
2k views

How to read open-source code of a solver (Or-tools, OptaPlanner, Minotaur, etc.)?

I want to learn more about solvers by reading the code of some open-source projects such as MINOTAUR, Optaplanner and OR-Tools. However, I am struggling. I don't know where to start from there are a ...
Best_fit's user avatar
  • 567
11 votes
4 answers
2k views

Is there an open-source equivalent to LocalSolver?

I have a constraint programming problem that is easy to formulate and solve (with high solution quality) in LocalSolver. However, I would really prefer to use something open source for ...
Kathryn Twomey's user avatar
11 votes
1 answer
2k views

Incorrect solution for Vehicle Routing Problem in or-tools

I am trying to understand how the Vehicle Routing Problem is solved in OR-Tools. Using the example given here, I have tried to solve the following distance matrix with 9 separate vehicles: ...
Joba's user avatar
  • 211
11 votes
1 answer
735 views

How to solve the Cumulative Traveling Salesman Problem using or-tools in python?

The objective of the Cumulative Traveling Salesman Problem (CTSP) is to minimize the sum of arrival times at customers, instead of the total travelling time. This is different than minimizing the ...
Sebastián Quintero's user avatar
11 votes
1 answer
496 views

Modeling an assignment/scheduling problem to minimize total wait

I have an assignment type problem in which there is a set of students, $S$, and a set of training classes $T$. Each training has a fixed start and end day and can accommodate at most 1 student. In ...
Connor's user avatar
  • 111
10 votes
1 answer
2k views

Floating points in OR-Tools

I'm trying to solve an RCPSPDc model (maximizing the net present value instead of a makespan). The objective function is: $\sum\limits_{j \in \text{Tasks}} e^{-\theta\cdot s_{j}}\cdot p_{j}$, where $...
Diego R. Troncoso's user avatar
9 votes
3 answers
4k views

Google - OR tools for workforce scheduling problems

Has anyone used the google OR tools in python to solve the workforce scheduling problem. Can you please let me know Advantages and Disadvantages Any issues faced during usage and implementation
Lalitha Sundar Iyer S's user avatar
9 votes
3 answers
2k views

Open source MILP solver for quick “good enough” solution

I have a problem that I have already posted elsewhere in OR.stack, but the question is focused around a large binary MILP (about 1 million decision variables). Ultimately, I am more time constrained ...
S moran's user avatar
  • 325
9 votes
1 answer
604 views

TSP problem: traveller does not visit all nodes - Google OR-tools

Context: I am dealing with a kind of scheduling problem, in which I have a set of tasks and machines. All tasks must be assigned to machines (not necessary all of them). In addition to that, I must ...
campioni's user avatar
  • 1,133
9 votes
1 answer
287 views

How to tackle large nurse scheduling problem?

I have a nurse-scheduling type of problem with a time span of a year and many employees. Formulation My main variables are: \begin{align}x_{e,t} &= \begin{cases}1 \text{ if employee } e \text{ ...
Stradivari's user avatar
  • 1,414
8 votes
3 answers
1k views

Maximize assigned tasks to each worker

In a scheduling problem I want to assign the maximum number of tasks to one worker before assigning it to another. For example, if I have $10$ tasks and $2$ workers, the best assignment would be $(10, ...
Stradivari's user avatar
  • 1,414
8 votes
1 answer
756 views

Travelling salesman problem with given number of locations to visit

There's a great example here of how to find a solution to the travelling salesman problem: ...
ignoring_gravity's user avatar
8 votes
1 answer
463 views

Precedence Constraint in OR-Tools

I'm trying to write this constraint in C++ and add it to my model (addLessOrEqual): $$\text{start}_{i}+\text{duration}_{i}\le\text{start}_{j}$$ for an $(i,j)$ arc ...
Diego R. Troncoso's user avatar
8 votes
1 answer
203 views

Strategy for filling a table only slightly dependant on the number of columns

I'm using the OR-Tools CP-SAT solver to fill a table with integers, with various constraints, as illustrated by the x in the following figure. ...
Blackhole's user avatar
  • 235
8 votes
2 answers
1k views

OR-TOOLS : delivery node with multiple possible pickup nodes

I am using ortools to model a VRP with pickup and delivery constraints, where pickups can be done at different nodes. For example, if node A has a demand, it must be picked at node B or C. Here is how ...
Kuifje's user avatar
  • 13.2k
7 votes
2 answers
3k views

CP-SAT over CBC for MIP, is it worthwhile?

I am working in an integer optimization problem. All of the decision variables are binary, and the objective is to minimize some cost function. I currently am implementing CBC, but I have been reading ...
S moran's user avatar
  • 325
7 votes
2 answers
403 views

Why most of constraint solvers do not support optional intervals?

Optional interval is a great idea of optional interval/task that can be active or inactive based on boolean variable. I found it very useful in complex scheduling problems. It was introduced in IBM Cp ...
gregy4's user avatar
  • 189
7 votes
1 answer
3k views

CP-SAT ortools - Is there any complete list of possible/available StringParameters for the CpSolver?

I wonder if there is any list of string parameters documented. So far, I only know max_time_in_seconds and num_search_workers. ...
The Random Forum Guy's user avatar
7 votes
1 answer
1k views

Solution time out for VRPTW in or-tools

I am experimenting around with or-tools and somehow I can't get a solution for the VRPTW problem for any of the instances I have tested from Gehring & Homberger ...
k88's user avatar
  • 219
7 votes
2 answers
635 views

CP Framework/Solver for .Net Core

First I want to say that I'm very new to this field. As far as I understand it, there are two different ways to use a Constraint Programming (CP) Solver: Using the API from the Solver itself. For ...
Tobias M.'s user avatar
  • 343
7 votes
1 answer
405 views

Shipments consolidation - how to model mutually exclusive items with OR-Tools CP Solver in Python (multi-knapsack, updated)

I am implementing a solution for packages consolidation (basing on Nurse Problem solution) with OR-Tools CP Solver. There is a factory that manufactures some small Packages that need to be ...
Tomasz Kot's user avatar
6 votes
1 answer
381 views

How to Model Path Being Only Through Adjacent Cells

I am trying to develop a MILP for a path planning problem. I am operating on a grid of cells that represents a map. The arrangement of cells in the grid represents the placement of the cells in real ...
Raghav Thakar's user avatar
6 votes
1 answer
345 views

Interface for Cbc - COIN-OR

I would like to code some IP/MIP models in python and test them with an open-source solver. As of now, I only know the Cbc - COIN-OR open-source solver. I have already tried the or-tools interface, ...
Georgios's user avatar
  • 1,193
6 votes
1 answer
116 views

Help modeling grid placement problem

I'm trying to model a grid placement problem to exercise in OR. The problem is defined as: a grid of some dimension (let's say 500x500) N users that need connection. Every user has: a defined ...
rsella's user avatar
  • 169
6 votes
2 answers
663 views

Priority List Constraint

I used the Vehicle Routing Problem example that has the objective of minimizing total distance traveled for each vehicle. Suppose that each order to pick up for each vehicle at each node has a ...
Mario Huang's user avatar
6 votes
1 answer
1k views

Constraint Programming OR-Tools finding Matrix Combinations

As a similar post of mine Find all Combinations of a Matrix I am trying to find matrix combinations with entries $>0$ meaning for a matrix \begin{bmatrix} 0 & 1 & 3 \\ 5 & 2 & 1 \\ ...
Georgios's user avatar
  • 1,193
6 votes
1 answer
843 views

Python "Coffee Shop Scheduling Problem" - Scheduling Lunches/Breaks

I'm working on an employee scheduling program in python. Having never done this before, I've been researching different libraries that can be used to accomplish the task. Unfortunately, none of the ...
t25's user avatar
  • 63
6 votes
1 answer
814 views

OR-TOOLS : is it possible to partially fulfill a demand?

I am working on a vehicle routing problem with or-tools. Is it possible to partially fulfill a demand? I know it is possible to drop nodes with the disjunction constraints. But in this case, a node is ...
Kuifje's user avatar
  • 13.2k
6 votes
1 answer
2k views

assigning values to IntVar if and only if BoolVar, else zero [or-tools]

If I have an IntVar s[j] stored in a vector s, is it possible to iterate for (a period of ...
Diego R. Troncoso's user avatar
6 votes
0 answers
224 views

OptionalIntervalVar enforced but not working OR-TOOLS

I'm using OptionalIntervalVar and then maximizing the starts. The optimal solution is not affecting the other variables that creates the ...
Diego R. Troncoso's user avatar
6 votes
0 answers
161 views

Modelling issue with precedence constraint in OR-Tools

I'm trying to solve an RCPSPDc model It is infeasible, although Ilog Cplex solves it, so I think I have a modelling issue. I have more constraints but the precedence is the one that makes it ...
Diego R. Troncoso's user avatar
6 votes
0 answers
89 views

Data Formulation for Mixed-Integer-Programming Models

Until now, I have used the Gurobi, CPLEX and OR-Tools (GCO) interface to formulate mixed-integer-programming models. Recently, I have discovered MiniZinc and want to utilize it to formulate big ...
Georgios's user avatar
  • 1,193
5 votes
3 answers
473 views

Maximize the minimal distance between true variables in a list

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 ...
Blackhole's user avatar
  • 235
5 votes
2 answers
3k views

find suboptimal solution, if no optimal solution exists?

I am using or-tools linear solver. and my problem ends up having no optimal solution. how can I tell the solver to find a suboptimal solution?
Hisham Al Kayed's user avatar
5 votes
2 answers
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: ...
Him's user avatar
  • 153
5 votes
2 answers
624 views

How to measure model quality in OR-Tools?

After creating my model for a problem, what steps should I take to test if a change in the model is actually helpful or not? In Python, ...
Stradivari's user avatar
  • 1,414
5 votes
1 answer
3k views

Cumulative Constraint OR-Tools

I'm trying to solve an rcpsp model. I can't find documentation for the AddCumulative function of OR-Tools. How should this function be used? I want to write this ...
Diego R. Troncoso's user avatar
5 votes
1 answer
692 views

Can I print the linear programming sensitivity analysis report using google or-tools?

One can solve the linear programs using google or-tools with GLOP solver. I wonder if there is a way to print the sensitivity report (like shadow prices etc.).
Manu K. Gupta's user avatar
5 votes
1 answer
447 views

Best way to solve an allocation problem

I have the following problem: I have products with different attributes (price, weight, category) and I have a list of clients. Every client has an "affinity value" with every product, the ...
RenanSchwyz's user avatar
5 votes
1 answer
480 views

Is it possible to solve VRP using OR-Tools CpModel, instead of RoutingModel?

Is it possible to solve VRP using OR-Tools CpModel, instead of RoutingModel? I want to do synchronized VRP, which is combining vehicle routing and scheduling constraints
Rizky Luthfianto's user avatar
5 votes
1 answer
368 views

Precedence constraints using binary variables - DOCPLEX

I would like to establish a precedence constraint to ensure the precedence relation of tasks. I have a set of tasks available, but required tasks are not always the same. It means, the tasks executed ...
campioni's user avatar
  • 1,133
5 votes
1 answer
827 views

How does OR-Tools improve on an initial solution to CVRP?

I have an initial solution to a CVRP instance which I am setting as input to the solver. The solver as expected returns an improved solution. I have a few questions regarding the solver. How does the ...
Alphanerd's user avatar
5 votes
1 answer
121 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 ...
Max's user avatar
  • 534
4 votes
2 answers
548 views

OR-Tools: Partial Solution ignored due to "unknown rate is too large"

With SetHint() from the OR-tools linear solver I am trying to pass a feasible solution to my problem. But I receive the following warning: ...
Dav's user avatar
  • 93
4 votes
1 answer
327 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 ...
Hanno's user avatar
  • 181
4 votes
1 answer
497 views

Is Google's OR-tools for professional work? Specially VRP module [closed]

So I've been given at work a project which consist on finding optimal pathing for trucks in certain custom scenarios. When I discovered this tool I thought it worked wonders for what I understood the ...
Ismael Manzanares Carmona's user avatar
4 votes
1 answer
591 views

Adding a hard and soft upper bound constraint of number of locations to visit (VRP)

I went through the Vehicle Routing Problem example and was able to replicate it. On the example, there is a constraint added for vehicle maximum distance as shown below: ...
Mario Huang's user avatar