<jupyter_start><jupyter_text>In this exercise you are making two types (premium and budget) of ice cream, using heavy cream, whole milk, and sugar. One version is a premium version containing more cream than your budget version. You are looking to find the mixture of ingredients that minimizes the total costs of ingredients.Ingredient	cupCream:-     1.5Milk:-      0.125Sugar:-     0.10- Define the objective function using lpSum() with list comprehension and the information in the table above. Iterate over the product types and multiply the dictionary variable by the correct ingredient cost.<jupyter_code>from pulp import *
model = LpProblem('minimize profits', LpMinimize)
# Define Objective Function
cb = LpVariable('A', lowBound=0, cat='Continuous')
mb = LpVariable('B', lowBound=0, cat='Continuous')
sb = LpVariable('C', lowBound=0, cat='Continuous')
cp = LpVariable('D', lowBound=0, cat='Continuous')
mp = LpVariable('E', lowBound=0, cat='Continuous')
sp = LpVariable('F', lowBound=0, cat='Continuous')
var_dict = {('budget', 'cream'): cb,
             ('budget', 'milk'): mb,
             ('budget', 'sugar'): sb,
             ('premium', 'cream'): cp,
             ('premium', 'milk'): mp,
             ('premium', 'sugar'): sp}

prod_type = ['premium','budget']
ingredient = ['cream', 'milk', 'sugar']
model += lpSum([1.5 * var_dict[(i, 'cream')] 
            + 0.125 * var_dict[(i, 'milk')] 
             + 0.10 * var_dict[(i, 'sugar')]
                
                # Iterate over product types
                for i in prod_type])
print(var_dict[('premium','milk')])
print(var_dict[('budget','milk')])
model
model.solve()
list = [cb,mb,sb,cp,mp,sp]
for i in list:
    print( [i.varValue])<jupyter_output>[0.0]
[0.0]
[0.0]
[0.0]
[0.0]
[0.0]
{'fraction_non_alphanumeric': 0.15463331438317227, 'fraction_numerical': 0.02046617396247868, 'mean_word_length': 3.6315789473684212, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '429856', 'license': 'MIT', 'n_tokens_mistral': 607, 'n_tokens_neox': 578, 'n_words': 178, 'path': 'PULP/tutorial/.ipynb_checkpoints/1.3 Trying out lpSum-checkpoint.ipynb', 'repo_name': 'nazmus-shakib-mist-ipe02/Operations-Research-Analytics', 'size': '1759'}