def get_sim_and_agent_index(agent_id, config):
    """Given the index of the agent, find which simulator and
    which position the agent belongs to (inside the simulator)

    Args:
        agent_id: Global index of the agent
        config: configuration directory
    Returns:
        sim_index : which simulator the agent belongs to
        agent_index : the index of the agent inside the simulator

    """
    # Given the position of the agent in the array
    # return which simulation instance and which position
    # inside the simulation the agent belongs to
    sim_index = agent_id // config['num_agents_per_sim']
    agent_index = agent_id % config['num_agents_per_sim']
    return sim_index, agent_index