alpsayin / genetic-algorithm-matlab Goto Github PK
View Code? Open in Web Editor NEWA very simple Genetic Algorithm implementation for matlab, easy to use, easy to modify runs fast.
License: MIT License
A very simple Genetic Algorithm implementation for matlab, easy to use, easy to modify runs fast.
License: MIT License
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:
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 ?
How do we perform multivariable optimization?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.