As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [or-tools]

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

Filter by
Sorted by
Tagged with
2 votes
1 answer
524 views

Using OR-Tools with .NET and GUROBI

We want to model our MILP problem with Google OR-Tools in .NET, and solve it using GUROBI (solver may change in the next 1-2 years). However, we couldn't find the correct syntax to call GUROBI. https:/...
alamaranka's user avatar
2 votes
1 answer
197 views

Scheduling when task duration longer than working interval

I'm trying to modify the job shop example for CP-SAT solver. (https://developers.google.com/optimization/scheduling/job_shop) I'm limited to 8 hours working day, So I defined a list of NewIntervalVar()...
Shkvarka's user avatar
2 votes
1 answer
524 views

Set value based on if other variable is in specific range

I have the following problem. number_of_machines is controlled by other constraints. I need to set line variable to specific value based on "range" ...
Shkvarka's user avatar
1 vote
0 answers
264 views

Set Covering and Column Generation

I need some set covering and column generation examples in OR-Tools python. If anyone can provide or direct me to some resources that would be great..!
user3237357's user avatar
2 votes
1 answer
195 views

A specific case of a resource constrained project scheduling problem with partially renewable resources (RCPSP/$\pi$) - OR-Tools

I've been trying solve a specific case of the resource constrained project scheduling problem with partially renewable resources (RCPSP/$\pi$ in the literature e.g. this paper). These resources are ...
David Torres's user avatar
1 vote
1 answer
73 views

Print Intermediate Solutions of Scheduling Problem and tackling FLAGS in jupyter notebook

I tried this code and it goes on and I'm clueless when it'll end so I manually interrupt it. Is there any way we can see intermediate solutions that are feasible solutions and can we limit time or ...
user3237357's user avatar
2 votes
0 answers
128 views

Multiple Depot/Crew Office Bus Driver Scheduling Modelling

I'm working on Bus Driver Schedule with multiple add-on constraints that are complex and hence trying to figure out how this can be achieved. Reference of Bus Driver Scheduling using OR-Tools:- https:/...
Brainiac's user avatar
3 votes
2 answers
231 views

Extracting CNF representation of my problem from SAT solver

As I know, any SAT solver such as or-tools or cplex cp optimizer converts a given problem to CNF form in the first place. Is it possible to extract the resulting CNF representation from or-tools or ...
user856754's user avatar
2 votes
1 answer
201 views

OR-Tools, How to avoid dividing by zero

Problem: There is an order to fabricate some products of total number, let's say 200 (all products are the same). We have some number of factories, let's say 5. Every factory has different number of ...
Shkvarka's user avatar
4 votes
1 answer
741 views

Using VRPy and OR-tools in Python to solve the DCVRP

This question is a follow-up to this one. Since I understand the complexity of the problem I have been underestimating, I turned my attention to off-the-shelf solvers, like VRPy and OR-tools. I would ...
tcokyasar's user avatar
  • 1,239
4 votes
2 answers
359 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
3 votes
2 answers
2k views

Travelling salesman problem variant without returning to the starting point

I tried the code provided on the link : https://developers.google.com/optimization/routing/tsp The actual requirement is to traverse all paths without returning to the start point with minimum ...
dev21's user avatar
  • 131
5 votes
2 answers
2k 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
1 vote
0 answers
168 views

Modified bus scheduling problem question in ortools

Has been crossposted in stackoverflow. I want to solve the bus scheduling problem using ortools with some minor modifications. In my case, the max number of drivers is known. The modifications I would ...
azal's user avatar
  • 153
0 votes
0 answers
126 views

Mixed Integer Programming - Model Formulation for A Resource Allocation Problem

There are a number of orders, which needs to be shipped. For each order, there may be 1 to 3 route options. The problem here is to find out the best allocation (combination) of orders among these ...
Jack's user avatar
  • 137
3 votes
0 answers
227 views

Add Variables in Bulk for ortools

I am using the Python ortools to solve large LPs where the number of variables and constraints are in the hundred thousands ($10^5$). Surprisingly, it takes longer ...
Zachzhao's user avatar
  • 131
3 votes
1 answer
753 views

CP-SAT _ Summing variables under conditions

I have been working lately on scheduling optimization using CP-SAT in OR-TOOLS and now I'm at the point where I need to start considering due dates in my model. I didn't want to put them as ...
ooo's user avatar
  • 119
1 vote
1 answer
582 views

Problem with setting up gurobi with OR-tools

I am trying to setup Gurobi with Google OR-Tools with the function pywraplp.Solver.CreateSolver("GUROBI"). The function returns None, which could occur if ...
Zach Zhao's user avatar
2 votes
0 answers
408 views

modify pickup and delivery problem to only delivery scenario in google OR-tools

I am using Google OR Tools for solving the capacitated vehicle routing problem.I want to implement optimization solution for delivery problem.For example there is one storage location which load all ...
Rajith Thennakoon's user avatar
2 votes
2 answers
900 views

Cutting Stock Problem : Mixed Integer Programming

I am asked to solve the following problem: The problem: You were asked to repair a farm house with sheets of plywood. You were given thirty sheets of plywood. (each size = 10ft x 10ft) The house ...
AsM's user avatar
  • 29
3 votes
2 answers
170 views

Google OR returning different values depending on language

Lately, I have been working on a CP-SAT model for solving multi-resource flexible job shop problems. I used the code (1) as an inspiration for building code (2) in Python which works well. Then I had ...
ooo's user avatar
  • 119
