Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Preloaded Examples
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Monterey Phoenix
MP Model Collection
Preloaded Examples
Commits
ae11070c
Commit
ae11070c
authored
3 years ago
by
Giammarco, Kristin M
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
82518f6a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Example62_Prisoners_Dilemma.mp
+86
-0
86 additions, 0 deletions
Example62_Prisoners_Dilemma.mp
with
86 additions
and
0 deletions
Example62_Prisoners_Dilemma.mp
0 → 100644
+
86
−
0
View file @
ae11070c
/* The Prisoner's Dilemma
Michael Collins
August 10, 2020.
https://en.wikipedia.org/wiki/Prisoner%27s_dilemma
https://plato.stanford.edu/entries/prisoner-dilemma/#Symm2t2PDOrdiPayo
In this case, the classic model is the output in the traces
of the model with the payouts as documented in
"Game Theory and Strategy" by Philip D. Straffin
Mathematical Association of America 1993
isbn: 0-88385-637-9
Chapter 12, page 73.
Different in this MP model is how the payouts
are computed. Most models just assume the final
amount of payouts for the matrix game.
Here the payout for Alice, and Bob respectively,
is computed from
"Alice's view of the payoff for each possible event independently of Bob's view"
This is represented by the columns in the tables below.
A simple arithmetic derivation from those columns is computed to have the
trace generation output each matrix element of the game as
a separate trace in the MP output.
Future work is to include other obvious matrices readily constructed
from this to be generated as part of the trace generation.
This would represent something like a class of matrix games
to be constructed by the schema, one of which would be
the classic two person prisoners dilemma
Notice that this code is almost exactly like
MP native Example 23 -- number attributes.
That example is about a buyer purchasing different products
from different stores.
A related version of the prisoners dilemma to shopping is
documented at the Wikipedia article cited above. "The donation game."
This model is only meant to be run at scope 1.
From Alice's viewpoint: (in this case the selfish view point).
the payoff for Alice when she confesses = 1.
the payoff for Alice when Bob does not confess = 2.
in all other circumstances the payoff for Alice = 0.
From Bob's viewpoint: (in this case the selfish view point)
the payoff for Bob when he confesses = 1.
the payoff for Bob when Alice does not confess = 2.
in all other circumstances the payoff for Bob = 0.
To map it to classic values to show negative payoffs -- that is a sort of normalizing.
The total payoff is computed from the assignments above and then subtracting 2.
*/
/*—————————————————————————————
Actors
———————————————————————————————*/
SCHEMA Prisoners_Dilemma
ATTRIBUTES { number utility1, utility2, payout_alice, payout_bob ;};
do_not_confess_alice: BUILD{ utility1:= 0 ; utility2:= 2 ;};
confess_alice: BUILD{ utility1:= 1 ; utility2:= 0 ;};
do_not_confess_bob : BUILD{ utility1:= 2 ; utility2:= 0 ;};
confess_bob: BUILD{ utility1:= 0 ; utility2:= 1 ;};
ROOT Alice: ( do_not_confess_alice | confess_alice );
ROOT Bob: ( do_not_confess_bob | confess_bob );
payout_alice:= SUM{ $act:( do_not_confess_alice | confess_alice | do_not_confess_bob | confess_bob ) APPLY $act.utility1 } - 2 ;
payout_bob := SUM{ $act:( do_not_confess_alice | confess_alice | do_not_confess_bob | confess_bob ) APPLY $act.utility2 } - 2 ;
/*—————————————————————————————
Interactions
———————————————————————————————*/
SAY( "Payout Alice = " payout_alice);
SAY( "Payout Bob = " payout_bob );
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment