import sys
sys.path.append("/home/xschen/workspace/fd_learning/simulator")
import get_client_characteristic
import primalAlgorithm.client_selection_algorithm as client_selection_algorithm
from primalAlgorithm import *
import pandas as pd

if __name__ == '__main__':
    # client_characteristic = get_client_characteristic.get_client_characteristic(520)
    # k_channel = 20
    # t_round = 500
    # client_selection_algorithm.client_selection(k_channel, client_characteristic, t_round)

    # 画热力图的点不够，所以启用新的模拟
    client_characteristic = get_client_characteristic.get_client_characteristic(2500)  
    k_channel = 20
    t_round = 100
    participate_round, select_round = client_selection_algorithm.client_selection(k_channel, client_characteristic, t_round)
    
    # 文件路径
    csv_file_path = '/home/xschen/workspace/fd_learning/simulator/simDataset/clients_vu_for_sim.csv'

    # 读取现有的 CSV 文件
    df = pd.read_csv(csv_file_path)
    # 添加 participate_round 列
    df['participate_round'] = participate_round

    # 保存到 CSV 文件
    df.to_csv(csv_file_path, index=False)

    # 文件路径
    csv_file_path = '/home/xschen/workspace/fd_learning/simulator/simDataset/clients_vu_for_sim_select.csv'

    # 读取现有的 CSV 文件
    df = pd.read_csv(csv_file_path)
    # 添加 select_round 列
    df['select_round'] = select_round

    # 保存到 CSV 文件
    df.to_csv(csv_file_path, index=False)