Skip to content

Add Player.delete_action, NormalFormGame.delete_action#444

Merged
mmcky merged 2 commits intomasterfrom
gt_delete
Nov 11, 2018
Merged

Add Player.delete_action, NormalFormGame.delete_action#444
mmcky merged 2 commits intomasterfrom
gt_delete

Conversation

@oyamad
Copy link
Copy Markdown
Member

@oyamad oyamad commented Nov 5, 2018

Example:

g = gt.NormalFormGame([[(3, 0), (0, 1)], [(0, 0), (3, 1)], [(1, 1), (1, 0)]])
print(g)
2-player NormalFormGame with payoff profile array:
[[[3, 0],  [0, 1]],
 [[0, 0],  [3, 1]],
 [[1, 1],  [1, 0]]]
nums_actions_deleted = np.zeros(g.N)
step = 0
while True:
    for i in range(g.N):
        actions = g.players[i].dominated_actions()
        g = g.delete_action(i, actions)
        if len(actions) > 0:
            step += 1
            print('Step {step}'.format(step=step))
            print(g, '\n')
        nums_actions_deleted[i] = len(actions)
    if nums_actions_deleted.prod() == 0:
        break
Step 1
2-player NormalFormGame with payoff profile array:
[[[3, 0],  [0, 1]],
 [[0, 0],  [3, 1]]] 

Step 2
2-player NormalFormGame with payoff profile array:
[[[0, 1]],
 [[3, 1]]] 

Step 3
2-player NormalFormGame with payoff profile array:
[[[3, 1]]] 

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.03%) to 94.451% when pulling 8703710 on gt_delete into 3bb4d7d on master.

@mmcky
Copy link
Copy Markdown
Contributor

mmcky commented Nov 11, 2018

thanks @oyamad must have missed this one in my review last week. I will merge this now.

@mmcky mmcky merged commit 4e6d842 into master Nov 11, 2018
@mmcky mmcky deleted the gt_delete branch November 11, 2018 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants