"""A simple OOP example of 3D-FOA by Python to find the min value of QF Author: Wei-Yuan LinSoochow University, TaipeiTaiwanVer.3In this version, there are two classes - Fly and FOA.The Fly class represents each individual fly in the swarmThis code implements the Fruitfly Optimization Algorithm (FOA) to optimize a function called "smell". FOA is a nature-inspired...
CI Algorithms - Fruit Fly Optimization Algorithm (FFOA)
Sunday, March 12, 2023
Wednesday, March 1, 2023
Posted on 1:24 PM by linwayne8888@gmail.com
| No comments
The FOA with constraints program generated by ChatGPTimport randomimport numpy as np# Define the optimization problem with constraintsdef objective_function(x): # objective function: x1^2 + x2^2 + x3^2 # constraint: 2*x1 + 3*x2 + 4*x3 <= 5 f = x[0]**2 + x[1]**2 + x[2]**2 g = 2*x[0] + 3*x[1] + 4*x[2] - 5 if g > 0: ...
Thursday, October 18, 2018
A simple example of 3D-FOA by Python
Posted on 6:46 PM by linwayne8888@gmail.com
| 35 comments
##A simple example of 3D-FOA by Python# Find the min value of QF by FOA
"""
author: Wei-Yuan LinSoochow University, TaipeiTaiwanVer.2"""
import numpy as npimport matplotlib.pyplot as plt
Population = 100Gen = 100def initParams(bestX,bestY,bestZ,Population): location = [] fitness = [] for num in range(Population): x,y,z= bestX+2*np.random.rand()-1,bestY+2*np.random.rand()-1,bestZ+2*np.random.rand()-1 ...
Subscribe to:
Posts (Atom)