Skip to content

ENH: Consolidate add_action/delete_action into single operation #378

@tturocy

Description

@tturocy

Overview

The add and delete actions operations could be coalesced into a single operation, which for the moment let's call set_actions. For a chance move, set_actions(infoset, actions) would require a mapping from actions to probabilities, where actions as usual could be specified by label or by action object (requiring the action to be an action at that information set). New actions could be added by introducing a new label, and actions deleted by dropping the label. This would also allow actions to be re-ordered - re-ordering the actions would result in the corresponding subtrees being reordered. For personal player moves, actions would just be a list instead of a mapping. This behaviour is similar to using DataFrame.reindex in pandas, where it's possible to add, delete, and reorder rows and columns arbitrarily.

Specifically, this was trigged by the realisation that delete_action on a chance information set necessarily involves dealing with the action probabilities. This was addressed in #372 to renormalise them to sum to one, but it is thought this might be too implicit and lead to unexpected behaviour.

Implications:

  • This should definitely be changed in the Python API
  • This should almost certainly be changed in C++ as well
  • There will be an implication for how the graphical interface behaves as a result.
  • set_actions should be part of 16.2, and the existing add_action and remove_action retained but deprecated, with removal in 16.3.

Other notes

As part of this issue, we should look and see whether a similar refactoring of operations would be appropriate anywhere else.

See also

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++Items which involve writing in C++enhancementpythonItems which involve coding in Python

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions