Back to Homepage
Operations Research
Programming Languages
Course requirements
Lesson 1
Lesson 2
Lesson 3
Lesson 4
Lesson 5
Lesson 6
Lesson 7
Lesson 8
Lesson 9
Lesson 10
Lesson 11
Lesson 12
Lesson 13
Lesson 14

Lesson 12
Practicing for the test


I. Mixed production

A factory can produce Alimunum Sulphite, Barium Fluorite, Calcium Iodide, Deuterium Trioxide, Ethane Phosphate, and Fluoroacetic Acid in 6 different plants. A total of 1000 kg can be produced each day, split between the 6 materials. Each plant can be active for 13 days a month. (A month will last 30 days in this example.) The following table contains the maximum monthly demand, production cost per kg, sell price per kg, min. production batch per day (in kg), and activation cost of each plant:

Alimunum Sulphite Barium Fluorite Calcium Iodide Deuterium Trioxide Ethane Phosphate Fluoroacetic Acid
Maximum monthly demand 3800 3500 4200 2800 3600 4000
Production cost (per kg) 40 35 20 25 28 32
Sell price (per kg) 48 50 30 30 40 45
Min. production batch per day (in kg) 20 50 60 40 30 10
Plant activation cost 3200 2900 4000 3600 3300 3500

Every day, we have to decide whether or not we want to activate, deactivate or keep each plant running. If we decide to activate a plant, the fixed Plant activate cost occurs once. In the case of deactivation or running, no extra cost occurs. A plant can only produce materials while it is active. At the start of the month, they all start as inactive. If a plant is active, it produces at least the amount shown in "Min. production batch per day (in kg)" every day.

Each produced material has a production cost and a sell price per kg. Each produced material has some amount of maximum demand, above which it is impossible to sell as there will be no buyers.

Formulate an XPress Mosel program to find the maximum profit the factory can produce next month! Find which plants were running and for how many days!

II. Multiple cross-value backpacks

We would like to bring 10 people on a tour. We have the following objects:

Object Amount Weight per piece (in kg)
Flashlight 6 0.15
Matchbox 3 0.04
Water bottle 17 1.1
Canned food 34 0.3
Can opener 3 0.05
Pot 2 0.8
Lighter 4 0.03
Plastic plate 50 0.02
Foldable chair 4 4.5
Foldable tent 2 6.8
Tent nail 16 0.01
Hammer 1 2.5

We would like to bring everything with us, but split the weights evenly between all 10 people. (Even the heaviest backpack should be as light as possible.) However each backpack should contain items that are useful together. The total cross-value of each backpack should be at least 400. (The cross-value of the backpack is the sum of the cross-value of each pair of object the backpack contains.)

The table of cross-values is the following:

Flashlight Matchbox Water bottle Canned food Can opener Pot Lighter Plastic plate Foldable chair Foldable tent Tent nail Hammer
Flashlight 0 0 0 0 0 0 0 0 0 3 1 1
Matchbox 0 0 2 3 1 7 0 0 0 0 0 0
Water bottle 0 2 0 4 2 6 1 2 0 0 0 0
Canned food 0 3 4 2 8 4 3 7 2 1 0 0
Can opener 0 1 2 8 0 0 0 1 0 0 0 0
Pot 0 7 6 4 0 0 7 2 0 0 0 0
Lighter 0 0 1 3 0 7 0 0 0 0 0 0
Plastic plate 0 0 2 7 1 2 0 0 2 1 0 0
Foldable chair 0 0 0 2 0 0 0 2 0 3 0 2
Foldable tent 3 0 0 1 0 0 0 1 3 0 8 2
Tent nail 1 0 0 0 0 0 0 0 0 8 1 8
Hammer 1 0 0 0 0 0 0 0 2 2 8 0

Download the multiCrossValue.dat Data file from here

Formulate an XPress Mosel program and print out what each backpack should contain to fulfil the condition(s) and spread the weights equally (as much as possible)!

III. Nutrient decay

At every point in time, the human body requires the following nutrients:

Nutrient Min. amount (kg // mg for Vitamins)
Water 3
Lipids 2.5
Protein 1.5
Carbohydrates 2
Vitamin C 40
Vitamin A 30
Vitamin B12 35

These nutrients decay in the following rate:

Nutrient Decay per hour (kg // mg for Vitamins)
Water 0.25
Lipids 0.11
Protein 0.1
Carbohydrates 0.14
Vitamin C 2.5
Vitamin A 2
Vitamin B12 2

Taylor has the following options to eat / drink every hour:

Food Weight (kg) Contains (kg // mg for Vitamins)
Water 1 Water (1)
Fruits 1 Water (0.7), Carbohydrates (0.1), Vitamin C (30), Vitamin A (10)
Vegetables 1 Water (0.5), Carbohydrates (0.3), Lipids (0.1), Vitamin C (20), Vitamin A (15)
Meats 1 Water (0.2), Carbohydrates (0.3), Protein (0.3), Lipids (0.3), Vitamin B12 (15)
Grains 1 Carbohydrates (0.8), Vitamin A (10)
Sweets 1 Lipids (0.7), Carbohydrates (0.2)
Milk products 1 Water (0.5), Protein (0.25), Lipids (0.2), Carbohydrates (0.05), Vitamin C (10)

Taylor can only choose to eat one of each of these every hour. Taylor has a maximum stomach capacity of 4 kg per 24 hours. Additionally, Taylor is sleeping from 9 PM to 8 AM every day, during which no food can be consumed.

Additonally, Taylor starts Monday 8 AM with the following nutrients:

Nutrient Starting value (kg // mg for Vitamins)
Water 32
Lipids 15
Proteins 16
Carbohydrates 20
Vitamin C 324
Vitamin A 288
Vitamin B12 306

Create an XPress Mosel program to plan out what Taylor should consume every hour from Monday 8 AM to Sunday 8 PM! (Every hour, choose either one of the listed foods or nothing.) Make sure that every hour, Taylor has the minimum required nutrients. Make sure that Taylor doesn't overeat. Don't forget about the decay of nutrients and not being able to eat while Taylor is sleeping!