diff options
Diffstat (limited to 'Untitled.ipynb')
-rw-r--r-- | Untitled.ipynb | 114 |
1 files changed, 46 insertions, 68 deletions
diff --git a/Untitled.ipynb b/Untitled.ipynb index eca45d1..40be1aa 100644 --- a/Untitled.ipynb +++ b/Untitled.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 185, + "execution_count": 208, "metadata": {}, "outputs": [ { @@ -69,43 +69,21 @@ }, { "cell_type": "code", - "execution_count": 186, + "execution_count": null, "metadata": {}, "outputs": [], - "source": [ - "makeStepR = lambda step, r: 'r' + str(step) + '_' + str(r)\n", - "makeStepY = lambda step, y: 'y' + str(step) + '_' + str(y)\n", - "\n", - "f = open('lp.2', 'w')\n", - "f.write('Minimize\\n')\n", - "for step in range(n_ingredients):\n", - " for r, recipe in enumerate(recipes):\n", - " f.write(' - ' + makeStepR(step, r))\n", - "f.write('\\nSubject To\\n')\n", - "for step in range(n_ingredients):\n", - " f.write(' + '.join(makeStepY(step, y) for y in range(n_ingredients)) + ' = ' + str(step + 1) + '\\n')\n", - "for y in range(n_ingredients):\n", - " for step in range(n_ingredients - 1):\n", - " f.write(makeStepY(step+1, y) + ' - ' + makeStepY(step, y) + ' >= 0\\n')\n", - "for r, recipe in enumerate(recipes):\n", - " for step in range(n_ingredients):\n", - " tot = ' - '.join(makeStepY(step, y) for y in recipe)\n", - " f.write(makeStepR(step, r) + ' - ' + tot + ' >= -' + str(len(recipe) - 1) + '\\n')\n", - " for y in recipe:\n", - " f.write(makeStepR(step, r) + ' - ' + makeStepY(step, y) + ' <= 0\\n')\n", - "f.write('Binary\\n')\n", - "f.write(' '.join(makeStepY(step, y) \n", - " for step in range(n_ingredients) for y in range(n_ingredients)))\n", - "f.write(' ')\n", - "f.write(' '.join(makeStepR(step, r) \n", - " for step in range(n_ingredients) for r in range(len(recipes))))\n", - "f.write('\\nEnd\\n')\n", - "f.close()" - ] + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] }, { "cell_type": "code", - "execution_count": 164, + "execution_count": 192, "metadata": {}, "outputs": [ { @@ -114,7 +92,7 @@ "(50, 50)" ] }, - "execution_count": 164, + "execution_count": 192, "metadata": {}, "output_type": "execute_result" } @@ -152,7 +130,7 @@ }, { "cell_type": "code", - "execution_count": 166, + "execution_count": 193, "metadata": {}, "outputs": [ { @@ -166,47 +144,47 @@ "5. Gin | Long Island Iced Tea, Gin Fizz, John Collins, White Lady\n", "6. Cognac | Horse's Neck, Sidecar, Between the Sheets\n", "7. Galliano | Yellow Bird, Golden Dream, Harvey Wallbanger\n", - "8. Cherry liqueur | Aviation, Hemingway Special\n", - "9. Grenadine | Bacardi, Tequila Sunrise, Mary Pickford\n", + "8. Grenadine | Bacardi, Tequila Sunrise\n", + "9. Cherry liqueur | Aviation, Mary Pickford, Hemingway Special\n", "10. Bourbon | Whiskey Sour, Mint Julep\n", "11. Champagne | Mimosa, French 75\n", "12. Angostura bitters | Old Fashioned, Champagne Cocktail\n", - "13. DiSaronno | God Mother, French Connection\n", - "14. Dark rum | Planter's Punch, Dark 'n' Stormy\n", - "15. Dry vermouth | Dirty Martini, Dry Martini\n", + "13. Dry vermouth | Dirty Martini, Dry Martini\n", + "14. DiSaronno | God Mother, French Connection\n", + "15. Dark rum | Planter's Punch, Dark 'n' Stormy\n", "16. Coffee liqueur | Espresso Martini, Black Russian\n", - "17. Créme de Cacao | Alexander\n", - "18. Créme de Menthe | Grasshopper, Stinger\n", - "19. Irish whiskey | Irish Coffee\n", - "20. Peach bitters | Derby\n", - "21. Créme de Cassis | Russian Spring Punch\n", + "17. Créme de Menthe | Stinger\n", + "18. Créme de Cacao | Grasshopper, Alexander\n", + "19. Pisco | Pisco Sour\n", + "20. Créme de Cassis | Russian Spring Punch\n", + "21. Dry white wine | Kir\n", "22. Cachaca | Caipirinha\n", - "23. Pisco | Pisco Sour\n", - "24. Blackberry liqueur | Bramble\n", - "25. Peach schnapps | Sex on the Beach\n", - "26. Prosecco | Barracuda\n", - "27. Red Port | Porto Flip\n", + "23. Peach bitters | Derby\n", + "24. Peach schnapps | Sex on the Beach\n", + "25. Absinthe | Monkey Gland\n", + "26. Apricot brandy | Paradise\n", + "27. Prosecco | Barracuda\n", "28. Raspberry syrup | Clover Club\n", - "29. Dry White Wine | Kir\n", - "30. Sweet vermouth | \n", - "31. Campari | Negroni, Americano\n", - "32. Absinthe | Monkey Gland\n", - "33. Peychaud's bitters | Sazerac\n", - "34. Aperol | Spritz Veneziano\n", - "35. Scotch | God Father\n", - "36. Peach puree | Bellini\n", - "37. Orange Bitters | Casino\n", - "38. Lillet Blonde | Vesper\n", + "29. Campari | \n", + "30. Sweet vermouth | Negroni, Americano\n", + "31. Rye | Manhattan\n", + "32. Red Port | Porto Flip\n", + "33. Blackberry liqueur | Bramble\n", + "34. Irish whiskey | Irish Coffee\n", + "35. Peach puree | Bellini\n", + "36. Orgeat | Mai-tai\n", + "37. Scotch | God Father\n", + "38. Orange bitters | Casino\n", "39. Drambuie | Rusty Nail\n", - "40. DOM Bénédictine | Singapore Sling\n", - "41. Cream liqueur | B52\n", - "42. Apricot brandy | Paradise\n", - "43. Calvados | Angel Face\n", - "44. Raspberry liqueur | French Martini\n", - "45. Rye | Manhattan\n", + "40. Peychaud's bitters | Sazerac\n", + "41. Calvados | Angel Face\n", + "42. Aperol | Spritz Veneziano\n", + "43. DOM Bénédictine | Singapore Sling\n", + "44. Cream liqueur | B52\n", + "45. Lillet Blonde | Vesper\n", "46. Maraschino | Tuxedo\n", - "47. Orgeat | Mai-tai\n", - "48. Orange flower water | Ramos Fizz\n", + "47. Orange flower water | Ramos Fizz\n", + "48. Raspberry liqueur | French Martini\n", "49. Strawberry syrup | \n", "50. Kirsch | Rose\n" ] |