Posts

Showing posts from August, 2023

New Post

WFLO in Python || Optimal Placement of Wind Turbines using PSO in Python...

Image
Wind turbine optimal placement using particle swarm optimization Implementation in Python. Video Chapters: 00:00 Introduction 00:30 Key Points 03:17 Implementation 05:50 Flowchart 06:32 Code 23:47 Apply PSO 31:53 Output SOURCE CODE import numpy as np import math import random #Probability Distribution Function def PDF(U,k,c): return (k / c) * (U / c)**(k - 1) * math.exp(-((U / c)**k)) #Calculate Alpha def Cal_alpha(Z,Z_o): return 0.5 / math.log (Z/Z_o) #Calculate Full Wake Effect def Full_WE(u_o,a,alpha,X,R_1): return u_o*(1-(2*a/(1+alpha*(X/R_1)**2))) #Calculate Partial Wake Effect def Partial_WE(u_o,a,alpha,X,R_1,A_Partial,A_Total): return u_o * (1-(2*a/(1+alpha*(X/R_1)**2)))*(A_Partial-A_Total) #Calculate No Wake Effect def No_WE(u_o): return u_o #Calculate Power def Power(u,Ideal_Power): if u<3: return 0 elif 3<=u<=12: return Ideal_Power elif 12<=u<=25: return 518.4 else: return 0 #Calcu

How to Initialize Population by Good-Point Set in Python ~xRay pixy

Image
How to Initialize Population by Good-Point Set in Python ~xRay pixy

GWO Python Code || Grey Wolf Optimizer in Python || ~xRay Pixy

Image
SOURCE CODE import numpy as np import tkinter as tk import matplotlib.pyplot as plt from tkinter import messagebox def initialization (PopSize,D,LB,UB):     SS_Boundary = len(LB) if isinstance(UB,(list,np.ndarray)) else 1     if SS_Boundary ==1:         Positions = np.random.rand(PopSize,D)*(UB-LB)+LB     else:         Positions = np.zeros((PopSize,D))         for i in range(D):             Positions[:,i]=np.random.rand(PopSize)*(UB[i]-LB[i])+LB[i]     return Positions def GWO(PopSize,MaxT,LB,UB,D,Fobj):     Alpha_Pos = np.zeros(D)     Alpha_Fit = np.inf     Beta_Pos = np.zeros(D)     Beta_Fit = np.inf     Delta_Pos = np.zeros(D)     Delta_Fit = np.inf     Positions = initialization(PopSize,D,UB,LB)     Convergence_curve = np.zeros(MaxT)     l = 0     while l<MaxT:         for i in range (Positions.shape[0]):             BB_UB = Positions[i,:]>UB              BB_LB = Positions[i,:]<LB             Positions[i,:] = (Positions[i,:]*(~(BB_UB+BB_LB)))+UB*BB_UB+LB*BB_LB            

Implement TSP in Python ||Travelling Salesman Problem|| ~xRay Pixy

Image
Travelling salesman problem implementation in Python. Video Chapters: 00:00 Introduction 00:34 TSP Code 06:51 Calculate the Total Distance 11:17 Find Out the Optimal Route and Minimum Distance 15:03 Output 16:00 Conclusion
More posts