Shapley Value Calculator
';
// This is the reference to our CSS style sheet.'
echo '';
echo '';
echo '
Shapley Value Calculator
';
## Pointer to this file
$thisFile = "publicGoodsGame.php";
## Power set of all players
$numPlayers = 6;
## Initially, the number of players is 6.
for($n = 1; $n <= $numPlayers; $n++){
$setOfPlayers[$n] = $n;
}
$powerSet = powerSet($setOfPlayers);
$i = 0;
foreach($powerSet as $set){
$powerSetAsStrings[$i] = setToString($set);
$i++;
}
## Check if the thing has been posted
$getContributionPlayer = $_POST['ContributionPlayer']?? -1;
$getMultiplier = $_POST['Multiplier'] ?? -1;
if($getContributionPlayer == -1){
## Get the contributions of each player to the common pot
echo '';
}else{
echo '';
## Now, the Shapley value in a public good game is simply going to be contribution*multiplier
## The classical reward is simply aggregate*multiplier/number of players.
## Let D = Shapley value - Classical reward
## Then it would be interesting to check what happens when the payout is
## P = Classical Reward + Alpha*D,
## Where alpha ranges from 0 to 1.
## I think that just comparing alpha = 0, alpha = 1/3, alpha = 2/3, (alpha = 1) would be interesting.
$sumContributions = array_sum($getContributionPlayer);
echo '
';
echo 'Sum of the contributions =  '.$sumContributions;
echo '