2 votes
2 answers
127 views

Parallel scheduling with precedence constraints and variable job length

I have $N$ jobs and $M$ machines and want to minimize the makespan, i.e. the total time to finish all jobs. Some jobs have precedence constraints and can only be started once other jobs are finished. ...
tphillips's user avatar
  • 145
3 votes
1 answer
1k views

Python, Google OR-Tools, OnlyEnforceIf() method

I am trying to solve a basic puzzle by using Google OR-Tools, this is my first try with OR-Tools and I am trying to learn. I completed almost everything and was ready to conclude the program until I ...
Yiğit Çatak's user avatar
8 votes
2 answers
909 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
  • 12.3k
3 votes
0 answers
110 views

Production planning for a video game economy

I'm a software developer who likes to play a video game that has a complex economy. I realized that the type of problem I'm trying to solve mimics real life operations research problems, and I am ...
0x1F602's user avatar
  • 139
6 votes
1 answer
537 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
  • 12.3k
2 votes
1 answer
1k views

How to know which constraint in CP-SAT did not meet the feasibility gap

Is there any systematic way to retrieve some information on the constraint that caused infeasibility in Or.Tools CP-SAT? ...
Mahmoud's user avatar
  • 117
2 votes
1 answer
109 views

How to model a set of integer variables getting assigned different values than another set of integer variables

Assume we have variables $x_1, x_2, x_3, x_4$ that each can belong to $\{1,2,...,10\}$. How can we model a constraint that variables $x_1, x_2$ get assigned different values than $x_3, x_4$? Because ...
Mahmoud's user avatar
  • 117
2 votes
3 answers
505 views

How to model two variables to NOT to belong to the same set partition using Constraint Programming

Assume we have two variables $x,y \in S$ where $S=\{1,2, \dots, 1000\}$. Also, we are given a partition of set $S$ as: $S_1 = \{1,2, \dots, 249\}$ $,S_2 = \{250, \dots, 499\}$ $,S_3 = \{500, \dots, ...
Mahmoud's user avatar
  • 117
3 votes
0 answers
140 views

Best known results on the flexible jobshop benchmarks

Is there a website that compiles the best known results on the flexible jobshop problem ? I know there was a blog post/article by Quintiq, a (deleted) blog post on CP Optimizer, some more recent ...
Laurent Perron's user avatar
1 vote
1 answer
426 views

Flexible Job Shop Problem with several resources per alternative - Ortools

It has been quite a journey for me to go from 0 to understanding the job shop (js) and the flexible job shop (fjs) examples given by Google's ORTOOLS team. Now the time has come for me to start ...
Otmane ZIZI's user avatar
3 votes
0 answers
49 views

High-mix manufacturing capacity

I'm not an expert in OR but I would like to determine what is the maximum manufacturing capacity of a plant (or how much a plant can produce of mix products). Each person in the plant has a known set ...
Otmane Zizi's user avatar
4 votes
1 answer
402 views

maximum number of BoolVar 's before or-tools is no longer feasible to use

The standard nurse scheduling problem which is used as an example for OR-Tools (see for example https://developers.google.com/optimization/scheduling/employee_scheduling) attempts to assign boolean ...
David Ash's user avatar
5 votes
1 answer
374 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
3 votes
1 answer
539 views

How to balance the workload of teachers in OR-Tools (maximization of the minimum)

I am very new to optimization and OR-Tools. I am trying to solve a very simple question. Let's assume that we have $n$ students. Each student needs to be assigned to only one teacher as a supervisor. ...
neverletgo's user avatar
5 votes
1 answer
372 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
6 votes
2 answers
554 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
3 votes
2 answers
2k views

How to add logical OR constraint in OR-Tools?

Let's say nurses normally do 1 shift for d in all_days: for s in all_shifts: model.Add(sum(shifts[(n, d, s)] for n in all_nurses) == 1) But I want to ...
Rizky Luthfianto's user avatar
1 vote
0 answers
185 views

Fixed cost associated to SlackVar(waiting time cost) [CVRPTW]

I'm modeling a CVRPTW with some features: Each type of vehicle has a cost per km and a fixed cost per trip. To calculate these costs, I am using these methods for this: ...
Luiz Picanço's user avatar
4 votes
1 answer
466 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
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
7 votes
2 answers
2k 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
4 votes
1 answer
748 views

Solving vehicle routing problem in java

I am trying to solve vehicle routing problem in java and I am looking for libraries for the same. I did a POC using google or-tools and it seems to be solving all my use cases. I would like to know if ...
Tejaswini Katreddy's user avatar
7 votes
1 answer
2k 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
3 votes
1 answer
477 views

Optimal way to ensure optional intervals are consecutive in OR-Tools

I am trying to solve a scheduling problem in OR-Tools. There are lots of "events" that need to be scheduled to "blocks" (essentially half-days). I am naturally using optional intervals for the events. ...
crypto_rsa's user avatar
7 votes
1 answer
985 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
5 votes
2 answers
542 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,384
4 votes
1 answer
879 views

How exactly does OptionalIntervalVar work in OR-Tools?

I created OptionalIntervals for a number of tasks: ...
Diego R. Troncoso's user avatar
4 votes
1 answer
660 views

TSP with constraints in OR Tools

I am completely new to OR Tools, but what I have tried so far seems very powerful. I have, however, run into a problem that I cannot seem to figure out how to solve. I am trying to model a TSP ...
Simon Roed's user avatar
5 votes
1 answer
1k 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