View Full Version : lunch lunch lunch
A few years back, I did an expert systems project which was a system that helped people decide where to go to lunch based on each user's preferences. A guy in that class just emailed me saying, basically, that he and his friends at work couldn't decide where to go to lunch; so he was wondering if I still had the code for that project..
I figured, since I packaged it up for him, I'd share it with you guys:
http://www.cs.rit.edu/~kmj9907/lunch.tar
GnuVince
10-16-2002, 03:15 PM
I had done one in O'Caml this summer. Doesn't use anybody's preferences though, just a plain text file:
(* Author : Vincent Foley *)
(* Program: Restaurant chooser *)
(* Version: 0.3 *)
(* Function to fill the restaurant list *)
(* val mkliste : string -> string list = <fun> *)
let mkliste fd =
let rec doit acc f =
try
doit ((input_line f)::acc) f
with End_of_file -> acc
in
doit [] (open_in fd)
let _ =
try
let restos = mkliste Sys.argv.(1) in
Random.self_init ();
Printf.printf "Restaurant pour aujourd'hui: %s\n" (List.nth restos
(Random.int (List.length restos)))
with Invalid_argument(_) ->
Printf.printf "Usage: %s <file>\n" Sys.argv.(0)
For the heck of it, I made a Ruby version (yes, that's french):
#!/usr/bin/env ruby
if ARGV.length != 1 then
puts "Usage: #$0 <fichier des restaurants>"
exit 1
else
begin
liste = File.new(ARGV[0]).readlines
print liste[rand(liste.length)]
rescue Exception => e
$stderr.puts "Erreur inattendue! #{e}"
end
end
Oh, mine doesn't use randomness at all; it keeps track of where people have gone lately, and based on that and their preferences, and what subgroup of people are going to lunch, tries to decide what the top three choices for lunch are. It actually worked pretty well, but we eventually stopped using it.
sans-hubris
10-16-2002, 10:09 PM
You didn't use CLIPS (http://www.ghg.net/clips/CLIPS.html) at all to build your expert system? CLIPS is really a great language for building expert systems, but not really much else. I had to use it for my Artificial Intelligence class.
Nah; didn't really need to for what I was doing.
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.