19 votes

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

Pyomo is an algebraic modeling language and allows users to easily represent optimization problems at a high-level (by defining variables, constraints, objective, etc.). Pyomo then provides interfaces ...
user avatar
16 votes

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

OR-Tools is a set of solver: A very popular Routing Library built on top of a traditional constraint programming solver An award winning ...
user avatar
12 votes
Accepted

Warm start CPLEX using google or-tools

See answer on https://github.com/google/or-tools/issues/1444 This is not implemented. I welcome pull requests. You can have a look at the code in the Gurobi or Scip interface files.
user avatar
9 votes
Accepted

Maximize assigned tasks to each worker

Why quadratic? just use a larger (linear) weight for tasks assigned to worker 1.
user avatar
9 votes

Google - OR tools for workforce scheduling problems

In addition to the answer from @Mehdi... I've recently started to work with OR-tools and find it very nice for prototyping. The Python interface allowed me to produce a first version of my model ...
user avatar
  • 2,667
9 votes
Accepted

How to measure model quality in OR-Tools?

Time to solve (to proven optimality) is certainly a good choice. I don't know that I would be excited about number of conflicts. You could look at the ratio of objective value on that problem ...
user avatar
  • 29.7k
9 votes
Accepted

Travelling salesman problem with given number of locations to visit

Thanks to @Laurent Perron for their answer - I've tried modifying the code as follows, and it appears to work fine: ...
user avatar
9 votes
Accepted

How to Model Path Being Only Through Adjacent Cells

A standard approach for modeling a path from source $s$ to sink $t$ in a directed graph with node set $N$ and arc set $A$ is to let continuous variable $x_{ij} \ge 0$ represent the flow along the arc $...
user avatar
  • 22.2k
8 votes
Accepted

Precedence Constraint in OR-Tools

What you want is: AddLessOrEqual(LinearExpr(starts[j]).AddConstant(durations[j]), starts[succ[j][s]]) You might also want to take a look at the examples (ending ...
user avatar
  • 1,384
8 votes

Google - OR tools for workforce scheduling problems

I used OR-tools for TSP and VRP. These are my observations: 1- It provides a good quality solution in reasonable time. However, it is not the optimal solution and in some cases you can find much ...
user avatar
  • 603
8 votes

How to add logical OR constraint in OR-Tools?

Introduce a binary variable $x_{d,s}$ and change the right hand side to $1+2x_{d,s}$.
user avatar
  • 22.2k
7 votes

Google - OR tools for workforce scheduling problems

Workforce scheduling describes many different problems. The best technology for those is IMO CP-SAT (see the introduction, the reference manual in the CP-SAT sections and a set of recipes). A ...
user avatar
7 votes

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

Different solvers have their own interfaces (for example Cplex studio by IBM). You can use the specific syntax for those IDE or interfaces to input your model and then use the solver to solve it. ...
user avatar
  • 8,290
7 votes

Floating points in ORtools

In many of its solvers, OR-Tools only accept integers (see Laurent Perron's comment below). Something like that: ...
user avatar
  • 511
7 votes
Accepted

Constraint Programming OR-Tools finding Matrix Combinations

You get the same result $2^{\operatorname{len}(y)}$ times because $y_i$ is not constrained. You can see that by adding this to your callback: ...
user avatar
  • 1,384
7 votes

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

(already answered on S.O. ) You should have a look at Jobshop scheduling example with transitions In particular, it maintains a graph of direct successor between tasks on the same machine.
user avatar
7 votes
Accepted

Cumulative Constraint OR-Tools

If you look at OR-Tools: CumulativeConstraint, AddCumulative takes a variable as argument, so if it is constant, create a variable with a fixed domain. It returns ...
user avatar
7 votes
Accepted

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

As many things in Google, OR-Tools uses Protocol Buffers to serialize data. Here's a list of all .proto files in OR-Tools: https://github.com/google/or-tools/...
user avatar
  • 1,384
7 votes

find suboptimal solution, if no optimal solution exists?

If your linear program does not have an optimal solution one of three things might be the case: The solver didn't find the optimal solution, even though it exists. This might be due to runtime or ...
user avatar
  • 2,385
6 votes

How exactly does OptionalIntervalVar work in OR-Tools?

In the Python API there is a pretty good docstring of what an OptionalIntervalVar is: An optional interval variable is a constraint, that is itself used in other constraints like NoOverlap. This ...
user avatar
  • 1,384
6 votes

Incorrect solution for Vehicle Routing Problem in or-tools

I notice you are using FirstSolutionStrategy.Value.PATH_CHEAPEST_ARC. If this name does what it suggests, then it's probably a greedy strategy that chooses between ...
user avatar
  • 295
6 votes

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

Crossposted from: Stack Overflow The idea is to create another dimension ('visit') that is incremented by 1 on each visit. Then use SetCumulVarSoftUpperBound on ...
user avatar
6 votes

Priority List Constraint

If I understand your problem correctly, you have a standard CVRP and a second (soft) objective. You are therefore in the wonderful world of multi-objective optimization. Typically what you do is ...
user avatar
  • 2,385
6 votes

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

min, max, functions do not work in OR-Tools, you should use AddMinEquality instead: ...
user avatar
  • 1,384
6 votes
Accepted

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

Try: SetSolverSpecificParametersAsString("heuristics/completesol/maxunknownrate = 0.9") References: SCIP params SetSolverSpecificParametersAsString ...
user avatar
  • 1,384
6 votes
Accepted

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

Vehicle routing problems in the real world often require custom scenarios, and no VRP solver does everything, so this is a good question. The VRP solver in OR-Tools is open source (you could fork it ...
user avatar
5 votes

Maximize assigned tasks to each worker

There are some linear possibilities, depending on exactly what your goal is. They all require adding some binary variables to what is already a discrete optimization problem. One is to maximize the ...
user avatar
  • 29.7k
5 votes
Accepted

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

To create an intermediate boolean that is true iff s[j] == t you just have to create 2 constraints: ...
user avatar
  • 1,384
5 votes

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

CP solvers can find optimal solutions (given enough time and memory). Essentially, like the "bound" part of branch-and-bound, each time you find a feasible solution you redefine feasibility to include ...
user avatar
  • 29.7k
5 votes
Accepted

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

CP-SAT is a full fledged (non-mixed) integer programming solver (linear relaxation, presolve, cuts, branching heuristics). It is geared towards optimization, and is actually not very good at ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible