-
Notifications
You must be signed in to change notification settings - Fork 7
/
start_client.py
32 lines (23 loc) · 992 Bytes
/
start_client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#Copyright(C) 2023 Intel Corporation
#SPDX-License-Identifier: Apache-2.0
#File : start_client_demo.py
from network_gym_client import load_config_file
from network_gym_client import Env as NetworkGymEnv
client_id = 0
env_name = "nqos_split"
config_json = load_config_file(env_name)
config_json["rl_config"]["agent"] = "system_default"
# Create the environment
env = NetworkGymEnv(client_id, config_json) # make a network env using pass client id and configure file arguments.
num_steps = 1000
obs, info = env.reset()
for step in range(num_steps):
#action = env.action_space.sample() # agent policy that uses the observation and info.
action = [] # environment will use system default is no action is provided.
obs, reward, terminated, truncated, info = env.step(action)
# If the environment is end, exit
if terminated:
break
# If the episode is up (environment still running), then start another one
if truncated:
obs, info = env.reset()