في مواقف الكوارث الطبيعية/الظواهر ، يمكن أن تحدث انقطاع التيار الكهربائي. لمكافحة هذا ، يمكن للسائقين EV (السيارات الكهربائية) استخدام سياراتهم كبطاريات للعملاء/ العملاء. لمحاكاة صعوبة هذا التحدي المتمثل في الوصول إلى أكبر عدد ممكن من العملاء حتى تنتهي فترة التعتيم ، تم إنشاء بيئة RL. تتميز هذه البيئة سيناريوهات عشوائية تعتمد على حجم شبكة العقدة ، وكمية المنازل (لا يمكن أن تكون أكبر من حجم العقدة) ، وبيانات التعتيم ، ونماذج الإسكان لمحاكاة استجابة تعتيم في مسألة عالية المستوى.

مثال على عامل عشوائي في العمل.
يمثل الحمل الطاقة اللازمة في الوقت الحالي من العقدة.
تمثل الشحن الحالي القوة التي يتمتع بها الوكيل (أو السيارة).
تمثل القيم على الحواف أميال التكلفة الحافة التي يجب مرورها.
العقدة الزرقاء تمثل المخازن المؤقتة. العقدة الخضراء تمثل المنازل. العقدة الرمادية تمثل تعتيم العقدة.
يمكن العثور على مزيد من التفاصيل في قسم الفضاء والدولة.
استنساخ المشروع
git clone https://github.com/Natemen96/ECEMasterProject.gitانتقل إلى دليل المشروع
cd ECEMasterProject/RL python main.py تحذير: هذا تثبيت كبير (~ 2 جيجابايت) وسيستغرق حوالي 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 تأكد من تشغيل البرنامج داخل كوندا بيئة.
يمكن تنزيل بيانات الإسكان من شارع Pecan/Dataport
ابدأ من "Home" (عقدة) ، سافر إلى كل موقع مقابل الطاقة (المورد الرئيسي لـ 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 تم تصميم كل عقد لتكون على أساس مجموعة بيانات المنزل. ستحتاج بعض المنازل التي تعمل بالطاقة الشمسية إلى قوة أقل من EVs مقارنة بالمنازل التي تعمل بالطاقة غير الشمسية. يمكن اشتقاق تكلفة العقدة المنزلية من بيانات الإسكان.
النسبة المئوية للتعتيم بناءً على بيانات تكساس التعتيم ، وكذلك التغيير يوميًا.
على الأقل تم استخدام التعلم Q للعثور على أفضل الحلول.
يمكن تحجيمها إلى متعددة EV (ستكون هناك حاجة إلى MARL) ، وشبكة أكبر. لم يتم اختبار مارل بالكامل ومن المحتمل أن يكون عربات التي تجرها الدواب.
خلال عملية اختبار بقيمة 50 كيلو ربحية ، كان لدى الوكيل الذكي الذي كان يدعمه 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 وتقنيات التحسين الكلاسيكية
تصحيح مارل
تحويل إلى بيئة Openai
تعلمت المزيد عن صنع نماذج DL/ML.
تعلمت المزيد عن تحليل البيانات من استكشاف البيانات ونتائج التدريب DL/ML.
تعلمت عن NetworkX وقدراتها لنظرية الرسم البياني المتعلقة بالمشاريع.
تعلمت المزيد عن صنع بيئات التعلم والوكلاء.
تعلمت المزيد عن تجريف البيانات حيث كنت بحاجة لإلغاء بيانات التعتيم خلال أزمة الطاقة في تكساس 2021
تعلمت كيفية صنع GIF باستخدام الصور في Python.
شكرًا لك على البروفيسور تشين من My Alma Mater ، جامعة بوردو لدعمه المذهل ومشاركة خبرته لهذا المشروع.
شكرًا لك على Dataport و Pecan Street على توفير بيانات الإسكان لبناء النماذج.
شكرًا لك على Matt Leacock The Creator of the Board Game ، Pandemic على إلهام بيئة التعلم التعزيز هذه.