- Notifications
You must be signed in to change notification settings - Fork0
an AntennaCAT compatible chicken swarm optimizer. Includes branches for a traditional chicken swarm, improved chicken swarm, and a 'quantum' inspired movement model for chicken swarm
License
LC-Linkous/chicken_swarm_python
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Basic chicken swarm optimizer written in Python. Modified from theadaptive timestep PSO optimizer byjonathan46000 to keep a consistent format across optimizers in AntennaCAT.
Now featuring AntennaCAT hooks for GUI integration and user input handling.
- Chicken Swarm Optimization
- Requirements
- Implementation
- Examples
- References
- Publications and Integration
- Licensing
The Chicken Swarm Optimization (CSO) algorithm, introduced by Meng et al. in 2014 [1], is inspired by the hierarchy and behaviors observed in a swarm of chickens, including roosters, hens, and chicks. Each type of bird has its own unique movement rules and interactions.
In CSO, there is an absence of a direct random velocity component, which is an important distinction from many PSO variations, though it is not the only variation without a velocity vector. Instead, the movements are based on specific behaviors and social interactions within the swarm. Generally, the movement rules for each type of bird in CSO can be described as:
Roosters:
Roosters have the best positions (fitness values) in the swarm. They move based on their current position and the random perturbation to avoid getting stuck in local optima.
Hens:
Hens follow roosters. They update their positions based on the positions of the roosters they follow and a randomly selected chicken. This reflects the social hierarchy and interaction in the swarm.
Chicks:
Chicks follow their mother hens. They update their positions based on their mother's positions with some random factor to simulate the dependent behavior.
This project requires numpy and matplotlib.
Use 'pip install -r requirements.txt' to install the following dependencies:
contourpy==1.2.1cycler==0.12.1fonttools==4.51.0importlib_resources==6.4.0kiwisolver==1.4.5matplotlib==3.8.4numpy==1.26.4packaging==24.0pillow==10.3.0pyparsing==3.1.2python-dateutil==2.9.0.post0six==1.16.0zipp==3.18.1
Users must create their own constraint function for their problems, if there are constraints beyond the problem bounds. This is then passed into the constructor. If the default constraint function is used, it always returns true (which means there are no constraints).
This optimizers has 4 different types of bounds, Random (Particles that leave the area respawn), Reflection (Particles that hit the bounds reflect), Absorb (Particles that hit the bounds lose velocity in that direction), Invisible (Out of bound particles are no longer evaluated).
Some updates have not incorporated appropriate handling for all boundary conditions. This bug is known and is being worked on. The most consistent boundary type at the moment is Random. If constraints are violated, but bounds are not, currently random bound rules are used to deal with this problem.
The no preference method of multi-objective optimization, but a Pareto Front is not calculated. Instead the best choice (smallest norm of output vectors) is listed as the output.
The optimizer minimizes the absolute value of the difference from the target outputs and the evaluated outputs. Future versions may include options for function minimization absent target values.
The current internal optimization function takes 3 inputs, and has 2 outputs. It was created as a simple 3-variable optimization objective function that would be quick to converge.
Function Feasible Decision Space and Objective Space with Pareto Front
| Num. Input Variables | Boundary | Constraints |
|---|---|---|
| 3 |
This function has three files:
- configs_F.py - contains imports for the objective function and constraints, CONSTANT assignments for functions and labeling, boundary ranges, the number of input variables, the number of output values, and the target values for the output
- constr_F.py - contains a function with the problem constraints, both for the function and for error handling in the case of under/overflow.
- func_F.py - contains a function with the objective function.
Other multi-objective functions can be applied to this project by following the same format (and several have been collected into a compatible library, and will be released in a separate repo)
main_test.py provides a sample use case of the optimizer.
main_test_details.py provides an example using a parent class, and the self.suppress_output and detailedWarnings flags to control error messages that are passed back to the parent class to be printed with a timestamp. This implementation sets up the hooks for integration with AntennaCAT in order to provide the user feedback of warnings and errors.
main_test_graph.py provides an example using a parent class, and the self.suppress_output and detailedWarnings flags to control error messages that are passed back to the parent class to be printed with a timestamp. Additionally, a realtime graph shows particle locations at every step.
NOTE: if you close the graph as the code is running, the code will continue to run, but the graph will not re-open.
[1] X. B. Meng, Y. Liu, X. Gao, and H. Zhang, "A new bio-inspired algorithm: Chicken swarm optimization," in Proc. Int. Conf. Swarm Intell. Cham, Switzerland, Springer, 2014, pp. 86–94.
This software works as a stand-alone implementation, and as one of the optimizers integrated into AntennaCAT.
Publications featuring the code in this repo will be added as they become public.
The code in this repository has been released under GPL-2.0
About
an AntennaCAT compatible chicken swarm optimizer. Includes branches for a traditional chicken swarm, improved chicken swarm, and a 'quantum' inspired movement model for chicken swarm
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.

