You are on page 1of 39

Diet Problem

 A low-cost diet that would meet the nutritional


needs of a specific person.

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
2

 A low-cost diet that would meet the nutritional


needs of a specific person.

 Different foods
 bread, milk, cheese, potato, fish, yogurt

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
3

 A low-cost diet that would meet the nutritional


needs of a specific person.

 Different foods
 bread, milk, cheese, potato, fish, yogurt

 With different contents


 fat, protein, carbohydrate, calorie

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
4

 A low-cost diet that would meet the nutritional


needs of a specific person.

 Different foods
 bread, milk, cheese, potato, fish, yogurt

 With different contents


 fat, protein, carbohydrate, calorie

Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150


fat (g) 1 5 9 0.1 7 1 ≤ 80
Carbohydrate (g) 15 11.7 0.4 22.6 0 17 ≥ 100
Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
5

 How make a diet of foods


 respecting the content constraints,
 to minimize the diet cost.

Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150


fat (g) 1 5 9 0.1 7 1 ≤ 80
Carbohydrate (g) 15 11.7 0.4 22.6 0 17 ≥ 100
Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
6

What are the decision variables?

Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150


fat (g) 1 5 9 0.1 7 1 ≤ 80
Carbohydrate (g) 15 11.7 0.4 22.6 0 17 ≥ 100
Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
7

𝑥𝑥𝑖𝑖 : The amount of food type 𝑖𝑖 to consider in the diet.

𝑥𝑥1 𝑥𝑥2 𝑥𝑥3 𝑥𝑥4 𝑥𝑥5 𝑥𝑥6


Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150


fat (g) 1 5 9 0.1 7 1 ≤ 80
Carbohydrate (g) 15 11.7 0.4 22.6 0 17 ≥ 100
Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
8

min 2𝑥𝑥1 + 3.5𝑥𝑥2 + 8𝑥𝑥3 + 1.5𝑥𝑥4 + 11𝑥𝑥5 + 𝑥𝑥6 Minimization of


total cost

𝑥𝑥1 𝑥𝑥2 𝑥𝑥3 𝑥𝑥4 𝑥𝑥5 𝑥𝑥6


Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150


fat (g) 1 5 9 0.1 7 1 ≤ 80
Carbohydrate (g) 15 11.7 0.4 22.6 0 17 ≥ 100
Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
9

90𝑥𝑥1 + 120𝑥𝑥2 + 106𝑥𝑥3 + 97𝑥𝑥4 + 130𝑥𝑥5 + 180𝑥𝑥6 ≥ 200 Calories

𝑥𝑥1 𝑥𝑥2 𝑥𝑥3 𝑥𝑥4 𝑥𝑥5 𝑥𝑥6


Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150


fat (g) 1 5 9 0.1 7 1 ≤ 80
Carbohydrate (g) 15 11.7 0.4 22.6 0 17 ≥ 100
Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
10

15𝑥𝑥1 + 11.7𝑥𝑥2 + 0.4𝑥𝑥3 + 22.6𝑥𝑥4 + 0𝑥𝑥5 + 17𝑥𝑥6 ≥ 100 Carbohydrate

𝑥𝑥1 𝑥𝑥2 𝑥𝑥3 𝑥𝑥4 𝑥𝑥5 𝑥𝑥6


Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150


fat (g) 1 5 9 0.1 7 1 ≤ 80
Carbohydrate (g) 15 11.7 0.4 22.6 0 17 ≥ 100
Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
11

𝑥𝑥1 + 5𝑥𝑥2 + 9𝑥𝑥3 + 0.1𝑥𝑥4 + 7𝑥𝑥5 + 𝑥𝑥6 ≤ 80 Fat

𝑥𝑥1 𝑥𝑥2 𝑥𝑥3 𝑥𝑥4 𝑥𝑥5 𝑥𝑥6


Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150


fat (g) 1 5 9 0.1 7 1 ≤ 80
Carbohydrate (g) 15 11.7 0.4 22.6 0 17 ≥ 100
Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
12

4𝑥𝑥1 + 8𝑥𝑥2 + 7𝑥𝑥3 + 1.3𝑥𝑥4 + 8𝑥𝑥5 + 9.2𝑥𝑥6 ≥ 150 Protein

