$ontext The example was taken from Section 4 of the following paper: Patrick T. Harker: Multiple equilibrium behaviors on networks. Transportation Science, Vol. 22, No. 1 (Feb 1988), pp. 39-46 We compute solutions of five different models: - User equilibrium (a) - Nash player (1,4) (b) - 2 Nash players (c) - System equilibrium (d) - User equilibrium (each O-D pair is owned by a different player) The (a)-(d) correspond to the Table 1. We found the same solution as reported in the paper. The model UE2 computes the traditional Wardropian User Equilibrium: each O-D pair is owned by each price-taking player. This model was created to compare solutions with those of the UE model. Contributor: Youngdae Kim (01.30.2017) $offtext set node / 1*4 / arc(node,node) / 1.2, 2.1, 2.3, 2.4, 3.1, 3.4, 4.2 / od / od14, od41 / odarc(od,node,node) / od14.1.2, od14.2.4, od14.2.3, od14.3.4 od41.4.2, od41.2.1, od41.2.3, od41.3.1 / pid / 1*4 / path(pid,node,node) / 1.1.2, 1.2.4, 2.1.2, 2.2.3, 2.3.4, 3.4.2, 3.2.1, 4.4.2, 4.2.3, 4.3.1 / odpath(od,pid) / od14.1, od14.2, od41.3, od41.4 /; alias(node,origin,dest); parameter Tw(od) / od14 10, od41 10 /; parameter intercept(node,node) / 1.2 20, 2.1 20, 2.3 5, 2.4 20, 3.1 5, 3.4 5, 4.2 20 /; parameter coef(node,node) / 1.2 1, 2.1 1, 2.3 2, 2.4 1, 3.1 2, 3.4 2, 4.2 1 /; * Store the result in the 'result' parameter. parameter result(*,*); * ------------------------------------------------------------------------- * Define the User Equilibrium model: a single player owns the two O-D pairs * and it is a price-taker. * ------------------------------------------------------------------------- variable obj(od); variable cost(node,node); positive variable h(pid), f(od,node,node) equation defobj(od), arcflow(od,node,node), pathflow(od), mkt(node,node); defobj(od).. obj(od) =E= sum(arc$odarc(od,arc), cost(arc)*f(od,arc)); arcflow(od,origin,dest)$odarc(od,origin,dest).. f(od,origin,dest) =E= sum(pid$(odpath(od,pid) and path(pid,origin,dest)), h(pid)); pathflow(od).. sum(pid$odpath(od,pid), h(pid)) =E= Tw(od); mkt(origin,dest)$arc(origin,dest).. cost(origin,dest) =E= intercept(origin,dest) + coef(origin,dest)*sum(od$odarc(od,origin,dest), f(od,origin,dest)); model wardropian / defobj, arcflow, pathflow, mkt /; * ------------------------------------------------------------------------- * Define the User Equilibrium model: each O-D pair is owned by a different * player. * ------------------------------------------------------------------------- file empinfo / '%emp.info%' /; put empinfo 'equilibrium'; put / 'implicit cost mkt'; loop(od, put / 'min', obj(od); loop(pid$odpath(od,pid), put / h(pid); ); loop(arc$odarc(od,arc), put / f(od,arc); ); put / defobj(od); loop(arc$odarc(od,arc), put / arcflow(od,arc); ); put / pathflow(od); ); putclose; solve wardropian using emp; result('Cost(1,4)', 'UE') = sum(arc$odarc('od14',arc), sum(pid$(odpath('od14',pid) and path(pid,arc)), cost.l(arc)*h.l(pid))); result('Cost(4,1)', 'UE') = sum(arc$odarc('od41',arc), sum(pid$(odpath('od41',pid) and path(pid,arc)), cost.l(arc)*h.l(pid))); result('Total cost', 'UE') = sum(od, obj.l(od)); result('f1','UE') = sum(od, f.l(od,'1','2')); result('f2','UE') = sum(od, f.l(od,'2','1')); result('f3','UE') = sum(od, f.l(od,'2','3')); result('f4','UE') = sum(od, f.l(od,'2','4')); result('f5','UE') = sum(od, f.l(od,'3','1')); result('f6','UE') = sum(od, f.l(od,'3','4')); result('f7','UE') = sum(od, f.l(od,'4','2')); result('h124','UE') = h.l('1'); result('h1234','UE') = h.l('2'); result('h421','UE') = h.l('3'); result('h4231','UE') = h.l('4'); * Reset values. cost.l(arc) = 0; h.l(pid) = 0; f.l(od,arc) = 0; * ------------------------------------------------------------------------- * Define the mixed behavior model where the O-D pair (1,4) is owned by * a Cournot-Nash player. * ------------------------------------------------------------------------- put empinfo 'equilibrium'; put / 'implicit cost mkt'; loop(od, put / 'min', obj(od); loop(pid$odpath(od,pid), put / h(pid); ); loop(arc$odarc(od,arc), put / f(od,arc); ); if (ord(od) eq 1, put / 'cost'; ); put / defobj(od); loop(arc$odarc(od,arc), put / arcflow(od,arc); ); put / pathflow(od); ); putclose; solve wardropian using emp; result('Cost(1,4)', 'Nash14') = sum(arc$odarc('od14',arc), sum(pid$(odpath('od14',pid) and path(pid,arc)), cost.l(arc)*h.l(pid))); result('Cost(4,1)', 'Nash14') = sum(arc$odarc('od41',arc), sum(pid$(odpath('od41',pid) and path(pid,arc)), cost.l(arc)*h.l(pid))); result('Total cost', 'Nash14') = sum(od, obj.l(od)); result('f1','Nash14') = sum(od, f.l(od,'1','2')); result('f2','Nash14') = sum(od, f.l(od,'2','1')); result('f3','Nash14') = sum(od, f.l(od,'2','3')); result('f4','Nash14') = sum(od, f.l(od,'2','4')); result('f5','Nash14') = sum(od, f.l(od,'3','1')); result('f6','Nash14') = sum(od, f.l(od,'3','4')); result('f7','Nash14') = sum(od, f.l(od,'4','2')); result('h124','Nash14') = h.l('1'); result('h1234','Nash14') = h.l('2'); result('h421','Nash14') = h.l('3'); result('h4231','Nash14') = h.l('4'); * Reset values. cost.l(arc) = 0; h.l(pid) = 0; f.l(od,arc) = 0; * ------------------------------------------------------------------------- * Define the two Nash players' game where each O-D pair is controlled by * a different Nash player. * ------------------------------------------------------------------------- put empinfo 'equilibrium'; put / 'implicit cost mkt'; loop(od, put / 'min', obj(od); loop(pid$odpath(od,pid), put / h(pid); ); loop(arc$odarc(od,arc), put / f(od,arc); ); put / 'cost'; put / defobj(od); loop(arc$odarc(od,arc), put / arcflow(od,arc); ); put / pathflow(od); ); putclose; solve wardropian using emp; result('Cost(1,4)', 'Nash2') = sum(arc$odarc('od14',arc), sum(pid$(odpath('od14',pid) and path(pid,arc)), cost.l(arc)*h.l(pid))); result('Cost(4,1)', 'Nash2') = sum(arc$odarc('od41',arc), sum(pid$(odpath('od41',pid) and path(pid,arc)), cost.l(arc)*h.l(pid))); result('Total cost', 'Nash2') = sum(od, obj.l(od)); result('f1','Nash2') = sum(od, f.l(od,'1','2')); result('f2','Nash2') = sum(od, f.l(od,'2','1')); result('f3','Nash2') = sum(od, f.l(od,'2','3')); result('f4','Nash2') = sum(od, f.l(od,'2','4')); result('f5','Nash2') = sum(od, f.l(od,'3','1')); result('f6','Nash2') = sum(od, f.l(od,'3','4')); result('f7','Nash2') = sum(od, f.l(od,'4','2')); result('h124','Nash2') = h.l('1'); result('h1234','Nash2') = h.l('2'); result('h421','Nash2') = h.l('3'); result('h4231','Nash2') = h.l('4'); * Reset values. cost.l(arc) = 0; h.l(pid) = 0; f.l(od,arc) = 0; * ------------------------------------------------------------------------- * Define the system equilibrium. * ------------------------------------------------------------------------- variable objse; equation defobjse; defobjse.. objse =E= sum(od, sum(arc$odarc(od,arc), cost(arc)*f(od,arc))); model wardropian_se / defobjse, arcflow, pathflow, mkt /; put empinfo 'equilibrium'; put / 'implicit cost mkt'; put / 'min', objse, 'h'; loop((od,arc)$odarc(od,arc), put / f(od,arc); ); put / 'cost'; put / defobjse, 'arcflow', 'pathflow'; putclose; solve wardropian_se using emp; result('Cost(1,4)', 'SE') = sum(arc$odarc('od14',arc), sum(pid$(odpath('od14',pid) and path(pid,arc)), cost.l(arc)*h.l(pid))); result('Cost(4,1)', 'SE') = sum(arc$odarc('od41',arc), sum(pid$(odpath('od41',pid) and path(pid,arc)), cost.l(arc)*h.l(pid))); result('Total cost', 'SE') = objse.l; result('f1','SE') = sum(od, f.l(od,'1','2')); result('f2','SE') = sum(od, f.l(od,'2','1')); result('f3','SE') = sum(od, f.l(od,'2','3')); result('f4','SE') = sum(od, f.l(od,'2','4')); result('f5','SE') = sum(od, f.l(od,'3','1')); result('f6','SE') = sum(od, f.l(od,'3','4')); result('f7','SE') = sum(od, f.l(od,'4','2')); result('h124','SE') = h.l('1'); result('h1234','SE') = h.l('2'); result('h421','SE') = h.l('3'); result('h4231','SE') = h.l('4'); * Reset values. cost.l(arc) = 0; h.l(pid) = 0; f.l(od,arc) = 0; display result;