Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Bookmarks inbookmarks:mine
inbookmarks:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results found
Search options user 991
4
votes
min, max, functions do not work in OR-Tools, you should use AddMinEquality instead: ... workload = [] for j in range(num_of_teacher): tmp = model.NewIntVar(0, num_of_students, "") model.Add(tm …
answered Jul 23 '20 by Stradivari
8
votes
3answers
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, …
asked Sep 23 '19 by Stradivari
8
votes
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 with _sat.cc) to be more familiar wi …
answered Jan 20 '20 by Stradivari
5
votes
Haven't used python-mip but to create multi-index variables I usually do: x = { (e, s, a): model.add_var( name="x({},{},{})".format(e, s, a), var_type=INTEGER, ub=employee …
answered Feb 11 '20 by Stradivari
12
votes
I don't know much about Python-mip but looking at the code, maximize expects a LinExpr, so I tried: model.objective = maximize(1*x) which gives the expected output. Edit: I also opened a PR to all …
answered Feb 17 '20 by Stradivari
5
votes
To create an intermediate boolean that is true iff s[j] == t you just have to create 2 constraints: cp_model.AddEquality(s[j], t).OnlyEnforceIf(b); cp_model.AddNotEqual(s[j], t).OnlyEnforceIf(Not(b)) …
answered Jan 31 '20 by Stradivari
5
votes
Python is a "slow" programming language because it is interpreted (at least CPython is), so in OR-Tools, for example, that impacts the model building speed if the model is big enough or your logic inv …
answered Feb 7 '20 by Stradivari
5
votes
You are just importing the pyomo.environ module while the tutorials probably use the from syntax. These variables are inside pyomo.environ so you have 3 alternatives: Import them explicitly from pyom …
answered Jan 29 '21 by Stradivari
4
votes
CpModelProto is a protobuf representation of your model in ortools. You create it by using the CpModelBuilder class (your cp_model), and calling its Build() method, the SolveCpModel function that you …
answered Jan 23 '20 by Stradivari
3
votes
You can also do: model.AddLinearExpressionInDomain(sum(variables), cp_model.Domain.FromValues([1, 3])) Or even: for d in all_days: for s in all_shifts: b = model.NewBoolVar("") …
answered Jun 8 '20 by Stradivari
4
votes
Not yet, see https://github.com/google/or-tools/issues/973 For debugging I would recommend you to divide your constraints into groups so you can activate/deactivate some of them to pin down the infeas …
answered Oct 18 '20 by Stradivari
7
votes
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/search?l=Protocol+Buffer The parameters …
answered Mar 17 '20 by Stradivari
7
votes
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: print("y:", [self.Value(y) for y in self._y.values()]) …
answered Dec 3 '19 by Stradivari
2
votes
Using intermediate booleans and AddLinearExpressionInDomain you get: from ortools.sat.python import cp_model model = cp_model.CpModel() solver = cp_model.CpSolver() x = model.NewIntVar(1, 1000, "x") …
answered Oct 11 '20 by Stradivari
5
votes
2answers
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, print(solver.ResponseStats()) returns: CpSolverResponse: statu …
asked Feb 21 '20 by Stradivari

15 30 50 per page