News for hackers. Stuff that matters.
Re:Constraint Programming (2020) by brutusborn on Sunday April 16, 2023 @09:34PM (#35595886)
What libraries / solvers did you find useful for scheduling?
Re:Constraint Programming (2020) by sriku on Sunday April 16, 2023 @09:47PM (#35595988)
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) by Guthur on Monday April 17, 2023 @12:37AM (#35596904)
I've used the CLPFD library, really quite cool. It fits very naturally into a prolog program.
Re:Constraint Programming (2020) by tannhaeuser on Monday April 17, 2023 @02:42AM (#35597471)
Yes, Constraint Logic Programming evolved from Prolog, as the name implies, and because Prolog's indeterminism and backtracking is as natural as it gets for this kind of problems. While the article mentions the foundational Jaffar et al paper, there have been numerous constraint solvers embedded into Prolog ever since, known by names such as CLP(x) where x is a parameter for the domain (reals or finite domains, or Booleans as in SAT solvers), though this nomenclature suggests portability and a common approach that isn't there. An introductory article for robotic planning and scheduling based purely on Prolog and hence not requiring a magic CLP solver library and at the same time beyond constraint solvers in its ability to generate load plans in container ship logistics with an unbounded number of steps is described on the Quantum Prolog site [1]. The demo works in the browser even.

[1]: https://quantumprolog.sgml.io/

Re:Constraint Programming (2020) by bobby__joe on Sunday April 16, 2023 @09:51PM (#35596004)
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) by gcanyon on Monday April 17, 2023 @02:29AM (#35597412)
I posted a programming puzzle years back, and someone named Hakan Kjellerstrand pointed out that the problem leant itself to constraint programming and posted a solution in Minizinc.

Here's the puzzle page: https://gcanyon.wordpress.com/2009/10/28/a-programming-puzzl...

And the solution in Minizinc: http://www.hakank.org/minizinc/einav_puzzle.mzn

And my solution in J: https://gcanyon.wordpress.com/2009/10/30/a-solution-to-einav...

Re:Constraint Programming (2020) by hakank on Monday April 17, 2023 @02:44PM (#35604788)
Here are some implementations in different constraint languages on this puzzle (which I call the "Einav puzzle"): http://www.hakank.org/common_cp_models/#einavpuzzle
Re:Constraint Programming (2020) by gcanyon on Monday April 17, 2023 @04:03PM (#35605831)
Hakan, good to see you! I love how we run into each other whenever constraint programming comes up on HN :-)
Re:Constraint Programming (2020) by nickpeterson on Sunday April 16, 2023 @10:18PM (#35596188)
You could also try Google OR tools, ‘OR’ means operations research.
Re:Constraint Programming (2020) by placebo on Sunday April 16, 2023 @11:19PM (#35596513)
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) by bendbro on Monday April 17, 2023 @12:23AM (#35596832)
I've used Google's ORTools and Microsoft Z3. If you need to input a lot of variables, I found Z3 to be better since it took SMTLIB formatted text as one big chunk- rather than numerous API calls which each suffer native binding overhead. Z3 can also iteratively solve, where you can append additional constraints and rerun the solver from its current position- I don't think ORTools had this feature.
Re:Constraint Programming (2020) by pjot on Monday April 17, 2023 @01:48AM (#35597218)
In grad school we used a language called GAMS to model and solve linear, MIP, and other types of constraint type problems. It was really powerful, but equally a pain to write.

Like others have already suggested, look into google’s ORtools library