MODEL: ! Two person nonconstant sum game.(BiMatrixGame);
! How much profit player A makes depends upon both
 the choice made by Player A and the choice made by
 Player B. Here we do not assume that the results
 are zero sum. I.e., we do not assume that any
 increase in profit for A corresponds to a decrease 
 in profit for B of exactly same amount.
  This non-constant sum feature is common in
 decisions involving pricing, advertising,
 military actions, etc.;
!  This version uses complementarity constraints, so
  the global solver option should be used. Click on
  LINGO | Options | Global solver | Use Global solver;
! Keywords: Bi-matrix game, Two person game, Mixed strategy,
 Game theory, Non-constant sum game, 
 Complementarity constraints, Prisoner's dilemma;

SETS:
   OPTA: PA, SLKA;
   OPTB: PB, SLKB;
   BXA( OPTB, OPTA): P2A, P2B;
 ENDSETS
DATA: OPTB = BNAD BYAD; ! Player B has two options: No ads or use ads; OPTA = ANAD AMAD AHAD; ! Player A has three options: No ads, Medium ads, or High ads; ! P2A( i, j) = profit to A if B chooses row i, A chooses col j; P2A = 3 2 4 ! BNAD; 1 2 1; ! BYAD; ! P2B( i, j) = profit to B if B chooses row i, A chooses col j; P2B = 4 2 -1 ! BNAD; 5 1 0; ! BYAD; ! Notice that their combined profit will be maximized at 3 + 4 = 7 if B chooses BNAD and A chooses ANAD. Will they in fact make that choice, or will each try to do better? Will they choose a pure strategy or be somewhat unpredictable and choose a mixed strategy? Which player do you think will make more profit? ; ENDDATA !-------------------------------------------------; ! Variables: PA(j) = Prob{ Player A chooses alternative j} PB(i) = Prob{ Player B chooses alternative i} PROFA = expected profit actually obtained by A, PROFB = expected profit actually obtained by B, SLKA(j) = amount by which strategy j of player A falls short of the profit, PROFA, of the strategy actually used by A SLKB(i) = amount by which strategy i of player B falls short of the profit, PROFB, of the strategy actually used by B; ! Conditions for A, A must make a decision; @SUM( OPTA( j): PA( j)) = 1; @FREE( PROFA); ! A might lose money; @FOR( OPTA( j): ! Expected Profit if do j = Actual profit of A - slack if do j; @SUM( OPTB( i): P2A( i, j) * PB( i)) = PROFA - SLKA( j); ! Force SLKA( j) = 0 if strategy j is used, and PA(j) = 0, if j is not most profitable choice; SLKA(j)*PA(j) = 0; ); ! Conditions for B; ! B must make a decision; @SUM( OPTB( i): PB( i)) = 1; @FREE( PROFB); ! B might lose money; @FOR( OPTB( i): ! Profit if do i = Actual profit of B - slack if do i; @SUM( OPTA( j): P2B( i, j) * PA( J)) = PROFB - SLKB(i); ! Force SLKB( I) = 0 if strategy i is used and PB(i) = 0, if i is not most profitable choice; SLKB(i)*PB(i) = 0; ); END