Code Monkey home page Code Monkey logo

genetic-algorithm-matlab's People

Contributors

alpsayin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

genetic-algorithm-matlab's Issues

I want to maximize this function, but the code can't find the optimal solution

I replaced the target function in EvaluateIndividual.m file:
x1=x(1); x2=x(2); fitnessValue =- (-40*x1*cos(x2)-35*x2*sin(x1)+15*x1^2-sin(x1)*20+12*x2^2-25*x1*x2*sin(x1*x2^2*cos(x1+x2)));

at the same time, I changed the genetic algorithm Settings parameters in FunctionOptimization.m file:
`
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Alp Sayin - alp_sayin[at]ieee[dot]org
% Matlab Genetic Algorithm
% Spring 2012
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% CLEAN-UP
clear;close all;clc;
tic

%% PARAMETERS
populationSize = 1000 ;
numberOfGenes = 40;
crossoverProbability = 0.8 ;
mutationProbability = 0.0625;
tournamentSelectionParameter = 0.5;
variableRange = 50.0;
numberOfGenerations = 5000;
numberOfVariables = 2;
tournamentSize = 10;
numberOfReplications = 2;
verbose = true;
draw_plots = true;
% UNLESS THE FITNESS FUNCTION IS REALLY DIFFICULT TO COMPUTE, IT'S FASTER
% NOT TO USE PARALLEL COMPUTATION
runparallel = false;
`
The maximum value should be 735.484897639184,The corresponding two parameter values should be :
x1: -20.3956600843891
x2: -22.0150462042061

but this matlab code can't find the best solution:
image

Maximum Fitness: 7.286375e+02
Best Solution: 17.1875
Best Solution: -18.843
时间已过 120.739511 秒。

Is there a way you can improve the search capability of your genetic algorithm ?

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.