Model Description - A Mathematical Modeling Language

How Old Are They? (ages)
Problem
: This algebraic puzzle was found at [2]. It is a nice exercise in decomposing
stepwise the problem.
1. Ten years from now Tim will be twice as old as Jane was when Mary was nine times
as old as Tim.
2. Eight years ago, Mary was half as old as Jane will be, when Jane is one year older
than Tim will be at the time, when Mary will be ve times as old as Tim will be
two years from now.
3. When Tim was one year old, Mary was three years older than Tim will be, when
Jane is three times as old as Mary was six years before the time, when Jane was
half as old as Tim will be, when Mary will be ten years older than Mary was, when
Jane was one-third as old as Tim will be, when Mary will be three times as old as
she was, when Jane was born.
How old are the three persons now?
Modeling Steps
This sort of problem is hard to understand in human language, but it is easy if you write
down a set of equations. Let
Jane was born,
m
t be
the year in which Tim was born,
be the year in which Mary was born, and
indenite years come up, let
y1 , y2 ,
y
j
be the year in which
be the current year. As
etc. be the indenite years.
Let's analyse the rst statement: We have Ten years from now that is
means that the age of Tim in ten years is
y + 10 − t
the year of birth of Tim). Twice as old as Jane this is
unknown year
y1 ,
y + 10.
This
(This year plus ten years minus
2(y1 − j),
this happens in the
which is added as a new variable. Hence, we have the rst constraint:
y + 10 − t = 2(y1 − j)
In words: The age of Tim in ten years is twice the age of Jane, when..., well: when
Mary was nine times as old as Tim.
unknown year
y1 .
Therefore
y1
Hence the year when this happens is again our
is dened by :
y1 − m = 9(y1 − t)
The other statements can be proceeded in a similar way. Try them!
The complete model code in LPL for this model is as follows (see [1]):
Listing 1: The Model
model ages "How Old Are They?";
variable t; j; m; y; y1; y2; y3; y4; y5; y6; y7; y8;
constraint
A: y + 10 - t = 2*(y1 - j);
B: y1 - m = 9*(y1 - t);
C: y - 8 - m = 1/2*(y2 - j);
D: y2 - j = 1 + y3 - t;
E: y3 - m = 5*(y + 2 - t);
1
F: t + 1 - m = 3 + y4 - t;
G: y4 - j = 3*(y5 - 6 - m);
H: y5 - j = 1/2*(y6 - t);
I: y6 - m = 10 + y7 - m;
J: y7 - j = 1/3*(y8 - t);
K: y8 - m = 3*(j - m);
minimize obj: t+j+m;
Write(’Tim is %2.0f \nJane is %2.0f \nMary is %2.0f\n’, y-t,y-j,y-m)
;
end
Solution
: The solution is as follows:
Tim is 3, Jane is 8, and Mary is 15.
A little
grumbling is in order here, as clue number 1 leads to the situation a year and a half ago,
when Tim was 1 1/2, Jane was 6 1/2, and Mary was 13 1/2 years old.
Question
(Answer see )
1. Suppose the current year is
2006.
2. Supposing the current year is
How are the results?
2006, when will Mary be three times as old as her age
dierence from Jane?
Answer
(Question see )
1. Of course the ages of the persons do not change, however the years of birth are now
correspondingly. Add the constraint
y = 2006:
constraint L: y = 2006;
y8 in the model, which is 2012. The age dierence
between Mary and Jane is: m − j . We are looking for an (unknown) year, say y8,
the age of Mary in year y8 is: y8 − m. This must be three times their dierence.
Hence, we have: y8 − m = 3(m − j).
2. We are asking for the variable
References
[1] T. Hürlimann. Reference Manual for the LPL Modelling Language, most recent version.
www.virtual-optima.com.
[2] mathforum.
http://mathforum.org/rec_puzzles_archive/logic/
part1.
2