diff --git a/data/long_recipebook.xml b/data/long_recipebook.xml index 6727e03..1ecb5a5 100644 --- a/data/long_recipebook.xml +++ b/data/long_recipebook.xml @@ -1796,7 +1796,7 @@ with crunbled bacon and grated cheese to taste. - Tabasco Classic - Perfect Seared Steaks **** + Tabasco Classic Seared Steaks Tabasco @@ -2152,14 +2152,15 @@ couple inches margin around for sauce --- see above). VEGAN/OVO. - Black Bean Soup + Lemon Pork Chops - Appetizers - Vegetarian - Soups + Easy + Low-cal + Main dish + Pork - 6servings + 4servings @@ -2643,7 +2589,7 @@ California Beach Recipe" by Joan and Carl Stromquist ISBN: - EGGPLANT LASAGNE + Eggplant Lasagna Vegan diff --git a/data/long_survey.xml b/data/long_survey.xml index 2b6f832..9fa0219 100644 --- a/data/long_survey.xml +++ b/data/long_survey.xml @@ -3,23 +3,23 @@ 0 - Catalan Rice - - - 1 Hamburger Steak + + 1 + Ice Cream, Lowfat + 2 - Potatoes in a Thick Sauce + Margarita Sunrise 3 - Tomato-Zucchini Casserole + Weinerschnitzel - 4 - Honey Cake + 4 + Blender Double Fudge Cake 5 @@ -27,19 +27,75 @@ 6 - Kahlua Cake + Coconut Beer Batter Shrimp 7 - Ice Cream, Lowfat + Coconut Fish Curry 8 - Blender Double Fudge Cake + Catalan Rice - 9 - Weinerschnitzel + 9 + Tomato-Zucchini Casserole + + + 10 + Tabasco Classic Seared Steaks + + + 11 + Honey cake + + + 12 + Southwest Smoothie + + + 13 + Bayou Shrimp Creole + + + 14 + Crab Burgers + + + 15 + Broiled Flounder + + + 16 + Baked Steak And Lima Beans + + + 17 + Eggplant Lasagna + + + 18 + Salisbury Steak with Mushroom Sauce + + + 19 + Meatless Loaf + + + 20 + Lemon Pork Chops + + + 21 + Fava Bean Burgers + + + 22 + Angel Hair Pesto Primavera + + + 23 + Kahlua Cake @@ -53,15 +109,16 @@ + No allergies, prefers all dishes equally (5) 0 0 - 10 + 5 1 - 2 + 5 2 @@ -95,6 +152,62 @@ 9 5 + + 10 + 5 + + + 11 + 5 + + + 12 + 5 + + + 13 + 5 + + + 14 + 5 + + + 15 + 5 + + + 16 + 5 + + + 17 + 5 + + + 18 + 5 + + + 19 + 5 + + + 20 + 5 + + + 21 + 5 + + + 22 + 5 + + + 23 + 5 + @@ -108,47 +221,104 @@ + Vegetarian, all meat is (1) everything else is (9) 1 0 - 0 + 1 1 - 0 + 9 2 - 5 + 9 3 - 6 + 1 4 - 5 + 9 5 - 5 + 1 6 - 5 + 1 7 - 5 + 1 8 - 5 + 1 9 - 5 + 9 + + + 10 + 1 + + + 11 + 9 + + + 12 + 9 + + + 13 + 1 + + + 14 + 1 + + + 15 + 1 + + + 16 + 1 + + + 17 + 9 + + + 18 + 1 + + + 19 + 9 + + + 20 + 1 + + + 21 + 9 + + + 22 + 9 + + + 23 + 1 @@ -163,48 +333,105 @@ + Nut Alleregy, prefers meat (6) to vegetarian (4) to desert (3) 2 0 - 9 + 6 1 - 2 + 3 2 - 2 + 5 3 - 2 + 6 4 - 5 + 3 5 - 0 + 6 6 - 5 + 6 7 - 5 + 6 8 - 5 + 6 9 + 4 + + + 10 + 6 + + + 11 + 3 + + + 12 5 + + 13 + 6 + + + 14 + 6 + + + 15 + 6 + + + 16 + 6 + + + 17 + 4 + + + 18 + 6 + + + 19 + 4 + + + 20 + 6 + + + 21 + 4 + + + 22 + 4 + + + 23 + 3 + @@ -218,47 +445,104 @@ + No allergies, only prefers Pork and Desserts(9) everything else is (3) 3 0 - 9 + 3 1 - 2 + 9 2 - 2 + 3 3 - 2 + 3 4 - 5 + 9 5 - 7 + 3 6 - 5 + 3 7 - 5 + 3 8 - 5 + 3 9 - 5 + 3 + + + 10 + 3 + + + 11 + 3 + + + 12 + 3 + + + 13 + 3 + + + 14 + 3 + + + 15 + 3 + + + 16 + 3 + + + 17 + 3 + + + 18 + 3 + + + 19 + 3 + + + 20 + 9 + + + 21 + 3 + + + 22 + 3 + + + 23 + 9 diff --git a/src/net/woodyfolsom/cs6601/p2/Diner.java b/src/net/woodyfolsom/cs6601/p2/Diner.java index d9f6bd9..8db4269 100644 --- a/src/net/woodyfolsom/cs6601/p2/Diner.java +++ b/src/net/woodyfolsom/cs6601/p2/Diner.java @@ -10,6 +10,11 @@ public class Diner { private int id; private Map ratings = new HashMap(); private Map categories = new HashMap(); + private String description; + + public String getDescription() { + return description; + } public int getId() { return id; diff --git a/test/net/woodyfolsom/cs6601/p2/RecipeBookReaderTest.java b/test/net/woodyfolsom/cs6601/p2/RecipeBookReaderTest.java index 0661047..ab42819 100644 --- a/test/net/woodyfolsom/cs6601/p2/RecipeBookReaderTest.java +++ b/test/net/woodyfolsom/cs6601/p2/RecipeBookReaderTest.java @@ -24,7 +24,6 @@ public class RecipeBookReaderTest { assertThat(recipeBook.getSize(), is(equalTo(25))); Recipe recipe = recipeBook.getRecipe(0); - System.out.println(recipe.getHead().getTitle()); assertThat(recipe.getHead().getTitle(), is(equalTo("Honey cake"))); assertTrue(recipe.getIngredients().contains(TYPE.EGGS)); assertTrue(recipe.getIngredients().contains(TYPE.GLUTEN)); diff --git a/test/net/woodyfolsom/cs6601/p2/SurveyReaderTest.java b/test/net/woodyfolsom/cs6601/p2/SurveyReaderTest.java index 0b86a18..bd470f2 100644 --- a/test/net/woodyfolsom/cs6601/p2/SurveyReaderTest.java +++ b/test/net/woodyfolsom/cs6601/p2/SurveyReaderTest.java @@ -16,7 +16,7 @@ public class SurveyReaderTest { Survey survey = SurveyReader.readSurvey(new File("data/long_survey.xml")); assertNotNull(survey); - assertThat(survey.getDishCount(), equalTo(10)); + assertThat(survey.getDishCount(), equalTo(24)); assertThat(survey.getDinerCount(), equalTo(4)); assertThat(survey.isCategory(0,"vegetarian"), is(false)); @@ -28,9 +28,21 @@ public class SurveyReaderTest { assertThat(survey.isCategory(2,"vegan"), is(false)); assertThat(survey.isCategory(2,"allergic-nuts"), is(true)); + assertThat(survey.isCategory(3,"vegan"), is(false)); + assertThat(survey.isCategory(3,"allergic-nuts"), is(false)); + assertThat(survey.isDiner("vegetarian"), is(true)); assertThat(survey.isDiner("allergic-nuts"), is(true)); assertThat(survey.isDiner("rastafarian"), is(false)); + + for (int i=0;i -Babel and hyphenation patterns for english, afrikaans, ancientgreek, ar -abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan, coptic, -croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, ga -lician, german, german-x-2009-06-19, greek, gujarati, hindi, hungarian, iceland -ic, indonesian, interlingua, irish, italian, kannada, kurmanji, lao, latin, lat -vian, lithuanian, malayalam, marathi, mongolian, mongolianlmc, monogreek, ngerm -an, ngerman-x-2009-06-19, nynorsk, oriya, panjabi, pinyin, polish, portuguese, -romanian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, swis -sgerman, tamil, telugu, turkish, turkmen, ukenglish, ukrainian, uppersorbian, u -senglishmax, welsh, loaded. -("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\article.cls" -Document Class: article 2007/10/19 v1.4h Standard LaTeX document class -("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\size10.clo" -File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option) -) -\c@part=\count79 -\c@section=\count80 -\c@subsection=\count81 -\c@subsubsection=\count82 -\c@paragraph=\count83 -\c@subparagraph=\count84 -\c@figure=\count85 -\c@table=\count86 -\abovecaptionskip=\skip41 -\belowcaptionskip=\skip42 -\bibindent=\dimen102 -) -("C:\Users\Woody\Desktop\GaTechMS\Spring 2012\CS6601 AI\Project 2\latex8.sty" -IEEE 8.5 x 11-Inch Proceedings Style `latex8.sty'. -\@ctmp=\skip43 -\@figindent=\skip44 -) ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\titlesec\titlesec.sty" -Package: titlesec 2011/12/15 v2.10.0 Sectioning titles -\ttl@box=\box26 -\beforetitleunit=\skip45 -\aftertitleunit=\skip46 -\ttl@plus=\dimen103 -\ttl@minus=\dimen104 -\ttl@toksa=\toks14 -\titlewidth=\dimen105 -\titlewidthlast=\dimen106 -\titlewidthfirst=\dimen107 -) -("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\geometry\geometry.sty" -Package: geometry 2010/09/12 v5.6 Page Geometry - -("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\keyval.sty" -Package: keyval 1999/03/16 v1.13 key=value parser (DPC) -\KV@toks@=\toks15 -) -("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\ifpdf.sty" -Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) -Package ifpdf Info: pdfTeX in PDF mode is detected. -) -("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\ifvtex.sty" -Package: ifvtex 2010/03/01 v1.5 Switches for detecting VTeX and its modes (HO) -Package ifvtex Info: VTeX not detected. -) -("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\ifxetex\ifxetex.sty" -Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional -) -\Gm@cnth=\count87 -\Gm@cntv=\count88 -\c@Gm@tempcnt=\count89 -\Gm@bindingoffset=\dimen108 -\Gm@wd@mp=\dimen109 -\Gm@odd@mp=\dimen110 -\Gm@even@mp=\dimen111 -\Gm@layoutwidth=\dimen112 -\Gm@layoutheight=\dimen113 -\Gm@layouthoffset=\dimen114 -\Gm@layoutvoffset=\dimen115 -\Gm@dimlist=\toks16 - -("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\geometry\geometry.cfg")) -("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\graphicx.sty" -Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR) - -("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\graphics.sty" -Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR) - -("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\trig.sty" -Package: trig 1999/03/16 v1.09 sin cos tan (DPC) -) -("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\00miktex\graphics.cfg" -File: graphics.cfg 2007/01/18 v1.5 graphics configuration of teTeX/TeXLive -) -Package graphics Info: Driver file: pdftex.def on input line 91. - -("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def" -File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX - -("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty" -Package: infwarerr 2010/04/08 v1.3 Providing info/warning/message (HO) -) -("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty" -Package: ltxcmds 2011/04/18 v1.20 LaTeX kernel commands for general use (HO) -) -\Gread@gobject=\count90 -)) -\Gin@req@height=\dimen116 -\Gin@req@width=\dimen117 -) - -LaTeX Warning: Unused global option(s): - [times,08pt]. - - -("C:\Users\Woody\Desktop\GaTechMS\Spring 2012\CS6601 AI\Project 2\P2 Proposal.a -ux") -LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 10. -LaTeX Font Info: ... okay on input line 10. -LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 10. -LaTeX Font Info: ... okay on input line 10. -LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 10. -LaTeX Font Info: ... okay on input line 10. -LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 10. -LaTeX Font Info: ... okay on input line 10. -LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 10. -LaTeX Font Info: ... okay on input line 10. -LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 10. -LaTeX Font Info: ... okay on input line 10. - -*geometry* driver: auto-detecting -*geometry* detected driver: pdftex -*geometry* verbose mode - [ preamble ] result: -* driver: pdftex -* paper: -* layout: -* layoutoffset:(h,v)=(0.0pt,0.0pt) -* modes: -* h-part:(L,W,R)=(36.135pt, 542.02501pt, 36.135pt) -* v-part:(T,H,B)=(36.135pt, 722.7pt, 36.135pt) -* \paperwidth=614.295pt -* \paperheight=794.96999pt -* \textwidth=542.02501pt -* \textheight=722.7pt -* \oddsidemargin=-36.135pt -* \evensidemargin=-36.135pt -* \topmargin=-36.135pt -* \headheight=0.0pt -* \headsep=0.0pt -* \topskip=10.0pt -* \footskip=30.0pt -* \marginparwidth=4.0pt -* \marginparsep=10.0pt -* \columnsep=22.58437pt -* \skip\footins=9.0pt plus 4.0pt minus 2.0pt -* \hoffset=0.0pt -* \voffset=0.0pt -* \mag=1000 -* \@twocolumntrue -* \@twosidefalse -* \@mparswitchfalse -* \@reversemarginfalse -* (1in=72.27pt=25.4mm, 1cm=28.453pt) - -("C:\Program Files (x86)\MiKTeX 2.9\tex\context\base\supp-pdf.mkii" -[Loading MPS to PDF converter (version 2006.09.02).] -\scratchcounter=\count91 -\scratchdimen=\dimen118 -\scratchbox=\box27 -\nofMPsegments=\count92 -\nofMParguments=\count93 -\everyMPshowfont=\toks17 -\MPscratchCnt=\count94 -\MPscratchDim=\dimen119 -\MPnumerator=\count95 -\makeMPintoPDFobject=\count96 -\everyMPtoPDFconversion=\toks18 -) -LaTeX Font Info: External font `cmex10' loaded for size -(Font) <12> on input line 17. -LaTeX Font Info: External font `cmex10' loaded for size -(Font) <8> on input line 17. -LaTeX Font Info: External font `cmex10' loaded for size -(Font) <6> on input line 17. -LaTeX Font Info: External font `cmex10' loaded for size -(Font) <7> on input line 80. -LaTeX Font Info: External font `cmex10' loaded for size -(Font) <5> on input line 80. - -File: bayes.jpeg Graphic file (type jpg) - -Package pdftex.def Info: bayes.jpeg used on input line 88. -(pdftex.def) Requested size: 259.72032pt x 168.24995pt. - -("C:\Users\Woody\Desktop\GaTechMS\Spring 2012\CS6601 AI\Project 2\P2 Proposal.b -bl" -Underfull \vbox (badness 10000) has occurred while \output is active [] - - [1{C:/ProgramData/MiKTeX/2.9/pdftex/config/pdftex.map} - - - ] -Underfull \hbox (badness 3396) in paragraph at lines 21--26 -[]\OT1/cmr/m/n/10 Tran The Truyen, Dinh Q. Phung, and Svetha - [] - -) [2 - -] -("C:\Users\Woody\Desktop\GaTechMS\Spring 2012\CS6601 AI\Project 2\P2 Proposal.a -ux") ) -Here is how much of TeX's memory you used: - 1913 strings out of 494045 - 26388 string characters out of 3145969 - 90866 words of memory out of 3000000 - 5218 multiletter control sequences out of 15000+200000 - 9590 words of font info for 30 fonts, out of 3000000 for 9000 - 715 hyphenation exceptions out of 8191 - 27i,7n,32p,469b,212s stack positions out of 5000i,500n,10000p,200000b,50000s -{C:/Program Files (x86)/MiKTeX 2.9/fonts/enc/dvips/fontname/8r.enc} -Output written on "P2 Proposal.pdf" (2 pages, 239834 bytes). -PDF statistics: - 47 PDF objects out of 1000 (max. 8388607) - 0 named destinations out of 1000 (max. 500000) - 6 words of extra memory for PDF output out of 10000 (max. 10000000) - +This is pdfTeX, Version 3.1415926-1.40.11 (TeX Live 2010) (format=pdflatex 2011.7.20) 12 MAR 2012 12:48 +entering extended mode + restricted \write18 enabled. + %&-line parsing enabled. +**"P2 Proposal.tex" +(./P2 Proposal.tex +LaTeX2e <2009/09/24> +Babel and hyphenation patterns for english, dumylang, nohyphenation, ge +rman-x-2009-06-19, ngerman-x-2009-06-19, ancientgreek, ibycus, arabic, armenian +, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danish, dutch, u +kenglish, usenglishmax, esperanto, estonian, farsi, finnish, french, galician, +german, ngerman, swissgerman, monogreek, greek, hungarian, icelandic, assamese, + bengali, gujarati, hindi, kannada, malayalam, marathi, oriya, panjabi, tamil, +telugu, indonesian, interlingua, irish, italian, kurmanji, lao, latin, latvian, + lithuanian, mongolian, mongolianlmc, bokmal, nynorsk, polish, portuguese, roma +nian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, turkish, + turkmen, ukrainian, uppersorbian, welsh, loaded. +(/usr/local/texlive/2010/texmf-dist/tex/latex/base/article.cls +Document Class: article 2007/10/19 v1.4h Standard LaTeX document class +(/usr/local/texlive/2010/texmf-dist/tex/latex/base/size10.clo +File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option) +) +\c@part=\count79 +\c@section=\count80 +\c@subsection=\count81 +\c@subsubsection=\count82 +\c@paragraph=\count83 +\c@subparagraph=\count84 +\c@figure=\count85 +\c@table=\count86 +\abovecaptionskip=\skip41 +\belowcaptionskip=\skip42 +\bibindent=\dimen102 +) (./latex8.sty +IEEE 8.5 x 11-Inch Proceedings Style `latex8.sty'. +\@ctmp=\skip43 +\@figindent=\skip44 +) (/usr/local/texlive/2010/texmf-dist/tex/latex/titlesec/titlesec.sty +Package: titlesec 2007/08/12 v2.8 Sectioning titles +\ttl@box=\box26 +\beforetitleunit=\skip45 +\aftertitleunit=\skip46 +\ttl@plus=\dimen103 +\ttl@minus=\dimen104 +\ttl@toksa=\toks14 +\titlewidth=\dimen105 +\titlewidthlast=\dimen106 +\titlewidthfirst=\dimen107 +) +(/usr/local/texlive/2010/texmf-dist/tex/latex/graphics/graphicx.sty +Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR) + +(/usr/local/texlive/2010/texmf-dist/tex/latex/graphics/keyval.sty +Package: keyval 1999/03/16 v1.13 key=value parser (DPC) +\KV@toks@=\toks15 +) +(/usr/local/texlive/2010/texmf-dist/tex/latex/graphics/graphics.sty +Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR) + +(/usr/local/texlive/2010/texmf-dist/tex/latex/graphics/trig.sty +Package: trig 1999/03/16 v1.09 sin cos tan (DPC) +) +(/usr/local/texlive/2010/texmf-dist/tex/latex/latexconfig/graphics.cfg +File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live +) +Package graphics Info: Driver file: pdftex.def on input line 91. + +(/usr/local/texlive/2010/texmf-dist/tex/latex/pdftex-def/pdftex.def +File: pdftex.def 2010/02/14 v0.04n Graphics/color for pdfTeX +\Gread@gobject=\count87 +)) +\Gin@req@height=\dimen108 +\Gin@req@width=\dimen109 +) +(/usr/local/texlive/2010/texmf-dist/tex/latex/amsmath/amsmath.sty +Package: amsmath 2000/07/18 v2.13 AMS math features +\@mathmargin=\skip47 + +For additional information on amsmath, use the `?' option. +(/usr/local/texlive/2010/texmf-dist/tex/latex/amsmath/amstext.sty +Package: amstext 2000/06/29 v2.01 + +(/usr/local/texlive/2010/texmf-dist/tex/latex/amsmath/amsgen.sty +File: amsgen.sty 1999/11/30 v2.0 +\@emptytoks=\toks16 +\ex@=\dimen110 +)) +(/usr/local/texlive/2010/texmf-dist/tex/latex/amsmath/amsbsy.sty +Package: amsbsy 1999/11/29 v1.2d +\pmbraise@=\dimen111 +) +(/usr/local/texlive/2010/texmf-dist/tex/latex/amsmath/amsopn.sty +Package: amsopn 1999/12/14 v2.01 operator names +) +\inf@bad=\count88 +LaTeX Info: Redefining \frac on input line 211. +\uproot@=\count89 +\leftroot@=\count90 +LaTeX Info: Redefining \overline on input line 307. +\classnum@=\count91 +\DOTSCASE@=\count92 +LaTeX Info: Redefining \ldots on input line 379. +LaTeX Info: Redefining \dots on input line 382. +LaTeX Info: Redefining \cdots on input line 467. +\Mathstrutbox@=\box27 +\strutbox@=\box28 +\big@size=\dimen112 +LaTeX Font Info: Redeclaring font encoding OML on input line 567. +LaTeX Font Info: Redeclaring font encoding OMS on input line 568. +\macc@depth=\count93 +\c@MaxMatrixCols=\count94 +\dotsspace@=\muskip10 +\c@parentequation=\count95 +\dspbrk@lvl=\count96 +\tag@help=\toks17 +\row@=\count97 +\column@=\count98 +\maxfields@=\count99 +\andhelp@=\toks18 +\eqnshift@=\dimen113 +\alignsep@=\dimen114 +\tagshift@=\dimen115 +\tagwidth@=\dimen116 +\totwidth@=\dimen117 +\lineht@=\dimen118 +\@envbody=\toks19 +\multlinegap=\skip48 +\multlinetaggap=\skip49 +\mathdisplay@stack=\toks20 +LaTeX Info: Redefining \[ on input line 2666. +LaTeX Info: Redefining \] on input line 2667. +) + +LaTeX Warning: Unused global option(s): + [times,08pt]. + +(./P2 Proposal.aux) +\openout1 = `"P2 Proposal.aux"'. + +LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 11. +LaTeX Font Info: ... okay on input line 11. +LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 11. +LaTeX Font Info: ... okay on input line 11. +LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 11. +LaTeX Font Info: ... okay on input line 11. +LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 11. +LaTeX Font Info: ... okay on input line 11. +LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 11. +LaTeX Font Info: ... okay on input line 11. +LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 11. +LaTeX Font Info: ... okay on input line 11. + +(/usr/local/texlive/2010/texmf-dist/tex/context/base/supp-pdf.mkii +[Loading MPS to PDF converter (version 2006.09.02).] +\scratchcounter=\count100 +\scratchdimen=\dimen119 +\scratchbox=\box29 +\nofMPsegments=\count101 +\nofMParguments=\count102 +\everyMPshowfont=\toks21 +\MPscratchCnt=\count103 +\MPscratchDim=\dimen120 +\MPnumerator=\count104 +\everyMPtoPDFconversion=\toks22 +) (/usr/local/texlive/2010/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty +Package: pdftexcmds 2010/04/01 v0.9 Utility functions of pdfTeX for LuaTeX (HO) + + +(/usr/local/texlive/2010/texmf-dist/tex/generic/oberdiek/infwarerr.sty +Package: infwarerr 2010/04/08 v1.3 Providing info/warning/message (HO) +) +(/usr/local/texlive/2010/texmf-dist/tex/generic/oberdiek/ifluatex.sty +Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) +Package ifluatex Info: LuaTeX not detected. +) +(/usr/local/texlive/2010/texmf-dist/tex/generic/oberdiek/ltxcmds.sty +Package: ltxcmds 2010/04/26 v1.7 LaTeX kernel commands for general use (HO) +) +Package pdftexcmds Info: LuaTeX not detected. +Package pdftexcmds Info: \pdf@primitive is available. +Package pdftexcmds Info: \pdf@ifprimitive is available. +) +(/usr/local/texlive/2010/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty +Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf + +(/usr/local/texlive/2010/texmf-dist/tex/latex/oberdiek/grfext.sty +Package: grfext 2007/09/30 v1.0 Managing graphics extensions (HO) +) +(/usr/local/texlive/2010/texmf-dist/tex/latex/oberdiek/kvoptions.sty +Package: kvoptions 2010/02/22 v3.7 Keyval support for LaTeX options (HO) + +(/usr/local/texlive/2010/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty +Package: kvsetkeys 2010/03/01 v1.9 Key value parser (HO) + +(/usr/local/texlive/2010/texmf-dist/tex/generic/oberdiek/etexcmds.sty +Package: etexcmds 2010/01/28 v1.3 Prefix for e-TeX command names (HO) +Package etexcmds Info: Could not find \expanded. +(etexcmds) That can mean that you are not using pdfTeX 1.50 or +(etexcmds) that some package has redefined \expanded. +(etexcmds) In the latter case, load this package earlier. +))) +Package grfext Info: Graphics extension search list: +(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE +G,.JBIG2,.JB2,.eps] +(grfext) \AppendGraphicsExtensions on input line 436. + +(/usr/local/texlive/2010/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg +File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv +e +)) + +File: bayes.png Graphic file (type png) + + +LaTeX Warning: Citation `murphy' on page 1 undefined on input line 117. + +[1{/usr/local/texlive/2010/texmf-var/fonts/map/pdftex/updmap/pdftex.map} + + +] + +Package amsmath Warning: Foreign command \over; +(amsmath) \frac or \genfrac should be used instead +(amsmath) on input line 137. + +(./P2 Proposal.bbl +Underfull \vbox (badness 2512) has occurred while \output is active [] + +) [2 <./bayes.png (PNG copy)>] (./P2 Proposal.aux) + +LaTeX Warning: There were undefined references. + + ) +Here is how much of TeX's memory you used: + 2184 strings out of 493747 + 28746 string characters out of 3143546 + 93189 words of memory out of 3000000 + 5461 multiletter control sequences out of 15000+200000 + 11026 words of font info for 36 fonts, out of 3000000 for 9000 + 714 hyphenation exceptions out of 8191 + 38i,8n,28p,406b,211s stack positions out of 5000i,500n,10000p,200000b,50000s +{/usr/local/texlive/2010/texmf-dist/fonts/enc/dvips/base/8r.enc} +Output written on "P2 Proposal.pdf" (2 pages, 194457 bytes). +PDF statistics: + 53 PDF objects out of 1000 (max. 8388607) + 37 compressed objects within 1 object stream + 0 named destinations out of 1000 (max. 500000) + 6 words of extra memory for PDF output out of 10000 (max. 10000000) + diff --git a/writeup/P2 Proposal.pdf b/writeup/P2 Proposal.pdf index 31677ef..5762059 100644 Binary files a/writeup/P2 Proposal.pdf and b/writeup/P2 Proposal.pdf differ diff --git a/writeup/P2 Proposal.tex b/writeup/P2 Proposal.tex index 0bceffc..c0ce90f 100644 --- a/writeup/P2 Proposal.tex +++ b/writeup/P2 Proposal.tex @@ -2,8 +2,9 @@ \usepackage{latex8} \usepackage{titlesec} -\usepackage[margin=0.5in]{geometry} +% \usepackage[margin=0.5in]{geometry} \usepackage{graphicx} +\usepackage{amsmath} \titleformat{\section}{\large\bfseries}{\thesection}{1em}{} @@ -24,9 +25,9 @@ given the exponential number of dishes which can be created from a small number of ingredients, as well has hard constraints such as allergies and religious beliefs. Many professional catering services handle this problem by allowing guests to select from a very limited -menu. We propose to develop a dish recommendation system -based on Bayesian Networks modeling user preferences and -which proposes meals that most likely match the varied tastes +menu. We introduce a dish recommendation system +based on Bayesian Networks modeling user preferences. +We predict the meals from a data base of recepices that most likely match the varied tastes of the customers, using a limited set of ingredients. This type of expert system would be of great use to a catering service or restaurant which needs to rapdily decide on a small number of dishes which would be acceptable for a large dinner party, @@ -41,26 +42,44 @@ and past food choices \cite{janzenxiang}. Baysian networks have also been applied to recommendation systems before in on-line social networks \cite{truyen} making predictions of the form ``if you bought those items what is the probability you would like to -buy that''. We suggest that these approaches are limited in that they only consider the preferences of a single (or supposed 'typical') user rather than a group. +buy that''. We suggest that these approaches are limited in that they +only consider the preferences of a single (or supposed 'typical') user rather than a group. -\section*{Proposed Approach} +\section*{Approach} The approached problem is to pick a single meal which best meets the requirements -and tastes of different people dining together. +and tastes of different people dining together. We learn a predictive +baysian net from a survey distributed to participants of the meal as +training data in order to capture their preferences. The dishes +in the questionaire are selected such that all ingrediants +are covered. The participants rate each dish on a scale from +one to ten and give additional information like vegetarians. +For new dishes we then predict the maximum likelihood +rating given our model. +In the following we will describe our approach in detail. +First we will discuss the data selection, then the +modeling of the user preference and in the +end how to train the modeled net from +gathered data and howe to predict the +value for a new recepice. -%\subsection*{Application Framework} -First, we will accumulate a diverse collection of sample recipes using the open source AnyMeal application -to convert freely available MealMaster format (flat file) recipes to XML format for input into the Java Bayesian network / optimization -application we propose. +\paragraph*{Data accuisition} +We accumulated a diverse collection of sample recipes using the open source AnyMeal application. +We converted to the freely available MealMaster format (flat file) +recipes to XML format for input into our application. +We will gathered data representing several diners' preference for +approximately 20 meals using a simple survey of the type 'rate on a +scale of 1 to 10, 10 being favorite and 1 being least favorite'. +Furthermore we collected data for vegetarians and vegans. -%\subsection*{Data Collection} -Next, we will gather data representing several diners' preference for approximately 20 meals using a simple survey of the type 'rate on a scale of 1 to 10, 10 being favorite and 1 being least favorite'. A value of 0 for a given dish will be taken to mean that one or more ingredients trigger and allergy or violate a religous constraint, and the diner cannot consume the dish. -%\subsection*{Model} +%daniel is here +\paragraph*{Knowledge Engineering} We will model each individual user's preferences and needs as a Bayesian network, which means a set of independence and conditional independence relationships between variables -\cite{russelnorvig}. Our model consists of 4 layers, +\cite{russelnorvig}. +Our model consists of 4 layers, each modeling a different aspect of taste and needs. In the first layer we capture general meal preferences, like being vegetarian or not liking your food steamed. @@ -79,26 +98,48 @@ someone suffers from diabetes. The overall net is shown in Figure \ref{img:bayes_net}. Given a recipe with a list of ingredients $I = i_1,...,i_n$ and a Bayesian network capturing user preferences -we can calculate the probability of users liking the dish as -$P(i_1 \wedge i_2 \wedge ... \wedge i_n) = \Pi_{i = -1}^{n} p(i_i \mid parents(i_i))$ \cite{russelnorvig}. +we can calculate the probability of users liking the dish given +the probabilities of liking each ingrediant. \begin{figure} \centering -\includegraphics[width=\linewidth]{bayes.jpeg} +\includegraphics[width=\linewidth]{bayes} \caption{Our Baysian net modeling user preferences} \label{img:bayes_net} \end{figure} +%\subsection*{implementation} +\paragraph*{Learning and Predicting} In order to estimate the model parameters, the system will be trained with statistics about taste and preferences given a set of dishes with ratings from multiple users. From that information we can directly calculate -the probabilities for the ingredients. +the probabilities for the ingredients using Maximum Likelihood Learning \cite{murphy}. + %\subsection*{Meal Optimization} -When learning the rest of the variables (that are not observed and therefore -hidden / latent) we will use Expectation Maximization \cite{russelnorvig}. +In order to model food preferences, we implemented +a baysian net library in java. The library +uses the sum-product algorithm for +inference and maximum likelihood learning +for parameter estimation. In our implementation +we support discrete as well as continous +probability distributions. Discrete distributions +can be modeled as tables or as trees. +In our implementation only continous distributions with discrete parents +are supported. A continous distribution is then modeled as a mapping +of all possible combination of it' s parents to a gaussian. +Given a data set, the parameters of a discrete variable $X$ are +estimated as +\begin{align} +P(X = x| Y_1 = y_1, ... Y_2 = y2) =\\ +N(X = x| Y_1 = y_1, ... Y_2 = y2) \over N(Y_1 = y_1, ... Y_2 = y2) +\end{align} +where $N(A)$ is the number of times event $A$occurs in the data set. +We decided to implement our own Library, +so we understand what is going on and +we can debug and fix the models +and algorithms easily. \section*{Evaluation} The application model will be trained using a sparse subset (25-50\%) of the survey data and the optimization problem soled for the inferred constraints. diff --git a/writeup/bayes.jpeg b/writeup/bayes.jpeg deleted file mode 100644 index 2b6f296..0000000 Binary files a/writeup/bayes.jpeg and /dev/null differ diff --git a/writeup/bayes.png b/writeup/bayes.png new file mode 100644 index 0000000..9273494 Binary files /dev/null and b/writeup/bayes.png differ