Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add Player.delete_action, NormalFormGame.delete_action #444

Merged
merged 2 commits into from
Nov 11, 2018
Merged

Conversation

oyamad
Copy link
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

Coverage Status

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

@mmcky
Copy link
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
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants