Hi, I have 2 questions 1.) How do you handle discrete variables(integer coordinates in the position) ? 2.) How do you update the positions to satisfy the constraints if they exist?
@@pyshine_official I used cmd .No error.and also used latest version ....I am getting x axis ,and y axis coordinates but inside that I am not getting target point instead getting full black ...........
I had the same problem. Solved it by adding "ax1 = fig.add_subplot(111)" after the 6th line of the code and then I modified the 9th line to "ax = fig.add_subplot(111, sharex=ax1, sharey=ax1)". The black screen apparently has something to do with the new version of Matpotlib. I'm using Python 3.8.5 and Matplotlib 3.4.2
I'm so glad! thank you! Your little experiment gave me the base knowledge to go on, and try a lot of things I study in my engineering graduation. Could I try do a colab version of this code?
We appreciate your concern and motivation to work on PSO research. AI algorithms always have a room of improvement. Please enlighten us about your suggestions
@@vigneshwarrajraj3150 Exactly, also note that the bounding region in lat long case will be in their standard max limits according to your requirements
I have this error when running File "/home/pradeepkumar/Desktop/PSO2020/Draggable.py", line 51 print(str(self.point.center[0])+','+str( self.point.center[1]),file = open('target.csv','w')) ^ SyntaxError: invalid syntax
Yes, in the list of circles you can add more targets as follows: circles = [patches.Circle( (10, -10), 20, label='Click to drag the Target', fc = 'k',color = 'k', alpha=1),patches.Circle( (10, -50), 20, label='Click to drag the Target', fc = 'r',color = 'r', alpha=1)]
@@dibyasanjanasahu738 Hello! You can use the tutorial here pyshine.com/Make-an-Interactive-Particle-Swarm-Optimization-algorithm/ As a startup, try changing the local and global values and then proceed to change the cost function, the number of dimensions in it. Generate the csv file that will give the plot of cost function using the method in here for real time plot pyshine.com/How-to-plot-real-time-frame-rate-in-opencv-and-matplotlib/ Additonal readings: www.mdpi.com/2227-9717/7/10/733
Hi ! PSO is good at maximizing or minimizing the cost function, which is itself an equation. For example if its a distance equation, then of course minimum value of distance is 0, which PSO tend to find. In real life problems the PSO can be applied by modeling an equation of the problem and the use it as a cost function. Now if by predicting equation your meaning is curve fitting based on the dataset, then the search dimensions of PSO will increase. Because in that case PSO will be applied to find the values of the possible cofficients of the polynomial equation. In that case yes PSO can be applied, however also consider narrow down the problem by using Deep neural networks in combination with PSO.
Do you mean that we need to give an equation with some input variables (I think these variables are called particles?) then PSO identifies which input has to remove from the equation and providing the best solution? OR You mean to say that we only provide the input variables as per their varying parameters, and PSO develops the prediction equation? OR Does PSO facilitate both of the above statements?
@@gauravverma365 Yes the second one, for example to find the solution for func(x) = x1^2 + x2^2+x3^2, the particle can be set as (x1, x2, x3), and fitness function is func(x). After that we can use the standard procedure to find the optimum. Its about minimizing the loss or difference between a guess and current true value. Each particle has a random guess as a part in its current velocity. Once the guess is under a satisfaction creteria; either max number of iterations reached or error below a given threshold, the search process is complete. So yes its about giving the parameters.
Hi, I have 2 questions
1.) How do you handle discrete variables(integer coordinates in the position) ?
2.) How do you update the positions to satisfy the constraints if they exist?
Can you tell why fitness values is suddenly increasing in case of feature optimization on the image in some case ? Madam
Hi, I am getting black screen while executing Draggable file.
Hi, is there any error or traceback appearing in the powershell window? Which version of Matplotlib is used?
@@pyshine_official I used cmd .No error.and also used latest version ....I am getting x axis ,and y axis coordinates but inside that I am not getting target point instead getting full black ...........
@@harshanavada2908 Alright, please use Python 3.6.5 and Matplotlib version 2.2.4, you can install it via pip3.6 install matplotlib==2.2.4
@الامبراطورية العلمية Please use Python 3.6.5 and Matplotlib 2.2.4
I had the same problem. Solved it by adding "ax1 = fig.add_subplot(111)" after the 6th line of the code and then I modified the 9th line to "ax = fig.add_subplot(111, sharex=ax1, sharey=ax1)". The black screen apparently has something to do with the new version of Matpotlib. I'm using Python 3.8.5 and Matplotlib 3.4.2
I'm so glad! thank you!
Your little experiment gave me the base knowledge to go on, and try a lot of things I study in
my
engineering graduation.
Could I try do a colab version of this code?
Hi you're welcome. Yes it would be nice to try on colab.
hi please help i'm getting the black screen and the target and particles dont move :(
Please check the Matplotlib version
Can we work together to improve this method?
We appreciate your concern and motivation to work on PSO research. AI algorithms always have a room of improvement. Please enlighten us about your suggestions
@@pyshine_official Done, thanks
Can we use this for solving travelling salesman problem?
Hi, yes PSO is effective for solving TSP. Try github.com/marcoscastro/tsp_pso/blob/master/tsp_pso.py
I tried it on my computer. Its showing this error: FileNotFoundError: [Errno 2] No such file or directory: 'target.csv'
Hi, this file will be generated by the draggable.py. Please run it alone to check if is generating the file?
can i use latitude and longitude points and find out the least distant path with this code?
Yes you can keep it floating point
@@pyshine_official okay so i just have to input the latitude and longitudes with data type as floats? thanks a lot, a lot!!!
@@vigneshwarrajraj3150 Exactly, also note that the bounding region in lat long case will be in their standard max limits according to your requirements
I have this error when running
File "/home/pradeepkumar/Desktop/PSO2020/Draggable.py", line 51
print(str(self.point.center[0])+','+str( self.point.center[1]),file = open('target.csv','w'))
^
SyntaxError: invalid syntax
Hi, Please tell me which Python version you are using? The code runs well under Python 3.6.5
hi !!
How can I add more target in the draggable.py file?
Could you share the code snippet?
Yes, in the list of circles you can add more targets as follows:
circles = [patches.Circle( (10, -10), 20, label='Click to drag the Target', fc = 'k',color = 'k', alpha=1),patches.Circle( (10, -50), 20, label='Click to drag the Target', fc = 'r',color = 'r', alpha=1)]
@@pyshine_official Thanks a lot. I am very much helpful.
Thanks again
Hi... actually am doing literature review in this PSO can you help me pl. Am in very primitive stage.
@@dibyasanjanasahu738 Hello! You can use the tutorial here pyshine.com/Make-an-Interactive-Particle-Swarm-Optimization-algorithm/
As a startup, try changing the local and global values and then proceed to change the cost function, the number of dimensions in it. Generate the csv file that will give the plot of cost function using the method in here for real time plot pyshine.com/How-to-plot-real-time-frame-rate-in-opencv-and-matplotlib/
Additonal readings: www.mdpi.com/2227-9717/7/10/733
Hi...
I am here to know that does PSO facilitate the predicting equation as well?
Hi ! PSO is good at maximizing or minimizing the cost function, which is itself an equation. For example if its a distance equation, then of course minimum value of distance is 0, which PSO tend to find. In real life problems the PSO can be applied by modeling an equation of the problem and the use it as a cost function. Now if by predicting equation your meaning is curve fitting based on the dataset, then the search dimensions of PSO will increase. Because in that case PSO will be applied to find the values of the possible cofficients of the polynomial equation. In that case yes PSO can be applied, however also consider narrow down the problem by using Deep neural networks in combination with PSO.
Do you mean that we need to give an equation with some input variables (I think these variables are called particles?) then PSO identifies which input has to remove from the equation and providing the best solution?
OR
You mean to say that we only provide the input variables as per their varying parameters, and PSO develops the prediction equation?
OR
Does PSO facilitate both of the above statements?
@@gauravverma365 Yes the second one, for example to find the solution for func(x) = x1^2 + x2^2+x3^2, the particle can be set as (x1, x2, x3), and fitness function is func(x). After that we can use the standard procedure to find the optimum. Its about minimizing the loss or difference between a guess and current true value. Each particle has a random guess as a part in its current velocity. Once the guess is under a satisfaction creteria; either max number of iterations reached or error below a given threshold, the search process is complete. So yes its about giving the parameters.
@@pyshine_official thanks for the brief information 👍
@@gauravverma365 You’re welcome.