𝑥𝑥1 𝑥𝑥2 𝑥𝑥3 𝑥𝑥4 𝑥𝑥5 𝑥𝑥6


Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150


fat (g) 1 5 9 0.1 7 1 ≤ 80
Carbohydrate (g) 15 11.7 0.4 22.6 0 17 ≥ 100
Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
13

𝑥𝑥1 ≥ 0
𝑥𝑥2 ≥ 0
𝑥𝑥3 ≥ 0
𝑥𝑥4 ≥ 0
𝑥𝑥5 ≥ 0
𝑥𝑥6 ≥ 0

𝑥𝑥1 𝑥𝑥2 𝑥𝑥3 𝑥𝑥4 𝑥𝑥5 𝑥𝑥6


Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150


fat (g) 1 5 9 0.1 7 1 ≤ 80
Carbohydrate (g) 15 11.7 0.4 22.6 0 17 ≥ 100
Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
14

 What if we have many different types of foods?

Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150


fat (g) 1 5 9 0.1 7 1 ≤ 80
Carbohydrate (g) 15 11.7 0.4 22.6 0 17 ≥ 100
Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
15

 What if we have many different types of foods?

 How would you write the objective function if we have 100 food types?

Different foods

Bread … Yogurt Constraints

protein (g) 4 … 7 ≥ 150


fat (g) 1 … 9 ≤ 80
Carbohydrate (g) 15 … 0.4 ≥ 100
Calories 90 … 106 ≥ 200
Cost ($/unit) 2 … 8 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
16

 What if we have many different types of foods?

 How would you write the objective function if we have 100 food types?

min 2𝑥𝑥1 + 3.5𝑥𝑥2 + 8𝑥𝑥3 + 1.5𝑥𝑥4 + 11𝑥𝑥5 + 𝑥𝑥6 + 4.7𝑥𝑥7 + 12𝑥𝑥8 + 14𝑥𝑥9
+ 21𝑥𝑥10 + 4.1𝑥𝑥11 + 8.3𝑥𝑥12 + 6𝑥𝑥13 + 23𝑥𝑥14 + 12.4𝑥𝑥15 + 𝑥𝑥16 + 3.5𝑥𝑥17 + 8𝑥𝑥18
+ 1.5𝑥𝑥19 + 11𝑥𝑥20 + 𝑥𝑥21 + 3.5𝑥𝑥22 + 8𝑥𝑥23 + 1.5𝑥𝑥24 + 11𝑥𝑥25 + 𝑥𝑥26 + 3.5𝑥𝑥27
+ 8𝑥𝑥28 + 1.5𝑥𝑥29 + 11𝑥𝑥30 + 𝑥𝑥31 + 3.5𝑥𝑥32 + 17.23𝑥𝑥33 + 1.5𝑥𝑥34 + 71𝑥𝑥35
+ 𝑥𝑥36 + 3.5𝑥𝑥37 + 8𝑥𝑥38 + 1.8𝑥𝑥39 + 11𝑥𝑥40 + 𝑥𝑥41 + 3.5𝑥𝑥42 + 8𝑥𝑥43 + 1.5𝑥𝑥44
+ 19𝑥𝑥45 + 𝑥𝑥46 + 3.5𝑥𝑥47 + 8𝑥𝑥48 + 1.7𝑥𝑥49 + 43𝑥𝑥50 + ⋯

Different foods

Bread … Yogurt Constraints

protein (g) 4 … 7 ≥ 150


fat (g) 1 … 9 ≤ 80
Carbohydrate (g) 15 … 0.4 ≥ 100
Calories 90 … 106 ≥ 200
Cost ($/unit) 2 … 8 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
17

 What if we have many different types of foods?

 How would you write the objective function if we have 100 food types?
100

min � 𝑐𝑐𝑖𝑖 𝑥𝑥𝑖𝑖


𝑖𝑖=1

Different foods

Bread … Yogurt Constraints

protein (g) 4 … 7 ≥ 150


