GithubHelp home page GithubHelp logo

xavier-mayiming / gravitational-search-algorithm Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 28 KB

Gravitational Search Algorithm

MATLAB 98.31% M 1.69%
global-optimization gravitational-search-algorithm matlab metaheuristics

gravitational-search-algorithm's Introduction

Gravitational Search Algorithm

Reference: Rashedi E, Nezamabadi-Pour H, Saryazdi S. GSA: a gravitational search algorithm[J]. Information Sciences, 2009, 179(13): 2232-2248.
Variables Meaning
pop Population size
iter Iteration number
lb The lower bound (list)
ub The upper bound (list)
pos The position of agents (list)
score The score of agents (list)
mass The mass of agents (list)
acc The acceleration of agents (list)
vel The velocity of agents (list)
G The gravitational constant
dim Dimension
gbest The score of the global best agent
iter_best The global best score of each iteration (list)
con_iter The last iteration number when "gbest" is updated

Test problem

$$ f(x)=\sum_{i=1}^{30}x_i^2,\qquad -100\leq x_i\leq100, \quad i=1,\cdots, 30. $$

Example

clear all;
clc;

pop = 50;
iter = 1000;
lb = ones(1, 30) .* (-100);
ub = ones(1, 30) .* 100;
[gbest, gbest_pos, iter_best, con_iter] = GSA(pop, iter, lb, ub);

% Plot the convergence curve
x = 1 : iter;
loglog(x, iter_best);
grid on;
title('Convergence curve');
xlabel('Iteration');
ylabel('Objective value');
Output:

The GSA converges at its 999-th iteration, and the global best value is 2.1691e-17.

gravitational-search-algorithm's People

Contributors

xavier-mayiming avatar

Stargazers

 avatar  avatar  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.