/* Game theory (2 player zero sum game) in Picat. From Taha, Operations Research (8'th edition), page 528. This Picat model was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ % import util. import mip. main => go. go => Game = [[ 3.0, -1.0, -3.0], [-2.0, 4.0, -1.0], [-5.0, -6.0, 2.0]], Rows = Game.length, Cols = Game[1].length, X = new_list(Rows), X :: 0.0..100.0, V :: -2.0..2.0, % For row player: foreach(I in 1..Rows) V - sum([X[J]* Game[J,I] : J in 1..Cols]) #<= 0.0 end, sum(X) #= 1.0, solve($[max(V)], X), println(v=V), println(x=X), nl.