Skip to main content

Questions tagged [or-tools]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
29 views

Convert sequence to succession matrix with CP-SAT

Say I have a sequence [3,1,0,2], where each element is a decision variable, i.e. I decide upon an optimal sequence of numbers. Is there an appropriate way to convert this sequence to a 2D succession ...
QuestioningPanda's user avatar
3 votes
2 answers
817 views

How to avoid similar solutions?

I have a problem like this $x_1 +x_2 +x_3 =10$ let's assume $0 \leq x_i \leq 10$ It is obvious that this problem has more than one solution For example : Solution 1 : $x_1 =0 , x_2= 1 , x_3 =9$ ...
Optimization team's user avatar
2 votes
1 answer
80 views

Cumulative constraint with a window

I have a decision variable R, indexed by n over N, where R[n] is equal to some integer value. I want a constraint that, for a specific window size, e.g. 5, gives a maximum to the summed values inside ...
QuestioningPanda's user avatar
2 votes
1 answer
117 views

Optimizing a Route Selection Problem with Multiple Constraints and Objectives

I'm developing a solution to optimize a vehicle routing problem where each stop has an associated score (priority), specific geo coordinates, and a required stop duration. The goal is to maximize the ...
Rastislav's user avatar
  • 131
2 votes
1 answer
97 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 ...
frellwan's user avatar
1 vote
1 answer
92 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 ...
QuestioningPanda's user avatar
2 votes
1 answer
224 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 ...
Riezz's user avatar
  • 41
1 vote
0 answers
84 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 ...
Jigeli's user avatar
  • 11
2 votes
1 answer
113 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}$ ...
nalzok's user avatar
  • 123
1 vote
1 answer
86 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 ...
mufassir's user avatar
  • 211
0 votes
1 answer
118 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 ...
Ying's user avatar
  • 105
1 vote
2 answers
163 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 ...
Ralph Asher's user avatar
0 votes
1 answer
233 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 ...
Ying's user avatar
  • 105
0 votes
1 answer
274 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"); ...
Ying's user avatar
  • 105
1 vote
4 answers
564 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 ...
James Kolpack's user avatar
3 votes
2 answers
368 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: ...
Issouf's user avatar
  • 65
1 vote
0 answers
98 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 ...
Ying's user avatar
  • 105
1 vote
1 answer
161 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 ...
Ying's user avatar
  • 105
1 vote
2 answers
70 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 ...
Nara's user avatar
  • 11
1 vote
1 answer
157 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 ...
E. Fischer's user avatar
1 vote
1 answer
104 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 ...
Mark's user avatar
  • 111
0 votes
2 answers
91 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 ...
Riezz's user avatar
  • 41
0 votes
1 answer
166 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 ...
Penghui Guo's user avatar
5 votes
1 answer
159 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
  • 544
3 votes
0 answers
44 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 ...
orman's user avatar
  • 33
0 votes
1 answer
122 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 ...
orman's user avatar
  • 33
1 vote
1 answer
248 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 ...
gjgutier545's user avatar
2 votes
1 answer
112 views

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

I have an optimization 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 ...
Jon Knott's user avatar
0 votes
2 answers
351 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 ...
Andrew's user avatar
  • 163
0 votes
1 answer
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 ...
abdula smith's user avatar
1 vote
1 answer
176 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 ...
user.mokho's user avatar
3 votes
2 answers
249 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, ...
luca_dix's user avatar
2 votes
2 answers
515 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 ...
LSG's user avatar
  • 123
3 votes
3 answers
150 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 ...
TheProofIsTrivium's user avatar
2 votes
1 answer
2k 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 ...
John D's user avatar
  • 199
-1 votes
1 answer
296 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 ...
Arthursbr's user avatar
1 vote
1 answer
773 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 ...
John D's user avatar
  • 199
3 votes
1 answer
160 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". ...
Hanno's user avatar
  • 181
1 vote
2 answers
111 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 ...
Jordan C's user avatar
-1 votes
2 answers
153 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 ...
Waldo's user avatar
  • 19
4 votes
1 answer
385 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
1 vote
1 answer
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 ...
guigux's user avatar
  • 113
1 vote
1 answer
797 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 ...
Matthias Urlichs's user avatar
5 votes
2 answers
277 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
1 vote
1 answer
678 views

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

I am trying to implement a constraint as follows: ...
mufassir's user avatar
  • 211
4 votes
0 answers
1k 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-...
Pia MiA's user avatar
  • 390
2 votes
1 answer
205 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 ...
mufassir's user avatar
  • 211
1 vote
1 answer
219 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,...
jbuddy_13's user avatar
  • 551
2 votes
1 answer
210 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 ...
jbuddy_13's user avatar
  • 551
2 votes
2 answers
178 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 ...
jbuddy_13's user avatar
  • 551