fat (g) 1 … 9 ≤ 80
Carbohydrate (g) 15 … 0.4 ≥ 100
Calories 90 … 106 ≥ 200
Cost ($/unit) 2 … 8 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
18

 What if we have many different types of foods?

 How would you write the objective function if we have 100 food types?
100

min � 𝑐𝑐𝑖𝑖 𝑥𝑥𝑖𝑖


𝑖𝑖=1

This is a parameter
Means that it is given as data (input) to our model.

Different foods

Bread … Yogurt Constraints

protein (g) 4 … 7 ≥ 150


fat (g) 1 … 9 ≤ 80
Carbohydrate (g) 15 … 0.4 ≥ 100
Calories 90 … 106 ≥ 200
Cost ($/unit) 2 … 8 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
19

 What if we have many different types of foods?

 How would you write the objective function if we have 100 food types?
100

min � 𝑐𝑐𝑖𝑖 𝑥𝑥𝑖𝑖 This is a decision variable


𝑖𝑖=1
Means that the value is
unknown. We have to decide
about it.
This is a parameter
Means that it is given as data (input) to our model.

Different foods

Bread … Yogurt Constraints

protein (g) 4 … 7 ≥ 150


fat (g) 1 … 9 ≤ 80
Carbohydrate (g) 15 … 0.4 ≥ 100
Calories 90 … 106 ≥ 200
Cost ($/unit) 2 … 8 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
20

 What if we have many different types of foods?

 How would you write the objective function if we have 100 food types?
100

min � 𝑐𝑐𝑖𝑖 𝑥𝑥𝑖𝑖


𝑖𝑖=1

Different foods

Bread … Yogurt Constraints

protein (g) 4 … 7 ≥ 150


fat (g) 1 … 9 ≤ 80
Carbohydrate (g) 15 … 0.4 ≥ 100
Calories 90 … 106 ≥ 200
Cost ($/unit) 2 … 8 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
21

 What if we have many different types of foods?

 How would you write the objective function if we have 100 food types?
100

min � 𝑐𝑐𝑖𝑖 𝑥𝑥𝑖𝑖 min � 𝑐𝑐𝑖𝑖 𝑥𝑥𝑖𝑖


𝑖𝑖=1 𝑖𝑖∈𝐼𝐼

Where 𝐼𝐼 = {1, … , 100}.

Different foods

Bread … Yogurt Constraints

protein (g) 4 … 7 ≥ 150


fat (g) 1 … 9 ≤ 80
Carbohydrate (g) 15 … 0.4 ≥ 100
Calories 90 … 106 ≥ 200
Cost ($/unit) 2 … 8 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
22

 What if we have many different types of contents?

Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150


fat (g) 1 5 9 0.1 7 1 ≤ 80
Carbohydrate (g) 15 11.7 0.4 22.6 0 17 ≥ 100
Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
23

 What if we have many different types of contents?

Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150




Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
24

 What if we have many different types of contents?

Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150




Content 𝒋𝒋 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 ≤ ≤ 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚



Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
25

 What if we have many different types of contents?

 How would you write the constraints for 1000 types of contents?

Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150




Content 𝒋𝒋 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 ≤ ≤ 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚



Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
26

 What if we have many different types of contents?

 How would you write the constraints for 1000 types of contents?
4𝑥𝑥1 + 8𝑥𝑥2 + 7𝑥𝑥3 + 1.3𝑥𝑥4 + 8𝑥𝑥5 + 9.2𝑥𝑥6 ≥ 150 Protein

Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150




Content 𝒋𝒋 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 ≤ ≤ 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚



Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
27

 What if we have many different types of contents?

 How would you write the constraints for 1000 types of contents?
4𝑥𝑥1 + 8𝑥𝑥2 + 7𝑥𝑥3 + 1.3𝑥𝑥4 + 8𝑥𝑥5 + 9.2𝑥𝑥6 ≥ 150 Protein

… ≥... Content 2

Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150




Content 𝒋𝒋 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 ≤ ≤ 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚



Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
28

 What if we have many different types of contents?

 How would you write the constraints for 1000 types of contents?
4𝑥𝑥1 + 8𝑥𝑥2 + 7𝑥𝑥3 + 1.3𝑥𝑥4 + 8𝑥𝑥5 + 9.2𝑥𝑥6 ≥ 150 Protein

