Question: dynamic programming?

This problem has real world applicability: Three vampires and three maidens are at the foot of a tall building and wish to get to the bar on the top floor.  The lift only holds two people (for convenience I am classing vampires as people), and needs one person to operate it.  If ever the vampires outnumber the maidens at any place, they will do something unspeakable.  How can the vampires and maidens all safety get to the top in the minimum of moves?  http://tonysmaths.blogspot.com.au/2012/05/vampires-and-maidens-problem.html

can this be solved procedurally or using optimization package?

possible manual soln:

No. m>= No. v

3m+3v, 0   [0]

2m+2v,m+v [1]

3m+2v,v  [2]

     3m, 3v [3]

3m+v , 2v  [4]

m+v  , 2m+2v [5]

#then reverse the steps

2m+2v, m+v [6]

       2v, 3m+v [7]

       3v, 3m  [8]

        v , 3m+2v [9]

    m+v, 2m+2v [10]

        0, 3m+3v [11]

 

Please Wait...