Giter Club home page Giter Club logo

metaheuristicoptimizationalgorithms's Introduction

MetaheuristicOptimizationAlgorithms

This repository contains 4 metaheuristic search algorithms 1) Genetic Algorithm 2) Differential Evolution 3) Cuckoo Search 4) Harmony Search and I used minimization problem which called the Michalewicz test function for the performance of algorithms. I don't test algorithms carefully, therefore somewhere in the codes, there might be some flaws.I've been trying to write these codes in Python as efficiently as possible. My request you who will look into codes please criticize me and show my mistakes or better way to write code. Contact with me at [email protected] Example

import numpy as np
from GA_functions import genetic_algorithm
import time
import matplotlib.pyplot as plt

start = time.perf_counter()
nd = 5
lb = np.array([0] * nd)
ub = np.array([np.pi] * nd)
P = 50
Generation = 2500
m = 15
minprob = True
Pc = 0.85
Pm = 0.03


def michalewicz(xx):
    mm = 10
    n1 = np.shape(xx)[0]
    n2 = np.shape(xx)[1]
    outputs = np.zeros((n1, 1))
    for i in range(n1):
        s = 0
        for j in range(1, n2 + 1):
            s = s + np.sin(xx[i, j - 1]) * (np.sin(j * xx[i, j - 1] ** 2 / np.pi)) ** (2 * mm)
        outputs[i, 0] = -s
    return outputs


list1 = genetic_algorithm(P, nd, lb, ub, michalewicz, Generation)
list2 = range(0, Generation)
end = time.perf_counter()
print('Process time is {}'.format(end-start))
plt.plot(list2, list1, label="graph", color="red")
plt.semilogx()
plt.xlabel("GENERATİON", color="blue")
plt.ylabel("OBJECTİVE VALUES", color="blue")
plt.legend()
plt.show()

Exampes also avaliable in the given codes. Hope this repository will be useful for those interested

metaheuristicoptimizationalgorithms's People

Contributors

onursahin20 avatar

Stargazers

 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.