… ≥... Content 2


… ≥... Content 1000

Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150




Content 𝒋𝒋 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 ≤ ≤ 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚



Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
29

 What if we have many different types of contents?

 How would you write the constraints for 1000 types of contents?

𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 ≤ � 𝑎𝑎𝑗𝑗𝑗𝑗 𝑥𝑥𝑖𝑖 ≤ 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 𝑗𝑗 ∈ {1, … , 1000}


𝑖𝑖=1

Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150




Content 𝒋𝒋 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 ≤ ≤ 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚



Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
30

 What if we have many different types of contents?

 How would you write the constraints for 1000 types of contents?

𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 ≤ � 𝑎𝑎𝑗𝑗𝑗𝑗 𝑥𝑥𝑖𝑖 ≤ 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 𝑗𝑗 ∈ 𝐽𝐽


𝑖𝑖=1
The set of
contents
Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150




Content 𝒋𝒋 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 ≤ ≤ 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚



Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
31

 What if we have many different types of contents?

 How would you write the constraints for 1000 types of contents?

This is the number of food types


6

𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 ≤ � 𝑎𝑎𝑗𝑗𝑗𝑗 𝑥𝑥𝑖𝑖 ≤ 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 𝑗𝑗 ∈ 𝐽𝐽


𝑖𝑖=1

Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150




Content 𝒋𝒋 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 ≤ ≤ 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚



Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
32

 What if we have many different types of contents?

 How would you write the constraints for 1000 types of contents?

𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 ≤ � 𝑎𝑎𝑗𝑗𝑗𝑗 𝑥𝑥𝑖𝑖 ≤ 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 𝑗𝑗 ∈ 𝐽𝐽


𝑖𝑖∈𝐼𝐼

Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150




Content 𝒋𝒋 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 ≤ ≤ 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚



Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
33

 What if we have many different types of contents?

 How would you write the constraints for 1000 types of contents?

𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 ≤ � 𝑎𝑎𝑗𝑗𝑗𝑗 𝑥𝑥𝑖𝑖 ≤ 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 𝑗𝑗 ∈ 𝐽𝐽


𝑖𝑖∈𝐼𝐼

Different foods

Bread Milk Cheese Potato Fish Yogurt Constraints

protein (g) 4 8 7 1.3 8 9.2 ≥ 150




Content 𝒋𝒋 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑗 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 ≤ ≤ 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚



Calories 90 120 106 97 130 180 ≥ 200
Cost ($/unit) 2 3.5 8 1.5 11 1 To be Minimize!

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
34

Compact formulation: min � 𝑐𝑐𝑖𝑖 𝑥𝑥𝑖𝑖


𝑖𝑖∈𝐼𝐼
6

𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 ≤ � 𝑎𝑎𝑗𝑗𝑗𝑗 𝑥𝑥𝑖𝑖 ≤ 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 𝑗𝑗 ∈ 𝐽𝐽


𝑖𝑖∈𝐼𝐼

𝑥𝑥𝑖𝑖 ≥ 0 𝑖𝑖 ∈ 𝐼𝐼

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
35

Inputs
- 𝐼𝐼: The set of foods
- 𝐽𝐽: The set of contents
-𝑐𝑐𝑖𝑖 : Per unit cost of food 𝑖𝑖.
-𝑎𝑎𝑗𝑗𝑗𝑗 : The amount of content
𝑗𝑗 in one unit of food 𝑖𝑖.
-𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 : The maximum amount of
content 𝑗𝑗 in the diet.
-𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 : The minimum amount of
content 𝑗𝑗 in the diet.

Diet problem
- Choose a combination of different foods such that
- The constraints on the minimum and maximum values of contents are respected.
- The total cost to make the diet is minimized.

Hossein Hashemi Doulabi Mathematical Modeling Concordia University


Diet Problem
36

min Total cost


Subject to:
For each content, the maximum and minimum limit must be respected.

𝑥𝑥𝑖𝑖 can take non-negative values.

Decision Variable
𝑥𝑥𝑖𝑖 = The amount of food type 𝑖𝑖 to consider in the diet.

