Description
Instructions for Handing In Homework
Formulate the following problems in GAMS and solve them. Submit this assignment electronically using the instructions on the course web page. You should hand in a single zip file
containing exactly 8 files with the following names:
hw2-1.gms, hw2-2.txt, hw2-2.gms, hw2-2.txt, hw2-3.gms, hw2-3.txt, hw2-4.gms,
hw2-4.txt.
Use an editor to extract the required lines of output to the correspondingly names “txt”
files, namely the model and solution status, the optimal values for the variables and the optimal value of the objective function. Ensure you use self-explanatory variable and equation
names.
1 Weasley’s Wizard Wheezes
You are in charge of an advertising campaign for Fred and George Weasley, who have invented a new brand of love potion, and they have given you a budget of 1 million galleons.
You can advertise on wizard TV or in magazines. One minute of TV costs 20,000 Galleons
and reaches 1.8 million potential wizarding customers; a magazine page (in the Quibbler)
costs 10,000 galleons and reaches 1 million. You must sign up for at least 10 minutes of TV
time.
1.1 Problem
How should you spend your budget to maximize your audience? Formulate the problem in
GAMS and solve it.
1.2 Problem
It takes creative talent to create effective advertising; in your organization it takes three
wizard-weeks to create a magazine page, and one wizard-week to create a TV minute. You
have only 100 wizard-weeks available. Add this contraint to the model and determine how
you should spend your budget.
1.3 Problem
Radio advertising reaches a quarter million wizards per minute, costs 2,000 galleons/per
minute and requires only 1 wizard-day of time. How does this medium affect your solutions?
1.4 Problem
How does the solution change if you have to sign up for at least two magazine pages? A
maximum of 120 minutes of radio?
You should be able to use one GAMS file for this entire problem, containing several models. In some cases you may want to fix a subset of the variables to zero. When answering the
questions, include the solution report for each model.
Problem 2 Page 1
CS635 Problem Set #2 Prof. Michael Ferris
2 Manufacturing transistors
Silicon Valley Corporation (Silvco) manufactures transistors. An important aspect of the
manufacturing process is the melting of the element germanium in a furnace. Unfortunately,
the melting process yields germanium of highly variable quality. The results of the process
can be classified into five grades: “defective”, “grade 1”, “grade 2”, “grade 3”, and “grade 4”.
Two methods can be used to do the melting. Method 1 costs $50 per transistor, and method
2 costs $70 per transistor. The qualities of germanium produced by the melting are shown
in the following table (as percentage yields).
method1 method2
defective 30 20
grade1 30 20
grade2 20 25
grade3 15 20
grade4 5 15
Silvco can refire melted germanium in an attempt to improve its quality. It costs $25
to refire the melted germanium for one transistor. The results of the refiring process are
shown in the table below. For example, if grade 3 germanium is refired, half of the resulting
germanium will still be grade 3 while the other half will be grade 4.
defective grade1 grade2 grade3 grade4
defective 30 25 15 20 10
grade1 30 30 20 20
grade2 40 30 30
grade3 50 50
Silvco has sufficient furnace capacity to melt or refire germanium for at most 20,000
transistors per month. Silvco’s monthly demands are for 1000 grade-4 transistors, 2000
grade-3 transistors, 3000 grade-2 transistors, and 3000 grade-1 transistors.
2.1 Problem
Assuming that just one stage of refiring is allowed, model the melting/refiring process and
determine the minimum cost of germanium processing required to meet the demands.
3 Wand Making
Awesome Optimizing Wizard that you are, Dumbledore has approached you to make wands
for the wizarding community. Dumbledore would like for you to make quantities of two types
of wands that require different types of magical components.
Each Hufflepuff wand requires one phoenix tail feather and 2 feet of olive wood. Each
Gryffindor wand requires 3 phoenix tail feathers and 2 feet of olive wood. You have 200 tail
feathers and 300 feet of wood at your disposal.
Your objective in making the wands is to maximize the total magic produced. Each Hufflepuff wand counts for one unit of magic, and each Gryffindor wand will bring 2 units of
magic. Dumbledore has decreed that at most 60 Gryffindor wands can be made.
Problem 3 Page 2
CS635 Problem Set #2 Prof. Michael Ferris
3.1 Problem
Write a GAMS model to maximize the magic in the wands produced.
4 Funding Hogwarts
Dumbledore needs some more Galleons, so he wants to expand his wand operation. he’s now
doing it for profit, and he has decided to produce more than two types of wands. Dumbledore
may know magic, but he doesn’t know linear programming, so he needs your help. With the
help of the Hogwarts staff, Dumbledore has collected the following information:
• W : Set of wands that may be built.
• C : Set of magic components required to build wands.
• acw: It requires acw units of magic component c ∈ C to produce one wands fixtuof type
w ∈ W.
• bc: Hogwarts has an inventory of bc units of magical component c ∈ C.
• gw: The galleons obtained by producing one wand of type w ∈ W
• uw: The maximum number of wands of type w ∈ W that can be produced
• `w: The minimum number of wands of type w ∈ W that must be produced
4.1 Problem
Write a GAMS model that maximizes the number of Galleons from wand production. Use
the code below to create the final instance that you solve and turn in. Also experiment
with solving different sized-instances, and in using different solvers. Use option lp=, and
summarize the results of your experiments.
$setglobal NUM_WANDS 1000
$setglobal NUM_COMPONENTS 100
$setglobal DENSITY_CONTROL 0.05
sets
W Wands /wand1*wand%NUM_WANDS%/
C Components /component1*component%NUM_COMPONENTS%/
;
parameters
b(C) Number of components on hand
g(W) Galleons per wand
a(C,W) Number of c requried to make w
u(W) Max number of wands to make
ell(W) Min number of wans to make
;
scalars
alpha / %DENSITY_CONTROL% /
;
Problem 4 Page 3
CS635 Problem Set #2 Prof. Michael Ferris
b(C) = round(uniform(5000,10000)) ;
g(W) = uniform(5,30) ;
a(C,W) = 1$(uniform(0,1) < alpha) + 1$(uniform(0,1) < alpha) ;
ell(W) = round(uniform(5,20)) ;
u(W) = round(uniform(50,100)) ;
Problem 4 Page 4