master-thesis/Evaluation/GeneratedRecipes.ipynb
2020-01-19 20:55:27 +01:00

367 lines
9.0 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Generated Recipes for evaluation"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"sys.path.append(\"../\")\n",
"sys.path.append(\"../EvolutionaryAlgorithm/\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"import EvolutionaryAlgorithm as EA"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Noodle recipes\n",
"* generate noodle recipes with a population size of 50 over 50 cycles and choose randomly 5 from the 20 best"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"p = EA.Population([\"noodle\"],['noodle'], min_additional=4, max_additional=13, n_population = 50)\n",
"\n",
"p.run(50)\n",
"\n",
"samples = EA.np.random.choice(p.population[:10], 5)\n",
"\n",
"for i, s in enumerate(samples):\n",
" display(EA.Markdown(f\"### Noodle Recipe {i+1}\"))\n",
" display(s.root().to_instruction().to_markdown())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Rice recipes\n",
"* generate noodle recipes with a population size of 50 over 50 cycles and choose randomly 5 from the 20 best"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "791ec7b41eb94717b800e114d9f56861",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(FloatProgress(value=0.0, description='build initial population', max=50.0, style=ProgressStyle(…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "da397fc1a8cf4cc9b760f9c000351682",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(FloatProgress(value=0.0, description='run evolutionary cycles', max=50.0, style=ProgressStyle(d…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n"
]
},
{
"data": {
"text/markdown": [
"### Rice Recipe 1"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/markdown": [
"**Ingredients**:\n",
" * rice\n",
" * olive oil\n",
" * chicken broth\n",
" * celery\n",
" * mushroom soup\n",
"\n",
"\n",
"**Instructions**:\n",
"\n",
"| Step | Instruction |\n",
"| ----:|:----------- |\n",
"| 1 | chop celery and mix it with chicken broth and mushroom soup. Then simmer it. |\n",
"| 2 | Mix rice and olive oil. Then warm it. |\n",
"| 3 | Mix together the results of step 1 and step 2. |\n"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/markdown": [
"### Rice Recipe 2"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/markdown": [
"**Ingredients**:\n",
" * soy sauce\n",
" * spinach\n",
" * garlic\n",
" * rice\n",
" * olive oil\n",
" * onion\n",
" * clove garlic\n",
" * chicken\n",
" * red kidney bean\n",
" * tomato\n",
" * celery\n",
" * cheese\n",
" * mushroom soup\n",
"\n",
"\n",
"**Instructions**:\n",
"\n",
"| Step | Instruction |\n",
"| ----:|:----------- |\n",
"| 1 | heat and simmer clove garlic |\n",
"| 2 | cut and cut tomato |\n",
"| 3 | wash chicken, grate onion, cut celery, chop spinach, slice olive oil and mix it with garlic, soy sauce, rice, red kidney bean and mushroom soup and mix it together with the results of step 1 and step 2. Then cook it. |\n",
"| 4 | grate cheese and mix it together with the results of step 3. |\n"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/markdown": [
"### Rice Recipe 3"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/markdown": [
"**Ingredients**:\n",
" * green pea\n",
" * rice\n",
" * water\n",
" * olive oil\n",
" * onion\n",
" * chicken broth\n",
" * clove garlic\n",
" * chicken\n",
" * chicken soup\n",
" * pepper\n",
" * ground beef\n",
"\n",
"\n",
"**Instructions**:\n",
"\n",
"| Step | Instruction |\n",
"| ----:|:----------- |\n",
"| 1 | saute and slice olive oil |\n",
"| 2 | boil and heat clove garlic |\n",
"| 3 | pour chicken soup, pour chicken broth, grate onion, brown rice, chop chicken and mix it with ground beef, water, pepper and green pea and mix it together with the results of step 1 and step 2. Then heat it. |\n"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/markdown": [
"### Rice Recipe 4"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/markdown": [
"**Ingredients**:\n",
" * green pea\n",
" * corn\n",
" * garlic\n",
" * rice\n",
" * olive oil\n",
" * sprout\n",
" * onion\n",
" * chicken broth\n",
" * clove garlic\n",
" * pepper\n",
" * ground beef\n",
"\n",
"\n",
"**Instructions**:\n",
"\n",
"| Step | Instruction |\n",
"| ----:|:----------- |\n",
"| 1 | grate onion, chop clove garlic, cook chicken broth, heat corn and mix it with olive oil. Then simmer it. |\n",
"| 2 | chop garlic, refrigerate rice and mix it with sprout, ground beef, pepper and green pea and mix it together with the results of step 1. Then heat it. |\n"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/markdown": [
"### Rice Recipe 5"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/markdown": [
"**Ingredients**:\n",
" * green pea\n",
" * garlic\n",
" * rice\n",
" * water\n",
" * olive oil\n",
" * onion\n",
" * chicken broth\n",
" * clove garlic\n",
" * chicken\n",
" * pepper\n",
" * ground beef\n",
"\n",
"\n",
"**Instructions**:\n",
"\n",
"| Step | Instruction |\n",
"| ----:|:----------- |\n",
"| 1 | grate onion, chop chicken, place chicken broth, warm water, heat garlic and mix it with green pea, clove garlic, rice, olive oil, pepper and ground beef. Then heat it. |\n"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"p = EA.Population([\"rice\"],['rice'], min_additional=4, max_additional=13, n_population = 50)\n",
"\n",
"p.run(50)\n",
"\n",
"samples = EA.np.random.choice(p.population[:10], 5)\n",
"\n",
"for i, s in enumerate(samples):\n",
" display(EA.Markdown(f\"### Rice Recipe {i+1}\"))\n",
" display(s.root().to_instruction().to_markdown())"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}