Giter Site home page Giter Site logo

shoham-roy31 / catswarmoptimization Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 13 KB

Python implementation of an Evolution based Optimization algorithm, named Cat Swarm Optimization

License: MIT License

Python 100.00%
cat-swarm-optimization cso heuristic-search-algorithms meta numpy python3 swarm-optimization-algorithm

catswarmoptimization's Introduction

Cat Swarm Optimization

Python implementation of an Swarm based Optimization algorithm, named Cat Swarm Optimization. This meta heuristic optimization technique was developed by Chu and Tsai (2007).Although there are many modified versions of CSO proposed, the original vanilla version is implemented.

Inspired from the behavior of a population of cats, where they are likely to be in either of the two modes, Seeking or Tracing Mode. Cats rather spend being alert in Seeking mode to conserve their energy to locate the pray before they execute their hunt. This process of locating the solution in a search space elaborates an efficient and accurate hunting behavior of cats.

This algorithm of cats can be utilised by choosing a population of cats interacting with the environment in an M dimensional map with their position X(i,d) and velocity v(i,d). Where Xbest is the best position searched by a cat in that search space.

Seeking Mode (Resting)

During this mode the cat is resting while keeping an eye on its environment. In case of sensing a prey or danger, the cat decides its next move. If the cat decides to move, it does that slowly and cautiously. Just like while resting, in the seeking mode the cat observes into the M-dimensional solution space in order to decide its next move. In this situation, the cat is aware of it own situation, its environment, and the choices it can make for its movement. These are represented in the CSO algorithm by using four parameters: seeking memory pool (SMP), seeking range of the selected dimension (SRD), counts of dimension to change (CDC), and self-position consideration (SPC). SMP is the number of the copies made of each cat in the seeking process. SRD is the maximum difference between the new and old values in the dimension selected for mutation.CDC tells how many dimensions will be mutated. All these parameters define the seeking process of the algorithm.SPC is the Boolean variable which indicates the current position of the cat as a candidate position for movement. SPC cannot affect the value of SMP.

Xcn = (1 ± SRD × R) × Xc

in which, Xc current position

Xcn new position

R a random number, which varies between 0 and 1

The probability parameter Pi in the orginal litrature has been modified into aggressive allocation of the best solution among the involved population of cats in the seeking mode.Since this method proved stable and faster convergence towards a solution.

Tracing Mode (Movement)

The tracing mode simulates the cat chasing a prey. After finding a prey while resting (seeking mode), the cat decides its movement speed and direction based on the prey's position and speed. In CSO, the velocity of the cat k in demension d is given by

vk,d = vk,d + r1 × c1(Xbest,d - Xk,d)

in which, vk,d = velocity of cat k in dimension d; Xbest,d = position of the cat with the best solution; Xk,d = position of the catk; c1 = a constant; and r1 = a random value in the range [0,1]. Using this velocity, the cat moves in the M-dimensional decision space and reports every new position it takes.If the velocity of the cat is greater than the maximum velocity, its velocity is set to the maximum velocity. The new position of each cat is calculated by

Xk,d,new = Xk,d,old + vk,d

in which Xk,d,new new position of cat k in dimension d ; and

Xk,d,old current position of cat k in dimension d.

-- Refrenced from Advanced Optimization by Nature-Inspired Algorithms by Omid Bozorg-Haddad

Cost Function

One can customize their cost function, it is applicable to any type of Univariate equations.

catswarmoptimization's People

Contributors

shoham-roy31 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.