自然災害/現象の状況では、停電が発生する可能性があります。これと戦うために、EV(電気自動車)ドライバーは、顧客/クライアントのバッテリーとして車両を使用できます。停電期間が終わるまでできるだけ多くの顧客に到達するというこの課題の難しさをシミュレートするために、RL環境が作成されました。この環境は、ノードネットワークサイズ、家の量(ノードサイズよりも大きくない)、ブラックアウトデータ、ハウジングモデルに基づいたランダムシナリオを備えており、高レベルの問題で停電反応をシミュレートします。

実行中のランダムエージェントの例。
負荷は、ノードからの現時点で必要な電力を表します。
現在の充電は、エージェント(または車)が持っている力を表します。
エッジの値は、エッジのマイルのコストを通過することを表します。
青いノードはバッファを表します。緑のノードは家を表します。グレーノードはブラックアウトアウトノードを表します。
詳細については、アクションおよびステートスペースセクションにあります。
プロジェクトをクローンします
git clone https://github.com/Natemen96/ECEMasterProject.gitプロジェクトディレクトリに移動します
cd ECEMasterProject/RL python main.py警告:これは大規模なインストール(〜2GB)であり、インターネットの速度に応じて約30分かかります。セットアップによっては、パッケージを簡単にインストールする方が簡単になる場合があります。リストは、 conda_envフォルダーにあります。最新のパッケージリストについては、「conda_env/rl_window.yml」を参照してください。 Windowsで最適に機能します。
簡単にインストールするには、コンドラを使用して最初にコンドラがインストールされていることを確認してください。
コンドラがインストールされた後、環境をセットアップするために次のことを行います
conda env create -f conda_env/rl_window.yml --name rl_env # or any name you prefer
conda activate rl_env # verify it work Conda envでプログラムを実行してください。
ハウジングデータは、Pecan Street/DataPortからダウンロードできます
「ホーム」(ノード)から始めて、電力(EVの主なリソース)と引き換えに各場所に移動し、報酬と引き換えに電力を降ろし、電力と引き換えに家に戻ります。エージェントは、「ホーム」で電力を回復し、どれだけの電力を取り戻したかに応じて、より多くの報酬を得ることができます。それ自体がより多くのパワーを回復すればするほど、それは報われます。
電力充電ステーションを備えたノードで電源が復元されると、エージェントはエネルギーを復元することもできます。一部のノードは、パラメーターに応じて空になります。
graph_env: Randomly generated a fully connected graph n nodes
Args:
n (int, optional): [number of nodes]. Defaults to 5.
numofhome (int, optional): [number of homes for agent starting
point]. Defaults to 1.
numofblackout (int, optional): [number of houses with blackout].
Defaults to 1.
numofblackoutws (int, optional): [number of blackout houses with
solarpower]. Defaults to 0.
numofchargingstation (int, optional): [number of charging
station]. Defaults to 0.
max_actions (int, optional): [max number of action can be done
times 7. By default 3 (7) = 21]. Defaults to 3.
blackout_str (str, optional): [Reads Blackout data from npy
file. Blackout data from the 2021 Texas Power Crisis, a file for
each country]. Defaults to 'Brazoria'.
agents (list, optional): [Agent objects]. Defaults to [None].
nonsolarhouse_data_paths (list, optional): [Path for npy file
with nonsolar data info. Added to a node per path.]. Defaults to
[None].
solarhouse_data_paths (list, optional): [Path for npy file with
solarhouse data info. Added to a node per path.]. Defaults to
[None].
data_sample (int, optional): [how many data sample it take from
data in paths, samples taken evenly throughout data. By default
(0/6. 1/6 ... 6/6 0/6 ...) sample]. Defaults to 6.BasicAgent: Basic Agent that act as skeleton for other agent. Won't work by itself.
Args:
car ([dict]): [car information in the form of a python
dictionary. Required dict information: model, make, year,
avg_energy_consumption(kWh/mile), battery_capacity(kWh)]SmartQLAgent: Smart Agent that uses Qtable to make decisions
Args:
car ([dict]): [car information in the form of a python
dictionary. Required dict information: model, make, year,
avg_energy_consumption(kWh/mile), battery_capacity(kWh)]
sample_rate (int, optional): [decides how often a sample of the
qtable is taken. If left to default it's every 1/100 of total ep]
. Defaults to 100.
qtabletraining (bool, optional): [Flag for turning qtable
training on]. Defaults to True.
quiet (bool, optional): [Flag for turning data collection on].
Defaults to True.RandomDataAgent: Used for data collection of random agent. Doesn't
use Observation.
Args:
car ([dict]): [car information in the form of a python
dictionary. Required dict information: model, make, year,
avg_energy_consumption(kWh/mile), battery_capacity(kWh)]荷降ろし、充電に与えられた報酬。電力回復の多様性は、より多くの報酬をもたらします。エネルギーが不足しているために失われた報酬。 EVがエネルギーが不足しているか、ネットワークが完全に電力を供給されているとき、エピソードは終了します。
Each Agent will have 24 actions per ep by default.
e+2 Actions:
e - Move (at cost) to Node if possible
1 - Unload (at cost)
1 - Recharge (no cost, expect an action)
2 * n + 6 * n + 300 * n + c States:
n - Statuses of Each Node
Key - Assignment
0 - Buffer (Blue)
1 - Blackout (Darkgrey)
2 - Blackout with Solar (Lightgrey)
3 - Powered (Blue)
4 - Charging Station (Yellow)
5 - Home (Green)
n - Cost of each edge
n - Is the path reachable or not?
0 - No
1 - Yes
c - Charge State (400 possible values by default)
where n is the number of nodes states, e is the number of edges, and c number of is Charge states 各ノードは、ハウスデータセットに基づいて設計されています。ソーラー電源のある家の中には、非塩局の家と比較して、EVからの電力が少ない家の一部が必要です。ハウスノードのコストは、ハウジングデータから派生できます。
テキサスの停電データに基づく停電の割合と1日あたりの変更。
少なくとも、 Qラーニングが使用され、最適なソリューションが見つかりました。
複数のEV(MARLが必要になる)とより大きなネットワークにスケーリングできます。 Marlは完全にテストされておらず、おそらく非常にバギーです。
50K EPSのテスト実行中、QTABLESでサポートされていたスマートエージェントは、ランダムエージェント(ランダムアクションを実行する)と比較して263.13%の改善がありました。
scripts/Data/TexasBlackout.csv
-csv file of data collected from https://poweroutage.us/area/state/texas during the 2021 Texas Power Crisis with the following
- Metrics: ID,County,Customers Tracked,Customers Out,Outage %,DateTime
ECEMasterProject/RL/Data/
Avg_House_0/
- npy files of average daily power per every 15 mins of various houses provide by Dataport
Avg_House_1/
- npy files of next day regression of Avg_House_0 per house
Avg_House_n/
- npy files of concatenation of Avg_House_0 adn Avg_House_1 per houses
County/
- npy files of Texas County that were effect the most during the 2021 Texas Power Crisis
RL/agent/Sim_Data
- csv file result from various RL training, only stored reward.
RL/agent/agent_jsons/
-various json file of EV information
-Metrics: model, make, year, avg_energy_consumption(kWh/mile), battery_capacity(kWh), source
models/
KM/
-Classifier models trained using Time Series K Means stored in h5
LSTM/
-Old LSTM regression model trained on one house stored in h5
LSTM_nonsolar/
-LSTM regression model trained on non solar data stored in h5
LSTM_solar/
-LSTM regression model trained on solar data stored in h5
Qtables/
-Qtables from RL training stored in h5
notebooks/
analysis_c0.ipynb
-Analysis of classifier and regression model on solar houses data
analysis_c1.ipynb
-Analysis of classifier and regression model on nonsolar houses data
cluster.ipynb
-Creation and Analysis of classifier that can distinguish between solar and nonsolar data
compare_qtable_analyis.ipynb
-Comparing Qtable Smart Agent with Random Agent Baseline
D_LSTM_HousingData.ipynb
-Creation and analysis of regression on avg housing data where the original data sample occurs every 15 mins -> 98 sample per day
Dp1_analysis.ipynb
-Creation and analysis of regression on one house
EveryNyHouseAvg.ipynb
-Creation and analysis of regression on all house samples with model trained on one house (house 1)
LSTM_cluster0.ipynb
-Creation and analysis of regression on one house using most of the solar housing data
LSTM_cluster1.ipynb
-Creation and analysis of regression on one house using most of the nonsolar housing data
qtable_analyis_4_19.ipynb
-Analysis of Smart Agents performance
qtable_analyis_4_22.ipynb
-Analysis of Smart Agents performance
qtable_analyis.ipynb
-Analysis of Smart Agents performance
random_agent_analyis.ipynb
-Analysis of Random Agents performance
Texas_Blackout.ipynb
-Analysis of recorded Blackout Data一部のエッジはブロックされ、日が経過すると後で復元できます(自然災害のためにシミュレート)
テストを追加します
DRLおよび古典的な最適化技術
Marlのデバッグ
Openai環境に変換します
DL/MLモデルの作成についてさらに学びました。
データの探索からのデータ分析と、DL/MLトレーニングの結果についてさらに学びました。
NetworkXについて学び、プロジェクトに関連するグラフ理論の能力です。
強化学習環境とエージェントの作成についてさらに学びました。
2021年のテキサスパワー危機中に停電データを廃止するために必要なデータスクレイピングについてさらに学びました
Pythonで画像を使用してGIFを作成する方法を学びました。
Purdue UniversityのAlma MaterのQin教授に、彼の驚くべきサポートとこのプロジェクトの専門知識を共有してくれてありがとう。
モデルを構築するための住宅データを提供してくれたDataPortとPecan Streetに感謝します。
この強化学習環境を刺激してくれたパンデミックであるボードゲームの作成者であるマットリーコックに感謝します。