randn('state',0);
n = 10;
m = 10;
P = randn(n,m);
fprintf(1,'Computing the optimal strategy for player 1 ... ');
cvx_begin
variable u(n)
minimize ( max ( P'*u) )
u >= 0;
ones(1,n)*u == 1;
cvx_end
fprintf(1,'Done! \n');
obj1 = cvx_optval;
fprintf(1,'Computing the optimal strategy for player 2 ... ');
cvx_begin
variable v(m)
maximize ( min (P*v) )
v >= 0;
ones(1,m)*v == 1;
cvx_end
fprintf(1,'Done! \n');
obj2 = cvx_optval;
disp('------------------------------------------------------------------------');
disp('The optimal strategies for players 1 and 2 are respectively: ');
disp([u v]);
disp('The expected payoffs for player 1 and player 2 respectively are: ');
[obj1 obj2]
disp('They are equal as expected!');
Computing the optimal strategy for player 1 ...
Calling sedumi: 21 variables, 11 equality constraints
For improved efficiency, sedumi is solving the dual problem.
------------------------------------------------------------
SeDuMi 1.21 by AdvOL, 2005-2008 and Jos F. Sturm, 1998-2003.
Alg = 2: xz-corrector, Adaptive Step-Differentiation, theta = 0.250, beta = 0.500
Split 1 free variables
eqs m = 11, order n = 23, dim = 23, blocks = 1
nnz(A) = 140 + 0, nnz(ADA) = 121, nnz(L) = 66
it : b*y gap delta rate t/tP* t/tD* feas cg cg prec
0 : 7.35E+00 0.000
1 : -3.40E-01 3.21E+00 0.000 0.4368 0.9000 0.9000 2.45 1 1 5.7E+00
2 : -3.22E-02 1.48E+00 0.000 0.4622 0.9000 0.9000 4.31 1 1 1.2E+00
3 : -2.23E-02 4.55E-01 0.000 0.3066 0.9000 0.9000 1.55 1 1 3.2E-01
4 : -2.93E-02 1.22E-01 0.000 0.2688 0.9000 0.9000 1.09 1 1 7.8E-02
5 : -2.82E-02 2.40E-02 0.000 0.1962 0.9000 0.9000 1.06 1 1 1.6E-02
6 : -2.79E-02 4.59E-03 0.000 0.1912 0.9000 0.9000 1.02 1 1 3.0E-03
7 : -2.79E-02 3.05E-05 0.000 0.0066 0.9990 0.9820 1.00 1 1
iter seconds digits c*x b*y
7 0.0 14.9 -2.7855878954e-02 -2.7855878954e-02
|Ax-b| = 2.4e-16, [Ay-c]_+ = 1.4E-16, |x|= 1.1e+00, |y|= 4.4e-01
Detailed timing (sec)
Pre IPM Post
0.000E+00 3.000E-02 1.000E-02
Max-norms: ||b||=1, ||c|| = 1,
Cholesky |add|=0, |skip| = 0, ||L.L|| = 2.62609.
------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +0.0278559
Done!
Computing the optimal strategy for player 2 ...
Calling sedumi: 21 variables, 11 equality constraints
For improved efficiency, sedumi is solving the dual problem.
------------------------------------------------------------
SeDuMi 1.21 by AdvOL, 2005-2008 and Jos F. Sturm, 1998-2003.
Alg = 2: xz-corrector, Adaptive Step-Differentiation, theta = 0.250, beta = 0.500
Split 1 free variables
eqs m = 11, order n = 23, dim = 23, blocks = 1
nnz(A) = 140 + 0, nnz(ADA) = 121, nnz(L) = 66
it : b*y gap delta rate t/tP* t/tD* feas cg cg prec
0 : 7.35E+00 0.000
1 : -3.13E-01 3.18E+00 0.000 0.4325 0.9000 0.9000 2.46 1 1 5.6E+00
2 : -1.67E-02 1.45E+00 0.000 0.4560 0.9000 0.9000 4.28 1 1 1.2E+00
3 : 1.13E-02 4.36E-01 0.000 0.3006 0.9000 0.9000 1.54 1 1 3.0E-01
4 : 2.61E-02 1.16E-01 0.000 0.2652 0.9000 0.9000 1.09 1 1 7.3E-02
5 : 2.74E-02 2.30E-02 0.000 0.1992 0.9000 0.9000 1.06 1 1 1.5E-02
6 : 2.77E-02 4.39E-03 0.000 0.1906 0.9000 0.9000 1.01 1 1 2.9E-03
7 : 2.79E-02 1.24E-05 0.000 0.0028 0.9990 0.9990 1.00 1 1
iter seconds digits c*x b*y
7 0.0 15.0 2.7855878954e-02 2.7855878954e-02
|Ax-b| = 1.7e-16, [Ay-c]_+ = 1.7E-17, |x|= 9.0e-01, |y|= 5.4e-01
Detailed timing (sec)
Pre IPM Post
0.000E+00 3.000E-02 0.000E+00
Max-norms: ||b||=1, ||c|| = 1,
Cholesky |add|=0, |skip| = 0, ||L.L|| = 1.49432.
------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +0.0278559
Done!
------------------------------------------------------------------------
The optimal strategies for players 1 and 2 are respectively:
0.1804 -0.0000
0.0000 0.3254
0.0000 0.0924
0.1549 0.0000
0.1129 0
0.0000 0.0264
0.0000 0.4099
0.1003 0.0509
0.1474 0.0949
0.3040 -0.0000
The expected payoffs for player 1 and player 2 respectively are:
ans =
0.0279 0.0279
They are equal as expected!