22 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 ...
Bethany Nicholson's user avatar
19 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 ...
Laurent Perron's 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.
Laurent Perron's user avatar
10 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. ...
Oguz Toragay's user avatar
  • 8,592
9 votes
Accepted

Maximize assigned tasks to each worker

Why quadratic? just use a larger (linear) weight for tasks assigned to worker 1.
Laurent Perron's 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 ...
JakobS's user avatar
  • 2,727
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 ...
prubin's user avatar
  • 37.5k
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: ...
ignoring_gravity's 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 $...
RobPratt's user avatar
  • 29.8k
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 ...
Stradivari's user avatar
  • 1,404
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 ...
Mehdi's user avatar
  • 683
8 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/...
Stradivari's user avatar
  • 1,404
8 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 ...
Laurent Perron's user avatar
8 votes
Accepted

Open source MILP solver for quick “good enough” solution

When I use CBC from time to time, it returns the best solution it has found even if it runs into the time limit. I guess, in your case, it has not even found a feasible solution. I call it this way: ...
T_O's user avatar
  • 186
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}$.
RobPratt's user avatar
  • 29.8k
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 ...
Laurent Perron's user avatar
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: ...
mrBen's user avatar
  • 521
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: ...
Stradivari's user avatar
  • 1,404
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.
Laurent Perron's 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 ...
Laurent Perron's user avatar
7 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 ...
prubin's user avatar
  • 37.5k
7 votes

Open source MILP solver for quick “good enough” solution

Interestingly enough, one of the best source-open (!= open source) solvers is often overlooked: SCIP (download here); there is a Python interface (PySCIPOpt), too. The parameter you need is ...
Marco Lübbecke's user avatar
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 ...
PSLP's user avatar
  • 2,401
7 votes

Travelling salesman problem variant without returning to the starting point

A TSP with a fixed starting point and no return to start, can be solved as an ordinary TSP with all the in-going arcs to the starting point having a cost of zero. That way the return to the starting ...
Sune's user avatar
  • 6,222
7 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 ...
Stradivari's user avatar
  • 1,404
7 votes
Accepted

Relevance of order of model construction in CP-SAT

This is a well know behavior of all MIP/CP solvers. Presolve and search are heavily heuristics based (to limit the complexity of the underlying algorithms), and thus are dependent on variables and ...
Laurent Perron's user avatar
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 ...
Stradivari's user avatar
  • 1,404
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 ...
Maarten's 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 ...
Laurent Perron's 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 ...
PSLP's user avatar
  • 2,401

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