Mathematical Modeling with LPL : Explain and run a Model
Problem Statement
Modeling Description
||
Back to MatMod
model hikers "Who Went Hiking Alone?"; set i,j:=[A B C D E F G H I J K L M N O P Q]; e{i,j} := [(A,*) F G H O , (B,*) A C G H , (C,*) D J K M (D,*) C E P Q , (E,*) D F K O , (F,*) A E G H (G,*) C E F J , (H,*) E F I K , (I,*) A G K L (J,*) G I L P , (K,*) G H L Q , (L,*) J M N O (M,*) A C L N , (N,*) D L O P , (O,*) E L N Q (P,*) D J M N , (Q,*) D K N O]; set k:=[1..4]; binary variable x{i,k}; constraint A{i}: sum{k} x = 1; constraint B{k,e[i,j]}: x[i,k] + x[j,k] <= 1; constraint C: sum{i} x[i,4]=1; constraint D: sum{i} x[i,3]=3; --constraint E: x['I',4]=0; solve; parameter X{i}:=[8 2 0 8 16 14 5 11 8 4 12 8 7 8 9 6.3 9.7]; Y{i}:=[11 11 7 0 7 11 9 9 7 6 6 5 4 2 4 2 2]; Draw.Scale(50,50); {e[i,j]} Draw.Line(X[i],Y[i],X[j],Y[j]); --{i,k|x} Draw.Circle(i&'',X,Y,.3,1,0); {i,k|x} Draw.Circle(i&'',X,Y,.3,k+2,0); end Original version: A group of 17 prisoners - A to Q - have to work in three different hospitals. One day, a grocery store in the neigborhood is robbed. The store owner is absolutely sure that the thief was one of the prisoners. Unfortunately, there is no fixed working schedule, so every prisoner can decide on how own where he wants to work on a certain day. The three hospitals give us the following information: three prisoners worked in the first hospital, six of them worked in the second hospital and seven worked in the last hospital. Adding these numbers shows that one of the prisoners did not work on that day. Since the prisoners don't want to incriminate one of there cell mates, they don't want to tell where and who they worked with on the concerning date. After a long discussion they agree to a compromise: every prisoner names four persons who he didn't work with. This leads to the following Table. \begin{table}[htbp] \centering \caption{Conclusion of the prisoners statements} \begin{tabular}{rrrrrrrr} Prisoner & mentions & & Prisoner & mentions & & Prisoner & mentions \\ A & F, G, H O & & G & C, E, F, J & & M & A, C, L, N \\ B & A, C, G, H & & H & E, F, I, K & & N & D, L, O, P \\ C & D, J, K, M & & I & A, G, K, L & & O & E, L, N, Q \\ D & C, E, P, Q & & J & G, I, L, P & & P & D, J, M, N \\ E & D, F, K, O & & K & G, H, L, Q & & Q & D, K, N, O \\ F & A, E, G, H & & L & J, M, N, O & & & \\ \end{tabular}% \label{tab:addlabel}% \end{table}% Assuming that every prisoner said the truth, is it possible to find the thief?
Problem Statement
Modeling Description
Back to model
The solution is as follows:
The LOG-File output of LPL is as follows: