M111156007 詹景崴 智數碩二
# 2024/04/22
## 伺服器
* 目前有GPU異常問題
* 嘗試過降溫、調整驅動、重新安裝等方式,目前尚在處理。
* https://github.com/canonical/microk8s/issues/4408

# 2024/04/15
## SA
### Flowchart

### Parallel Computing

## Server
* Server三台(4070ti)都有的通病,當顯卡長時間運轉,容易導致風扇故障、系統找不到顯卡等,須重新開機才會恢復正常
# 2024/04/01
## PSO
### Flowchart

### The granularity of PSO

### The movement of PSO

### The formula of distance

### Parallel Computing

# 2024/03/25
## GA演算法架構
### Flowchart

### The granularity of GA

### Population initialization

### Roulette Wheel Selection

### Crossover

### Mutation

### Parallel Computing

# 2024/03/18
## (論文題目)基於平行運算之太陽能電廠供電比例最佳化演算法比較與分析:GA, PSO, SA
* 相較於產學內容,多了
* 平行運算(multi-processor based Parallelism)
* PSO最佳化演算法(Particle Swarm Optimization)
* SA最佳化演算法(Simulated annealing)
* **最佳化的目標 : 找出電廠供電的最佳比例,使得電廠總利潤最大化**
\begin{gather*}R_{p_m}=\sum_{n=1}^{j}{{{\ ReLU(T}_{P_mC_n}-\ Demand}_{C_n})}\end{gather*}
<p class="text-center">餘電(Residue) = 電廠所供應的電T(客戶所配到的電) - 客戶需求</p>
\begin{gather*}T_{P_mC_n}=g\left(m,n,Rule\left(w,x\right)\right)\end{gather*}
<p class="text-center">電廠所供應的電 = 所有的電廠供電乘上比例和所有的客戶需求<br>經過台電轉供規章Rule()後<br>再取其對應到的值(電廠m, 客戶n)</p>
\begin{gather*}w=\left[\begin{matrix}Power_1\alpha_{11}&\cdots&Power_i\alpha_{i1}\\\vdots&\ddots&\vdots\\Power_1\alpha_{1j}&\cdots&Power_i\alpha_{ij}\\\end{matrix}\right]\end{gather*}
\begin{gather*}x=\left[Demand_{C_1}\ldots Demand_{C_n}\right]\end{gather*}
<p class="text-center">定義電廠所供應的電和客戶的需求</p>
\begin{gather*}f\left(A\right)=\sum_{m=1}^{i}{Price_{p_m}}R_{p_m}+\sum_{n=1}^{j}{\sum_{m=1}^{i}{Price_{p_m}}T_{P_mC_n}}\end{gather*}
<p class="text-center">定義fitness function (適應函數):餘電賣給台電 X 價格 + 轉供給客戶 X 價格</p>
\begin{gather*}A=\left[\begin{matrix}\alpha_{11}&\cdots&\alpha_{i1}\\\vdots&\ddots&\vdots\\\alpha_{1j}&\cdots&\alpha_{ij}\\\end{matrix}\right],\ \forall\ j∶ \sum_{m=1}^{i}\alpha_{mj}=1 \end{gather*}
<p class="text-center">定義fintness value (適應值)</p>
* **最後推導出目標函數**
\begin{gather*}objective\ function\ =\ argmax\ f(A)\end{gather*}
### 目前實驗結果
:::success
:bulb: 實作
* [詳細實驗結果](https://docs.google.com/spreadsheets/d/1NntgycLCgrU4ZqNnbEuY9r2oHBiginbjzs19PfUz1ak/edit?usp=sharing)
* 皆以最受歡迎的預設參數來實驗
* 以4個電廠3個客戶而言5天的時間點而言
* 餘電賣給台電(電廠價格)皆是4.7238
* 轉供給客戶皆是6.3
* 最佳化利潤結果會是236326元
* 穩定度 SA = PSO > GA (每次執行都容易出現不同結果的程度)
* 執行時間 GA > PSO > SA
* 收斂速度 SA = PSO > GA
* 最佳比例的結果有以下組合等
* [[0.37, 0.33, 0.31], [0.33, 0.3, 0.37], [0.39, 0.26, 0.35], [0.34, 0.3, 0.36]]
* [[0.27, 0.32, 0.41], [0.42, 0.27, 0.3], [0.28, 0.41, 0.32], [0.21, 0.5, 0.3]]
* [[0.33, 0.31, 0.36], [0.48, 0.34, 0.18], [0.38, 0.4, 0.21], [0.15, 0.46, 0.39]]
:::
#### PSO收斂情形

#### GA收斂情形


#### SA收斂情形

# 2023/12/06
## 產學報告
* [Demo網址](https://powerdispatch.streamlit.app)
* [文字簡介](https://hackmd.io/@ChanChingWei/powerdispatch)
### Brief introduction
Use Genetic Algorithm to find the best proportion which single power plant supplies to many clients.

### Genetic Algorithm flowchart

### Python library using

### In progress : Performance Optimization
* Fitness function calculation runs slowly because of CPU-bound bottleneck. (It's only single thread can run at the same time.)
* **Parallel Computing** : use multi-progress.
#### linear, parallel, GPU execution
----

----

----

----

----
### Try more optimization algorithms
* Hill Climbing
* Particle swarm optimization (PSO)
...
## Kubeflow : multi-nodes, multi-users AI platform
### [How to use kubeflow? (PDF)](https://drive.google.com/file/d/1e0CttfrNi8faPOCwG0o2Hb1i-xlZ0LkU/view?usp=sharing)
* AI319,FB207 Server
* Use Charmed-kubeflow and microk8s to deploy kubeflow.
* Ubuntu 22.04 LTS.
----
