22 #ifndef _SGRISKSHARING_3PLAYER_MERGED_HPP
23 #define _SGRISKSHARING_3PLAYER_MERGED_HPP
39 vector<int> numActions_total;
42 double consumption(
int e,
int t)
const
44 assert(E[e]+t*cIncr>=-1e-6);
45 assert(E[e]+t*cIncr<=1+1e-6);
46 double cons = E[e]+t*cIncr;
58 numEndowments(_numEndowments),
61 numActions_total(_numEndowments,1),
64 vector< vector<int> > (_numEndowments,vector<int>(2,1)))
71 for (
int e = 0; e < numEndowments; e++)
73 E[e] = (1.0*e)/(numEndowments-1);
80 eIncr = (E[1]-E[0])/2.0;
81 cIncr = 1.0/( (numEndowments-1)*c2e );
84 for (
int e = 0; e < numEndowments; e++)
85 probDenom += numEndowments-e;
90 int t = actions[1]-actions[0];
91 double c = consumption(state,t);
93 return SGPoint(sqrt(c),2.0*sqrt((1-c)/2.0));
96 virtual double probability(
int e,
const vector<int> & actions,
int ep)
const
98 int t = actions[1]-actions[0];
99 int a = actions[0]+actions[1]*
numActions[e][0];
101 return (1.0*numEndowments-ep)/probDenom;
107 if ( (actions[0] == 0) || (actions[1] == 0) )