Live data from Hacker News

Constraint Programming (2020)

mareknarozniak.com

1–10 of 29 posts

Re: Constraint Programming (2020)

#2
I took a similar approach with a somewhat complicated scheduling requirement across dates and times. I originally brute forced the problem, but the solution was a bit inelegant and not ideal. When I used constraint programming to solve the same problem, it took me a little longer to devise the solution, but the result was superior. Also, the constraint programming solution is a little more memory intensive, but a necessary proper solution.

Re: Constraint Programming (2020)

#3
post #2

I took a similar approach with a somewhat complicated scheduling requirement across dates and times. I originally brute forced the problem, but the solution was a bit inelegant and not ideal. When I used constraint programming to solve the same problem, it took me a little longer to devise the solution, but the result was superior. Also, the constraint programming solution is a little more memory intensive, but a nec…

What libraries / solvers did you find useful for scheduling?

Re: Constraint Programming (2020)

#4
post #2

I took a similar approach with a somewhat complicated scheduling requirement across dates and times. I originally brute forced the problem, but the solution was a bit inelegant and not ideal. When I used constraint programming to solve the same problem, it took me a little longer to devise the solution, but the result was superior. Also, the constraint programming solution is a little more memory intensive, but a nec…

What libraries / solvers did you find useful for scheduling?

Many constraint toolkits in other languages wrap around https://www.gecode.org/ . A rathe well established and performant library. I think the same folks behind Mozart/Oz are key behind this if I'm not mistaken.

For a free one, SWIProlog has a very usable and fairly performant constraint library too (CLPFD and CLPQ). It also has the more general "constraint handling rules" (CHR) as an embedded language. If you need to develop your own constraint search strategies, Mozart/Oz 's "space" concept is elegant.

Re: Constraint Programming (2020)

#5
post #2

I took a similar approach with a somewhat complicated scheduling requirement across dates and times. I originally brute forced the problem, but the solution was a bit inelegant and not ideal. When I used constraint programming to solve the same problem, it took me a little longer to devise the solution, but the result was superior. Also, the constraint programming solution is a little more memory intensive, but a nec…

What libraries / solvers did you find useful for scheduling?

I strongly recommend Minizinc. The coursera course related to it is also an excellent introduction to constraint programming: https://www.coursera.org/learn/basic-modeling

Re: Constraint Programming (2020)

#6
post #2

I took a similar approach with a somewhat complicated scheduling requirement across dates and times. I originally brute forced the problem, but the solution was a bit inelegant and not ideal. When I used constraint programming to solve the same problem, it took me a little longer to devise the solution, but the result was superior. Also, the constraint programming solution is a little more memory intensive, but a nec…

What libraries / solvers did you find useful for scheduling?

You could also try Google OR tools, ‘OR’ means operations research.

Re: Constraint Programming (2020)

#7
post #2

I took a similar approach with a somewhat complicated scheduling requirement across dates and times. I originally brute forced the problem, but the solution was a bit inelegant and not ideal. When I used constraint programming to solve the same problem, it took me a little longer to devise the solution, but the result was superior. Also, the constraint programming solution is a little more memory intensive, but a nec…

What libraries / solvers did you find useful for scheduling?

There are quite a few out there. I played with gecode as well as https://choco-solver.org/ which I found intuitive and fun to use.

Re: Constraint Programming (2020)

#8
I'm guessing the library python-constraint is basically just brute-forcing all possible combinations, at least when a regular python function is used as a constraint? Barring some crazy introspection, it would have to, right? And if I'm right, I don't understand why you would use a library rather than just loop over x, y, and z the old-fashioned way.

Re: Constraint Programming (2020)

#9
Constraint programming (and constraint propagation) is highly underrated.

For those not familiar with it yet, this is what's used under the hood by things like systemd: you give a bunch of constraints (ex: service A before service B, service B before service D but after service C, etc) and you get a solution (or none, but that's another story: when there are no solution, you can try to relax some constraints)

If you want to learn more, I suggest playing with Z3 from Microsoft Research: a nice tutorial is https://ericpony.github.io/z3py-tutorial/guide-examples.htm

Re: Constraint Programming (2020)

#10

I'm guessing the library python-constraint is basically just brute-forcing all possible combinations, at least when a regular python function is used as a constraint? Barring some crazy introspection, it would have to, right? And if I'm right, I don't understand why you would use a library rather than just loop over x, y, and z the old-fashioned way.

It’s bit smarter than that. There are a couple of tricks to make the search more informed. There are a couple introductory articles to CSP that are more in depth than TFA.
Post reply on HN