Live data from Hacker News

A practical introduction to constraint programming using CP-SAT and Python

pganalyze.com

1–10 of 41 posts

Re: A practical introduction to constraint programming using CP-SAT and Python

#2
I used a lot of solvers in the early 2000s in my Operations Research master after my econometrics study. While now working on software (web) that uses python I’m thrilled to see these deep dives on this subject!

I love the subject and reading this brought back a lot of memories. Also the realization that translating constraints to a model (variables, structure etc) is 90% of the work and the most difficult part.

Re: A practical introduction to constraint programming using CP-SAT and Python

#3

I used a lot of solvers in the early 2000s in my Operations Research master after my econometrics study. While now working on software (web) that uses python I’m thrilled to see these deep dives on this subject! I love the subject and reading this brought back a lot of memories. Also the realization that translating constraints to a model (variables, structure etc) is 90% of the work and the most difficult part.

>the realization that translating constraints to a model (variables, structure etc) is 90% of the work and the most difficult part.

LLMs can help a lot there. I've been wanting to write an LLM => Constraint model adapter that does it for you. It's such low hanging fruit, I wonder if anyone else would benefit from it though.

Re: A practical introduction to constraint programming using CP-SAT and Python

#5

I used a lot of solvers in the early 2000s in my Operations Research master after my econometrics study. While now working on software (web) that uses python I’m thrilled to see these deep dives on this subject! I love the subject and reading this brought back a lot of memories. Also the realization that translating constraints to a model (variables, structure etc) is 90% of the work and the most difficult part.

>the realization that translating constraints to a model (variables, structure etc) is 90% of the work and the most difficult part. LLMs can help a lot there. I've been wanting to write an LLM => Constraint model adapter that does it for you. It's such low hanging fruit, I wonder if anyone else would benefit from it though.

I think that I would. Using natural language to describe the problem and constraints would be much better than figuring out mid project that the variable structure I've chosen does not allow to express a particular constraint. Defining the right structure is just Art at this point.

Re: A practical introduction to constraint programming using CP-SAT and Python

#7

How does this compare with mixed integer programming? For problems in physics

A whole bunch of problems can be set up either way. MILP always has an objective, and the constraints are always linear combinations of the decisions. Gurobi is so incredibly fast that it might be worth contorting your problem into a MILP just so you can get solutions at all.

Re: A practical introduction to constraint programming using CP-SAT and Python

#8

I used a lot of solvers in the early 2000s in my Operations Research master after my econometrics study. While now working on software (web) that uses python I’m thrilled to see these deep dives on this subject! I love the subject and reading this brought back a lot of memories. Also the realization that translating constraints to a model (variables, structure etc) is 90% of the work and the most difficult part.

>the realization that translating constraints to a model (variables, structure etc) is 90% of the work and the most difficult part. LLMs can help a lot there. I've been wanting to write an LLM => Constraint model adapter that does it for you. It's such low hanging fruit, I wonder if anyone else would benefit from it though.

They're already very good at it—I myself have been using OR-Tools's CP-SAT solver for a large bin packing problem at work (via https://github.com/ankane/or-tools-ruby) & Chat-GPT was a big help working out the details of some of the constraints and objectives.

Re: A practical introduction to constraint programming using CP-SAT and Python

#9
I have used constraint solvers in the past, and they are truly magical in what they can do. The problem is that there are not many available resources for the novice. Most of the material you can find is how to solve sudoku (the hello world of the space) or highly technical primary research literate meant exclusively for domain experts. Which is a shame, because I think huge swaths of problems could be solved by these tools if they were more accessible. “Accessible” still meaning it requires a programmer, because shaping a problem into the constraints DSL is not going to be in the wheelhouse of most.

Re: A practical introduction to constraint programming using CP-SAT and Python

#10

I used a lot of solvers in the early 2000s in my Operations Research master after my econometrics study. While now working on software (web) that uses python I’m thrilled to see these deep dives on this subject! I love the subject and reading this brought back a lot of memories. Also the realization that translating constraints to a model (variables, structure etc) is 90% of the work and the most difficult part.

I used program called GAMS in mine.

Its syntax structure is totally free form!

https://www.gams.com/latest/docs/UG_GAMSPrograms.html#UG_GAM...

Post reply on HN