Пример #1
0
model_name = "model_0_0_initialFortify.tar"

# Create the net using the same parameters
inputs = misc.read_json(EI_inputs_path)
model_args = misc.read_json(inputs["model_parameters"])
board_params = inputs["board_params"]
path_board = board_params["path_board"]

# ---------------- Model -------------------------

print("Creating board")

world = World(path_board)

# Set players
pR1, pR2, pR3 = RandomAgent('Red'), RandomAgent('Blue'), RandomAgent('Green')
players = [pR1, pR2]
# Set board
prefs = board_params

board_orig = Board(world, players)
board_orig.setPreferences(prefs)

num_nodes = board_orig.world.map_graph.number_of_nodes()
num_edges = board_orig.world.map_graph.number_of_edges()

print("Creating model")
net = GCN_risk(num_nodes, num_edges, model_args['board_input_dim'],
               model_args['global_input_dim'], model_args['hidden_global_dim'],
               model_args['num_global_layers'], model_args['hidden_conv_dim'],
               model_args['num_conv_layers'], model_args['hidden_pick_dim'],
Пример #2
0
if __name__ == "__main__":
    # Test the model loading, the forward and the loss
    print("script model.py")

    EI_inputs_path = "../support/exp_iter_inputs/exp_iter_inputs_hex_final.json"

    # Create the net using the same parameters
    inputs = misc.read_json(EI_inputs_path)
    model_args = misc.read_json(inputs["model_parameters"])
    board_params = inputs["board_params"]
    path_board = board_params["path_board"]
    # Create board
    world = World(path_board)

    # Set players
    pR1, pR2 = RandomAgent('Red'), RandomAgent('Blue')
    players = [pR1, pR2]
    # Set board
    prefs = board_params

    board_orig = Board(world, players)
    board_orig.setPreferences(prefs)

    num_nodes = board_orig.world.map_graph.number_of_nodes()
    num_edges = board_orig.world.map_graph.number_of_edges()

    board = copy.deepcopy(board_orig)

    print("Creating model")
    net = GCN_risk(
        num_nodes, num_edges, model_args['board_input_dim'],