Spaces:
Sleeping
Sleeping
Download agent.py from anmol1620/cloud-env-openenv: direct link, hf CLI and curl.
- Browser
- Download file 481 Bytes
-
https://huggingface.co/spaces/anmol1620/cloud-env-openenv/resolve/main/agent.py
- Command line
-
hf download hf://spaces/anmol1620/cloud-env-openenv/agent.py
-
curl -L -o agent.py https://huggingface.co/spaces/anmol1620/cloud-env-openenv/resolve/main/agent.py
481 Bytes
| import random | |
| # --------------------------- | |
| # RULE-BASED AGENT (SMART) | |
| # --------------------------- | |
| def get_action(state): | |
| capacity = state.servers * 50 | |
| if state.requests > capacity: | |
| return 0 # add server | |
| elif state.requests < capacity * 0.5: | |
| return 1 # remove server | |
| else: | |
| return 2 # do nothing | |
| # --------------------------- | |
| # RANDOM AGENT | |
| # --------------------------- | |
| def random_agent(state): | |
| return random.choice([0, 1, 2]) |