Cooking functionally
I am not actually using functional programming in the kitchen :-)
I am re-writing my old cookingspace.com web app in Clojure with a new twist: the new web app will be an AI agent for planning recipes based on the food you have on-hand and based on a user's history, preferences, and the general mood they are in (food-wise). I have written some tools to convert my old relational database code for (more or less) static data (USDA nutrition information, recipes) to Clojure literal data.
Based on the type of food a user feels like cooking and what food they have on-hand, I need to transform recipes in an intelligent way to (hopefully!) also taste great after ingredients have substituted or morphed because a user would prefer a different type of sauce over a base recipe, etc., etc.
Anyway, working in Lisp and experimenting in a repl is making the entire process easier.
My wife and I are both very good cooks and we can make up super-tasty recipes on the fly with whatever ingredients we have on hand. I am betting on two things: I can automate our expertise and that people will enjoy using the system when it is finished.
Very nice project idea ;)
ReplyDeleteHi Mark,
ReplyDeleteI recently started a project for setting up default web application templates http://www.luminusweb.net/ it might come in handy, and I'm always open to suggestions and ideas.
The template simply provides a sane default configuration for a Ring/Compojure app. And I'm working on creating good documentation around using these libraries to save people from having to scour google to figure out basic things. :)
Sounds exciting! It's my turn to do the cooking at home tomorrow and my "method" for coming up with something tends to be to find out what we have on hand and then Google and then come up with something based on the search results and my own experience. Automation of some of the decision-making could definitely be useful.
ReplyDeleteThanks Ivan. Wish me luck!
ReplyDeleteI was thinking of doing something like this as a vehicle to learning a rules engine. Where does the AI part fit in beyond leveraging user's preferences and history? I mean does the system "learn" (by some open ended term) or???
ReplyDeleteHello Grant,
ReplyDeleteI am not using a rules engine, rather I am hard-coding rules for substituting ingredients based on what ingredients taste good together.
I am breaking recipes up into ingredient and directions "chunks."
I may end up writing my own case based reasoning engine - not sure, really - just getting started.
re: "I may end up writing my own case based reasoning engine - not sure, really - just getting started."
ReplyDeleteif you read the literature for AI recipe agents (e.g., Chef) they handled narrow domains. I am trying to handle all general types of recipes, so I believe that I have chosen a difficult problem!
It may be useful to model recipes as projects are modelled in project management. This way you can break a recipe down starting with the set of deliverables at the end (plates of food ready to serve), which is then decomposed in to the work required to deliver them. Subject to the capacity constraints of your kitchen, you want everything for a course to arrive at the same time, so it may be amenable to reverse scheduling.
ReplyDeleteUsing this modelling approach, it may be possible to use the more visual presentations (e.g. adapted Gantt chart, musical notation) instead of prose.
A valuable feature would be to scale ingredient quantities for serving a different size party to that used in the original recipe, and to provide useful conversions between weight and volume for common ingredient densities and measurement units.
The ingredients knowledge base could be derived from a semantic wiki.
Thanks Vincent - good ideas, and sort of what I have in mind.
ReplyDeleteIf this all works out well I will either write a series of blog articles on the back end tech, or perhaps even a short book. First though, I need to finish the project :-)