implementing feasibility routine with equations and disequations (finding nash equilibria for normal form games)
1 view (last 30 days)
Show older comments
hallo, i would like to implement an algorithm that finds nash equilibria in normal form games. i'm implementing now an algorithm that given a support (a vector with indexes of the choices to be taken into account), it checks if there is any discrete distribution of probability that is feasible to the problem. in particular, these are the constraints: http://tinypic.com/r/zlya13/6 since that i wouldn't know how to compare many equations with an unknown value v_i, i supposed to implement it as a nonlinear optimum research, but i dont know why it doesn't work
i put a little code for the 2 players (so that is linear problem) question: i tried with both linprog and fmincon and they give different results.. can anyone help me?
if someone could suggest a solution, i would be very grateful!
function [ strategy_1p, strategy_2p ] = feasibility_2p( game, support_1p, support_2p )
options = optimset('Algorithm','active-set');
lb = zeros(length(support_2p),1); %probability constraint, every variable must be positive and <1
ub = lb +1;
temp_strategy_2p = fmincon(@objfun, x_0_2p, [], [], [], [], lb, ub, @confun, options);
for ww = 1:length(support_2p)
strategy_2p(support_2p(ww)) = temp_strategy_2p(ww);
end
function f = objfun(x) %maximize the payoff of the first equation in the support
f = -(payoffs_in(1,:)*x);
end
function [c, ceq] = confun(x)
c_size = size(payoffs_out);
c_size = c_size(1);
c = zeros(c_size,1);
ceq = zeros(length(payoffs_in(1,:))-1,1);
for kk = 1:length(c) % disequation constraint: the difference between payoffs outside and inside the support must be negative
temp = payoffs_out(kk,:) - payoffs_in(1,:);
c(kk) = temp*x;
end
for kk = 2:length(ceq) %equation constraint: the difference between payoffs both inside the support must be zero
temp = payoffs_in(1,:)-payoffs_in(kk,:);
ceq(kk-1) = temp*x;
end
ceq = [ceq; (sum(x)-1)]; %probability constraint: the sum of the variables must be 1
end
2 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!