oozan commited on
Commit
0a8d192
Β·
verified Β·
1 Parent(s): d8c827d

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. BLOG.md +139 -0
BLOG.md ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ EVChargeEnv: An OpenEnv Benchmark for EV Charging Optimization
2
+
3
+ 1. Motivation
4
+
5
+ As AI agents move from static prediction to acting autonomously in dynamic environments, we need richer environments than toy grids and games. One domain that naturally combines uncertainty, long-horizon planning, and multi-objective decision-making is electric vehicle (EV) charging.
6
+
7
+ EVChargeEnv is my contribution to the OpenEnv Challenge. It simulates a simplified but realistic EV charging process where an agent must decide how much to charge at each timestep while adapting to fluctuating electricity prices and grid load.
8
+
9
+ The core objective is:
10
+
11
+ Reach full battery while minimizing cost and avoiding grid overload.
12
+
13
+ This makes EVChargeEnv a clean and interpretable environment that still contains meaningful complexity.
14
+
15
+ ---
16
+
17
+ 2. Environment Design
18
+
19
+ EVChargeEnv exposes a continuous-control RL task with a 4-dimensional state:
20
+
21
+ - charge_level ∈ [0, 1] – battery state of charge
22
+ - price ∈ [0, 1] – dynamic energy price
23
+ - grid_load ∈ [0, 1] – current grid stress/instability
24
+ - time_step_norm ∈ [0, 1] – normalized timestep
25
+
26
+ Agents output a continuous charging rate between 0 and 1.
27
+
28
+ Scenarios
29
+
30
+ To test robustness, EVChargeEnv includes three difficulty modes:
31
+
32
+ - easy – smooth price/load curves and short episodes
33
+ - medium – balanced volatility (default scenario)
34
+ - hard – noisy price/load dynamics and slower charging
35
+
36
+ ---
37
+
38
+ 3. Reward Function
39
+
40
+ The reward balances several competing factors:
41
+
42
+ - progress_reward – reward for increasing charge
43
+ – cost_penalty – charging during high prices costs more
44
+ – overload_penalty – charging when grid load is high is discouraged
45
+ – time_penalty – each step costs a tiny penalty to encourage faster execution
46
+
47
+ This encourages agents to:
48
+
49
+ - charge aggressively during low-price, low-load periods
50
+ - slow or stop charging during peak price/load
51
+ - finish charging efficiently
52
+
53
+ ---
54
+
55
+ 4. Implementation and OpenEnv Integration
56
+
57
+ The environment is implemented using gymnasium and structured to reflect OpenEnv specifications. Key files include:
58
+
59
+ - env/ev_charge_env.py – main environment logic
60
+ - openenv.yaml – metadata describing observation/action spaces, rewards, and termination criteria
61
+ - run_evaluation.py – produces standardized JSON outputs for assessment
62
+
63
+ Example output:
64
+
65
+ {
66
+ "avg_reward": -1.23,
67
+ "avg_steps": 31.2,
68
+ "episodes": 5
69
+ }
70
+
71
+ Published on the Hugging Face Hub:
72
+ https://huggingface.co/oozan/EVChargeEnv
73
+
74
+ ---
75
+
76
+ 5. Baseline Agents and Training
77
+
78
+ Baselines included:
79
+
80
+ Random Baseline – ignores price/load.
81
+ Price-Aware Baseline – charges more when price is low.
82
+ PyTorch Policy-Gradient Agent – small neural model trained with REINFORCE.
83
+
84
+ The learned agent shows:
85
+
86
+ - improved reward
87
+ - sensible patterns
88
+ - adaptation to medium scenario
89
+
90
+ ---
91
+
92
+ 6. Running the Environment
93
+
94
+ Install:
95
+
96
+ pip install -r requirements.txt
97
+
98
+ Evaluate:
99
+
100
+ python run_evaluation.py
101
+
102
+ Heuristic baseline:
103
+
104
+ python run_price_aware_evaluation.py
105
+
106
+ Train agent:
107
+
108
+ python train_evchargeenv_pg.py
109
+
110
+ Notebook also included for Colab execution.
111
+
112
+ ---
113
+
114
+ 7. Future Improvements
115
+
116
+ Possible extensions:
117
+
118
+ - Day/night pricing cycles
119
+ - Renewable energy influence
120
+ - Emergency events / blackouts
121
+ - Battery degradation modeling
122
+ - PPO/SAC/LLM-based agents
123
+ - Visualization tools
124
+
125
+ ---
126
+
127
+ Final Thoughts
128
+
129
+ EVChargeEnv is:
130
+
131
+ - simple
132
+ - realistic
133
+ - modular
134
+ - OpenEnv-compliant
135
+
136
+ It provides a practical environment for research on planning and resource optimization under uncertainty.
137
+
138
+ Repo:
139
+ https://huggingface.co/oozan/EVChargeEnv