Live data from Hacker News

Constraint Solving with MiniZinc

hillelwayne.com

21–30 of 39 posts

Re: Constraint Solving with MiniZinc

#21
post #14

How does this relate to using integer linear programming to solve linear constraint problems? Why would one use a dedicated language? When I model constraint satisfaction & optimization problems, I generally try to make linear models and define them using pulp in Python. The models are built by python programs; I feel using a dedicated domain-specific language is not so useful (you need general purpose computing to d…

How do you optimise a delivery route with specific window times for each drop off using a linear model? How do you schedule shifts for employees to satisfy business requirements without also violating their contracts? How do you fill a truck with the right combinations of goods so that it maximises the space used, but also doesn't unbalance the container, and can still be unloaded at each drop off using first in last out? How do you maximise operating capacity at a factory when each time you change what you are building requires stop start time and you need to produce a range of products consistently, while also meeting customer delivery windows, and you don't have unlimited storage for inventory and limited staff with specific skills that only work certain hours or days of the week? How does a retailer layout their warehouses so when the orders for stores are picked it minimises the labour costs for not only picking the orders, but also putting stock on the shelves at the stores? How much should they order for each item, and how often do you deliver to stores? You can probably guess I work in Supply Chain.

Re: Constraint Solving with MiniZinc

#22
post #21
post #14

How does this relate to using integer linear programming to solve linear constraint problems? Why would one use a dedicated language? When I model constraint satisfaction & optimization problems, I generally try to make linear models and define them using pulp in Python. The models are built by python programs; I feel using a dedicated domain-specific language is not so useful (you need general purpose computing to d…

How do you optimise a delivery route with specific window times for each drop off using a linear model? How do you schedule shifts for employees to satisfy business requirements without also violating their contracts? How do you fill a truck with the right combinations of goods so that it maximises the space used, but also doesn't unbalance the container, and can still be unloaded at each drop off using first in last…

I believe you're trying to make a point about something, but all I can see are (rethorical?) questions.

Re: Constraint Solving with MiniZinc

#23
post #19

Having used Minizinc for a few years now, it's a great tool. Minizinc makes it easy to spell out a problem, try different ways to formulate the same constraint, and run the same model on some external data through lots of different solvers to see which one works best. It comes with an enormous constraint catalogue adapted to each solver. Whether you then use PuLP, OR-tools, JuMP etc. (or even Minizinc itself) for the…

Ah, thanks for giving some context. Since I work in an industry that has our main problems being LP & MIP, I can see no reason to not use a general purpose language like Python or Julia to talk to an industrial solver like Gurobi. However, if I worked for a firm that did all sorts of optimization work (I'm jealous of anyone who does this), I might have to determine how best to formulate the problem and maybe MiniZinc is helpful there.

Re: Constraint Solving with MiniZinc

#24
post #22
post #21

Earlier quoted context omitted.

How do you optimise a delivery route with specific window times for each drop off using a linear model? How do you schedule shifts for employees to satisfy business requirements without also violating their contracts? How do you fill a truck with the right combinations of goods so that it maximises the space used, but also doesn't unbalance the container, and can still be unloaded at each drop off using first in last…

I believe you're trying to make a point about something, but all I can see are (rethorical?) questions.

Maybe saying some of that can't be formulated as LP/MIP?

Re: Constraint Solving with MiniZinc

#27

If this is of interest to you, I can recommend the Coursera courses. They are very effective for introducing both MiniZinc and constraint-based modeling of problems.

If you don't mind sharing, how do you use these tools?

I’ve used it for smaller problems ranging from toys and puzzles to small scale optimization and scheduling problems.

In the latter, my biggest use was to prototype how I’d solve a problem for my sister in her job (scheduling facilities maintenance in a way that didn’t interfere with planned experiments and tests, what maintenance work could be done and when to minimize conflicts with customer schedules). It worked as an example but couldn’t handle the full factors (well, my laptop and lack of experience optimizing models) and they continued relying on (mostly) human judgement (worked out well enough).

I also used it to make a soccer schedule. It worked better than my teammates attempt at making a scheduler from scratch (building both the solver and model). There are already systems for this that the league had available, it was more a “can I do this” challenge.

More important, to me, was learning about a class of solvers and what problems they were effective at solving. Even though I have no immediate need it expanded my knowledge so I know where to start in the future rather than (foolishly) starting from scratch. Or I can point others to it. I’ve seen many devs (myself at times too) reinvent the wheel because we don’t know what options are out there. I took the course to combat that behavior in myself and to better guide colleagues, plus it was fun.

(Apologies, on mobile. I have a few more paragraphs I could write but this is not the easiest entry mechanism for that.)

Re: Constraint Solving with MiniZinc

#28
I don't have many applications for constraint solving in my day-to-day work, but I genuinely think there is a need for a well-designed common language to express constraints on data sets - non-turing-complete, easy-to-use quantifiers etc. MiniZinc is that.

Re: Constraint Solving with MiniZinc

#30

In similar vein to others asking "how does this compare with ..."; I'm reading a book on Prolog at the moment and would be interested if anyone has experience in both MiniZinc and Prolog and can compare them for constraint solving ?

For depth and breadth, I don't think Håkan Kjellerstrand can be beat. (hakank.org) The downside is, you have to do a lot of reading to figure out what's going on. The upshot is, it's all in one place. I don't know that there's any great introductory material that will give you a brief comparison between systems -- it may be that solving constraint satisfaction problems is just really hard, and there's no summary that can do it justice.
Post reply on HN