Getting Drunk with Datalog
canopic jug writes:
Programmer Ian Henry has written a blog post about using datalog to optimze home bar ingredients. That is to say, given what is in his bar already which cocktails can he already mix and which one new ingredient would provide the largest possible number of additional recipes?
I like cocktails. Once upon a time, I liked to go to restaurants and order cocktails. But for some reason I haven't been going to restaurants for a while, and instead I've been making cocktails at home.
But I don't want to mix the same cocktails every time. A big part of what I enjoyed about the restaurant-cocktail-ordering experience was the variety: every fancy hipster restaurant I used to frequent had its own cocktail menu - it's own unique set of drinks, full of ingredients I had never heard of.
Which is sort of a problem, for the home bartender.
See, I don't have a very comprehensive liquor collection. I've got the basics, sure, and over the course of quarantining I've acquired a few fancier ingredients. But fancy ingredients usually aren't very versatile: I bought a bottle of Amaro Nonino once to mix a Paper Plane. But it turns out I don't like really Paper Planes. So now I just have, like, 97.1% of a bottle of Amaro Nonino, and nothing to do with it.
That was not very efficient purchase. We can do better.
So I wrote a little program to tell me: given what I have in my bar right now, what should I add that will enable me to make the maximum number of new cocktails. Or in other words, what is my most efficient purchase - what is the ingredient that I am most "blocked on."
Datalog is a type of logic programming language used especially for data integration and information extraction. It consists of a database of facts and a set of rules for deriving new facts from existing ones.
Read more of this story at SoylentNews.