Inputs
- 𝐼𝐼: The set of foods
- 𝐼𝐼: The set of contents
-𝑐𝑐𝑖𝑖 : Per unit cost of food 𝑖𝑖.
-𝑎𝑎𝑗𝑗𝑗𝑗 : The amount of content 𝑗𝑗 in one unit of food 𝑖𝑖.
-𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 : The maximum amount of content 𝑗𝑗 in the diet.
-𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 : The minimum amount of content 𝑗𝑗 in the diet.
Hossein Hashemi Doulabi Mathematical Modeling Concordia University
Diet Problem
37

min � 𝑐𝑐𝑖𝑖 𝑥𝑥𝑖𝑖


𝑖𝑖∈𝐼𝐼
Subject to:
For each content, the maximum and minimum limit must be respected.

𝑥𝑥𝑖𝑖 can take non-negative values.

Decision Variable
𝑥𝑥𝑖𝑖 = The amount of food type 𝑖𝑖 to consider in the diet.

Inputs
- 𝐽𝐽: The set of foods
- 𝐽𝐽: The set of contents
-𝑐𝑐𝑖𝑖 : Per unit cost of food 𝑖𝑖.
-𝑎𝑎𝑗𝑗𝑗𝑗 : The amount of content 𝑗𝑗 in one unit of food 𝑖𝑖.
-𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 : The maximum amount of content 𝑗𝑗 in the diet.
-𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 : The minimum amount of content 𝑗𝑗 in the diet.
Hossein Hashemi Doulabi Mathematical Modeling Concordia University
Diet Problem
38

min � 𝑐𝑐𝑖𝑖 𝑥𝑥𝑖𝑖


𝑖𝑖∈𝐼𝐼
Subject to: 6

𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 ≤ � 𝑎𝑎𝑗𝑗𝑗𝑗 𝑥𝑥𝑖𝑖 ≤ 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 𝑗𝑗 ∈ 𝐽𝐽


𝑖𝑖∈𝐼𝐼
𝑥𝑥𝑖𝑖 can take non-negative values.

Decision Variable
𝑥𝑥𝑖𝑖 = The amount of food type 𝑖𝑖 to consider in the diet.

Inputs
- 𝐼𝐼: The set of foods
- 𝐽𝐽: The set of contents
-𝑐𝑐𝑖𝑖 : Per unit cost of food 𝑖𝑖.
-𝑎𝑎𝑗𝑗𝑗𝑗 : The amount of content 𝑗𝑗 in one unit of food 𝑖𝑖.
-𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 : The maximum amount of content 𝑗𝑗 in the diet.
-𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 : The minimum amount of content 𝑗𝑗 in the diet.
Hossein Hashemi Doulabi Mathematical Modeling Concordia University
Diet Problem
39

min � 𝑐𝑐𝑖𝑖 𝑥𝑥𝑖𝑖


𝑖𝑖∈𝐼𝐼
Subject to: 6

𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 ≤ � 𝑎𝑎𝑗𝑗𝑗𝑗 𝑥𝑥𝑖𝑖 ≤ 𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 𝑗𝑗 ∈ 𝐽𝐽


𝑖𝑖∈𝐼𝐼

𝑥𝑥𝑖𝑖 ≥ 0 𝑖𝑖 ∈ 𝐼𝐼

Decision Variable
𝑥𝑥𝑖𝑖 = The amount of food type 𝑖𝑖 to consider in the diet.

Inputs
- 𝐼𝐼: The set of foods
- 𝐽𝐽: The set of contents
-𝑐𝑐𝑖𝑖 : Per unit cost of food 𝑖𝑖.
-𝑎𝑎𝑗𝑗𝑗𝑗 : The amount of content 𝑗𝑗 in one unit of food 𝑖𝑖.
-𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 : The maximum amount of content 𝑗𝑗 in the diet.
-𝑎𝑎𝑗𝑗𝑚𝑚𝑚𝑚𝑚𝑚 : The minimum amount of content 𝑗𝑗 in the diet.
Hossein Hashemi Doulabi Mathematical Modeling Concordia University

You might also like