Quantcast
Channel: User Laurent Perron - Stack Overflow
Browsing latest articles
Browse All 81 View Live

Answer by Laurent Perron for In a model Or-tools, how to return the value...

you can use a min_equality constraint with some clever offset to compute the first position that is true. It will set the target to len(bool_vars) if none is true.bool_vars = [...]num_bool_vars =...

View Article



Answer by Laurent Perron for How to track the value of target function during...

Looks like a scip question and not an OR-Tools one.There are no mechanism in OR-Tools linear solver wrappers to support that.If there is a parameter to display this, you can set it directly through the...

View Article

Answer by Laurent Perron for Bin packing in OR-Tools with only one bin

use FixedSizeIntervalVar.you know all objects packed, the total area is fixed. You just need to minimize the max end coordinate.for inspiration, you can have a look at

View Article

Answer by Laurent Perron for How do I add a conditional constraint to GLOP...

so many wrong things.you cannot create conditional with a LP solver. You need a mip solver for that.> is not defined on variables of a MIP problem because it is ill defined (all solvers work with a...

View Article

Comment by Laurent Perron on How to change penalized cover constraint from...

random constant. Please try to find a better value. I guess 7 = 7 days a week. But it should not be in the code.

View Article


Answer by Laurent Perron for How to get the actual indexes (From my distance...

How did you build the distance matrix ?I do not think that reversing the distance matrix to get coordinates is possible or well defined.If you look at the code samples, they use IndexToNode and other...

View Article

Answer by Laurent Perron for How can I assess the constraint count of a...

IMO, the number of constraint is a poor proxy of the complexity of the model.I would rather look at number of visits, average distances, tightness of time windows...

View Article

Answer by Laurent Perron for Same cp model, nothing changed, but sometimes...

This is an old version.We have fixed many bugs since then. Please update to 9.8 and 9.9 when released this week.

View Article


Comment by Laurent Perron on ortools SCIP stuck in presolve

can you send me the mps file ?

View Article


Answer by Laurent Perron for Confusion about Google OR-Tools' CVRP solver

the main cost is defined by the SetArcCostEvaluatorOfAllVehicles() call.So in your case, it means minimizing the total distance travelled.It indicates that the depot is located at the node with index 0...

View Article

Comment by Laurent Perron on ORTOOLS CP SAT - XOR and AND combined

Done. Thanks for flagging that.

View Article

Answer by Laurent Perron for AttributeError: type object...

When switching to pybind11 from swig, we had to introduce class enums knapsack_solver.SolverType.KNAPSACK_DYNAMIC_PROGRAMMING_SOLVERsee...

View Article

Comment by Laurent Perron on Differences between Excel Solver & OR Tools...

All LP solvers have an internal precision, usually between 1e-4 and 1e-6. This is below that.

View Article


Comment by Laurent Perron on Differences between Excel Solver & OR Tools...

There are different floating point modes (fast, precise, strict). I believe all solvers use the intermediate mode (precise). This mode does not guarantee that the result of floating point operations...

View Article

Answer by Laurent Perron for Unable to build OR-Tools with XPRESS enabled in...

As answered before on the mailing list, in OR-Tools version 9.9, XPressMP is precompiled.Like with Gurobi, it will try to sideload the shared library. You do not need to recompile the library.

View Article


Answer by Laurent Perron for CpModel BoolVar not evaluating as a boolean

Please post a complete minimal reproducible example.And be aware that a boolvar does not have a value per se. You cannot use it an if, a comparison, a python test.Doing so will create a CP-SAT...

View Article

Comment by Laurent Perron on Geo spatial constraints in OR-Tools CP-SAT

Please ask a precise question. What do you expect geographically? Are you trying to solve a tsp?

View Article


Answer by Laurent Perron for Self referencing constraints

The element constraint takes a variable for its index, not an arbitrary expression.

View Article

Comment by Laurent Perron on Google or-tools soft constraint issue

you need to show some code and give some details. What solvers? Provide a prototype code with just a comment in place of the missing constraint.

View Article

Comment by Laurent Perron on ortools solvers GLOP, PDLP instantly writes that...

What does the log says ?

View Article

Answer by Laurent Perron for OR Tools Job Shop Scheduling for multiple...

You need to take into account the literals of the optional intervals.For this, you need 4 things:arc i+1 -> j+1 is selected implies that both interval_i and interval_j are selectedarc i + 1 -> i...

View Article


Answer by Laurent Perron for OR Tools problem with...

The error is in the upper bound of the rank variable.changing it to: l_rank = model.NewIntVar(-1, 100, 'rank'+ alt_suffix)gives an optimal solution:3Horizon = 1360Solution 0, time = 0.052364 s,...

View Article


Answer by Laurent Perron for Add node precedence

why don't you merge the two nodes ?Treat the pair as one. Distance to the merged node is distance to 3. Distance from the merged node is distance from 7.Then you add a min to the slack var of the...

View Article

Answer by Laurent Perron for OR Tools cp model performance for flexible job...

Sequence dependent setup times (flexible) jobshops are very hard problems.Do not expect any proof of optimality for even medium size problems (100 tasks).The most impactful thing you can do with CP-SAT...

View Article

Answer by Laurent Perron for No overlapping Scheduling using CP-SAT in Ortools

You need 1 overlap per resource (teacher, room, group of students).Then you collect all intervals for each resource, and you add all intervals to the same resource/no_overlap.See how this is done in...

View Article


Comment by Laurent Perron on Constraints Satisfaction Problem using CP-Sat in...

Does this answer your question? No overlapping Scheduling using CP-SAT in Ortools

View Article

Comment by Laurent Perron on 'TypeError: Unrecognized linear expression'...

Definitely, this will cause the error.

View Article

Answer by Laurent Perron for 'TypeError: Unrecognized linear expression'...

I have improved the error reporting.It will now print:Floating point constants are not supported in constraints: -3.0

View Article

Comment by Laurent Perron on OR-TOOLS Job Shop Scheduling - splitting longer...

The idea of the approach is that tasks will continue during breaks. The durations are extended and the starts are restricted so the tasks must start during a shift.

View Article



Answer by Laurent Perron for Setting values for IntVar for CP-SAT solver from...

I am not sure this is a good business rule,anyway int_vars = [...] bool_vars = [] for v in int_vars: is_less_than_400 = model.new_bool_var('') model.add(v <= 400).only_enforce_if(is_less_than_400)...

View Article

Answer by Laurent Perron for OR-Tools CP SAT conditional constraint

model.add_at_most_one(x)This is the only working case if I am not mistaken.Now, the medium answer for one of the constraint: model.add(sum(x[:m] == 0).only_enforce_if(x[m])and finally the general one...

View Article

Comment by Laurent Perron on Implement a sumprod of pairs of newintvar and...

Yes. If you use add_multiplication_equality, it will be rewritten to use the 2 enforced linear equations anyway.

View Article

Comment by Laurent Perron on OR-Tools library, CP-SAT Solver. With a large...

if you use 8x the number of cores, the best cores are 8x slower.

View Article


Comment by Laurent Perron on Setting different values with a gap for intvars...

I gave you the solution.

View Article

Answer by Laurent Perron for How do I use Glop (Google linear optimization...

I was never approached by matlab to integrate GLOP as a supported solver.So I believe this is not possible.I would be happy to be proven wrong.

View Article

Answer by Laurent Perron for Why is CP-SAT Slower? Comparing Performance of...

This was asked before.The short answer, we do not care about nqueens. It does not reflect any useful problem.It does not test the ability of the solver to find hard solutions, or to prove optimality....

View Article

Browsing latest articles
Browse All 81 View Live




Latest Images