Skip to content

[Bug]: Core dump in GetAgentMaxRegret() for 0-dimension / degenerate games #904

@AndresFerCervell

Description

@AndresFerCervell

Where did you find this bug?

Gambit CLI

What operating system are you using?

Linux

What version of Gambit are you using?

16.6.0

What happened?

Testing the guard proposed in logit to prevent a core dump for 0-dimension games such as "chance_root_5_moves_no_nonterm_player_nodes.efg", (#883) I proposed to add this code in test_nash.py:

pytest.param(
        EquilibriumTestCase(
            factory=functools.partial(games.read_from_file, "chance_root_5_moves_no_nonterm_player_nodes.efg"),
            solver=gbt.nash.logit_solve,
            expected=[
                [[]]  # Zero-dimension edge case (two players)
            ],
            regret_tol=TOL_LARGE,
            prob_tol=TOL_LARGE,
        ),
        marks=pytest.mark.nash_logit_behavior,
        id="test_logit_behavior_degenerate",
    ), 

right after the create_stripped_down_poker_efg test. The next error occurred:

Image

Accessing agent_max_regret causes an exception when trying to reach the position 0 of an empty array, when the regret of a choiceless game should be 0.0.
The exception is:

IndexError: vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions