Skip to content

How to compute a new Double Dummy score? #1313

Description

@Amir-Arsalan

I want to integrate the simulator in a look where my model chooses the next action and passes it to the simulator. I was assuming that the simulator would calculate a new Double Dummy score for a new set of actions but it turns out that is not the case. How would you suggest one should calculate a new Double Dummy score after the bidding is over? The code below shows that the model has chosen a Double Dummy score in advance even before a bidding which is a big puzzling for me although I know that I could be wrong especially since I'm still learning about how the simulator works.

import jax, pgx
from pgx.bridge_bidding import BridgeBidding
from pgx.bridge_bidding import download_dds_results
from pgx.experimental.utils import act_randomly


download_dds_results()
env = BridgeBidding(dds_results_table_path = "dds_results/dds_results_10M.npy")
# model = env.make_baseline_model('')

init = jax.jit(jax.vmap(env.init))  # vectorize and JIT-compile
step = jax.jit(jax.vmap(env.step))
act_randomly = jax.jit(act_randomly)

batch_size = 1

# prepare PRNGKeys
key = jax.random.PRNGKey(44)
key, subkey = jax.random.split(key)
keys = jax.random.split(subkey, batch_size)

state = init(keys)  # vectorized states

print(state._dds_val)

while not (state.terminated | state.truncated).all():
    action = act_randomly(subkey, state.legal_action_mask)
    state = step(state, action)  # state.reward (2,)

print(state._dds_val)

The code above will print the following:
[[467474 436923 467474 437179]]
[[467474 436923 467474 437179]]

Which seems that the simulator assumes the Double Dummy score is guaranteed to come from a set of 10 million random bidding results. So does this mean that the Bridge Bidding code does not take into account the possibility that one might use a policy network to produce the actions? How should one modify the code so that the Double Dummy score is calculated on fly when using a policy network to drive the simulation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions