Title: Introduction to Knowledge Engineering
1Introduction to Knowledge Engineering
- Operations Research
- Session 3 part A
- Joris van de Klundert
- j.vandeklundert_at_math.unimaas.nl
2Last weeks exercises
Solve the knapsack problem (that is check the
hackers solution and the optimal solution in the
graph model) Solve the 2 Thieves problem (that
is find an appropriate model and solution
algorithm).
3Solutions to the Knapsack problem
Magic bread Cookies Fish Lollies Gums Nuggets
Glow worms Black worms Red worms
cl
4Knapsack a Hackers solution
Magic bread (11) Cookies (11) Fish Lollies
(7) Gums (7) Nuggets (6) Glow worms (1) Black
worms (1) Red worms (1)
cl
5Knapsack an optimal solution
Magic bread (11) Cookies (11) Fish Lollies
(7) Gums (7) Nuggets (6) Glow worms (1) Black
worms (1) Red worms (1)
cl
62 Thieves (problem statement)
Two thieves are sitting with there stolen
property, which consists of a set items 1,2,3.m,
all watches and jewelry. The thieves know the
value v(i) of each of the items i1,2,m. The
thieves strive to find a division of the set of
items into 2 sets, one for each thief, such that
the sets are of the same value. (the value of a
set is the sum of the values of the items in the
set.) Can you handle (model) this problem for
them?)
7The two thieves problem..
8Interpretation of the model
Define V ?ni1 v(i) V.
V/2
Item i
Thief X gets item i
Thief Y gets item i
v(i)
9Modelling the 2 thieves problem
1 2 3 4 5 . . . .
V/2
1 2 3 . . . n
10Repeat the following step until the yellow vertex
is red
Take any orange node v Consider all blue nodes u,
such that there is an arc from v to u. Eliminate
arc (v,u). If u has no incoming arcs anymore,
change the color of u from blue to orange. Change
the color of v from orange to red.
11Interpretation
- Any path from the red node to the yellow node
correspond to a set of items of total value V/2,
and therefore partitions the set of all items in
2 sets of the same total value! - This problem is called the 2 partitioning
problem. - How many steps does the algorithm take?
- Not more than n V.