随笔分类 -  Algorithm

萤火虫算法-python实现
摘要:FAIndividual.py 1 import numpy as np 2 import ObjFunction 3 4 5 class FAIndividual: 6 7 ''' 8 individual of firefly algorithm 9 '''10 1... 阅读全文

posted @ 2015-10-09 22:23 Alex Yu 阅读(8355) 评论(5) 推荐(3)

进化策略-python实现
摘要:ESIndividual.py 1 import numpy as np 2 import ObjFunction 3 4 5 class ESIndividual: 6 7 ''' 8 individual of evolutionary strategy 9 '''... 阅读全文

posted @ 2015-10-09 22:18 Alex Yu 阅读(3148) 评论(0) 推荐(0)

和声搜索算法-python实现
摘要:HSIndividual.py 1 import numpy as np 2 import ObjFunction 3 4 5 class HSIndividual: 6 7 ''' 8 individual of harmony search algorithm 9 ... 阅读全文

posted @ 2015-10-06 22:45 Alex Yu 阅读(5190) 评论(1) 推荐(0)

克隆选择算法-python实现
摘要:CSAIndividual.py 1 import numpy as np 2 import ObjFunction 3 4 5 class CSAIndividual: 6 7 ''' 8 individual of clone selection algorithm 9 ... 阅读全文

posted @ 2015-10-06 22:42 Alex Yu 阅读(4353) 评论(1) 推荐(0)

细菌觅食算法-python实现
摘要:BFOIndividual.py 1 import numpy as np 2 import ObjFunction 3 4 5 class BFOIndividual: 6 7 ''' 8 individual of baterial clony foraging algor... 阅读全文

posted @ 2015-10-06 22:39 Alex Yu 阅读(3561) 评论(2) 推荐(1)

蝙蝠算法-python实现
摘要:BAIndividual.py 1 import numpy as np 2 import ObjFunction 3 4 5 class BAIndividual: 6 7 ''' 8 individual of bat algorithm 9 '''10 11 ... 阅读全文

posted @ 2015-10-06 22:37 Alex Yu 阅读(5176) 评论(4) 推荐(0)

人工免疫算法-python实现
摘要:AIAIndividual.py 1 import numpy as np 2 import ObjFunction 3 4 5 class AIAIndividual: 6 7 ''' 8 individual of artificial immune algorithm 9... 阅读全文

posted @ 2015-10-06 22:35 Alex Yu 阅读(5530) 评论(2) 推荐(0)

人工鱼群算法-python实现
摘要:AFSIndividual.py 1 import numpy as np 2 import ObjFunction 3 import copy 4 5 6 class AFSIndividual: 7 8 """class for AFSIndividual""" 9 10 ... 阅读全文

posted @ 2015-10-06 22:33 Alex Yu 阅读(7226) 评论(1) 推荐(5)

人工蜂群算法-python实现
摘要:ABSIndividual.py 1 import numpy as np 2 import ObjFunction 3 4 5 class ABSIndividual: 6 7 ''' 8 individual of artificial bee swarm algorith... 阅读全文

posted @ 2015-10-06 22:30 Alex Yu 阅读(9558) 评论(8) 推荐(1)

粒子群优化算法-python实现
摘要:PSOIndividual.py 1 import numpy as np 2 import ObjFunction 3 import copy 4 5 6 class PSOIndividual: 7 8 ''' 9 individual of PSO10 '''11... 阅读全文

posted @ 2015-10-06 22:28 Alex Yu 阅读(15841) 评论(8) 推荐(3)

差分进化算法-python实现
摘要:DEIndividual.py 1 import numpy as np 2 import ObjFunction 3 4 5 class DEIndividual: 6 7 ''' 8 individual of differential evolution algorith... 阅读全文

posted @ 2015-10-06 22:25 Alex Yu 阅读(9102) 评论(8) 推荐(2)

简单遗传算法-python实现
摘要:ObjFunction.py 1 import math 2 3 4 def GrieFunc(vardim, x, bound): 5 """ 6 Griewangk function 7 """ 8 s1 = 0. 9 s2 = 1.10 fo... 阅读全文

posted @ 2015-10-06 22:21 Alex Yu 阅读(22312) 评论(6) 推荐(2)

N皇后问题java实现
摘要:N皇后问题是一个典型的约束求解问题,利用递归机制,可以很快的得到结果。 N皇后问题的描述:在一个n*n的棋盘上,摆放n个皇后,要求每个皇后所在行、列、以及两个对角线上不能出现其他的皇后,否则这些皇后之间将会相互攻击。如下图所示。 利用递归机制,可以很容易的求解n皇后问题。针对八皇后,总共有92种解。下面将给出N-皇后问题的一般求解代码,在这里代码是使用java编码的。 总共设计了三个类,一个是皇后类(Queen),一个棋盘类(Board),一个是求解主程序类(NQueens)。具体代码如下: 1: import java.util.ArrayList; 2: import java.... 阅读全文

posted @ 2012-10-05 20:18 Alex Yu 阅读(5557) 评论(0) 推荐(0)

遗传算法Java实现以及TSP问题遗传算法求解
摘要:在以前的文章(简单遗传算法MATLAB实现)中已经介绍过,遗传算法是一种基于达尔文生物进化论的启发式算法,它的核心思想就是优胜劣汰,适应性好的个体将在生存竞争中获得更大的生存机会,而适应差的将更有可能在竞争中失败,从而遭到淘汰。1. 生物进化 图1用了一个非常形象的实例,来表现进化机制对生物繁衍的作用。图1 眼睛的进化(摘自http://blog.csdn.net/zzwu/article/details/561588) 可以设想,曾有一个时期动物就根本没有眼睛。那时,动物在它们的环境中航行完全是靠嗅觉和触觉来躲避掠食它们的动物。他们也相当擅长于这样做,因为他们靠这样已经历了成千上万个世代.. 阅读全文

posted @ 2012-10-02 12:35 Alex Yu 阅读(22481) 评论(4) 推荐(1)

蚁群算法java实现以及TSP问题蚁群算法求解
摘要:1. 蚁群算法简介 蚁群算法(Ant Clony Optimization, ACO)是一种群智能算法,它是由一群无智能或有轻微智能的个体(Agent)通过相互协作而表现出智能行为,从而为求解复杂问题提供了一个新的可能性。蚁群算法最早是由意大利学者Colorni A., Dorigo M. 等于19... 阅读全文

posted @ 2012-09-26 18:14 Alex Yu 阅读(50259) 评论(11) 推荐(11)

Newton method MATLAB 实现
摘要:%求解目标函数:f(x) = cos(x) - x^3%x0 is initial value%err: stop condition%output root: the root of the functionfunction root = NewtonMethod(x0,err)f_x0 = cos(x0) - x0^3;%f(x0)的函数值f_x0_diff = -sin(x0)-3*x0^2;%f(x0)的导数x1 = x0 - f_x0/f_x0_diff;delta = abs(x1 - x0);while delta > err x0 = x1; f_x0 = cos(x0) 阅读全文

posted @ 2011-12-03 18:49 Alex Yu 阅读(2209) 评论(0) 推荐(0)

Secant method MATLAB 实现
摘要:%求解目标函数:f(x) = 4*x^3-16*x^2+17*x-4%x1, x2 are two initial values%err: stop condition%output root: the root of the functionfunction root = secant (x1,x2,err)f_x1 = 4*x1^3-16*x1^2+17*x1-4;%f(x1)的函数值f_x2 = 4*x2^3-16*x2^2+17*x2-4;%f(x2)的函数值delta = abs(x2 - x1);while delta > err x3 = x2 - f_x2 * (x2 - 阅读全文

posted @ 2011-12-03 18:43 Alex Yu 阅读(3858) 评论(0) 推荐(0)

简单遗传算法MATLAB实现
摘要:遗传算法的概念最早是由Bagley J.D 于1967年提出的。后来Michigan大学的J.H.Holland教授于1975年开始对遗传算法(Genetic Algorithm, GA)的机理进行系统化的研究。遗传算法是对达尔文生物进化理论的简单模拟,其遵循“适者生存”、“优胜略汰”的原理。遗传算法模拟一个人工种群的进化过程,并且通过选择、杂交以及变异等机制,种群经过若干代以后,总是达到最优(或近最优)的状态。自从遗传算法被提出以来,其得到了广泛的应用,特别是在函数优化、生产调度、模式识别、神经网络、自适应控制等领域,遗传算法更是发挥了重大的作用,大大提高了问题求解的效率。遗传算法也是当前“ 阅读全文

posted @ 2011-12-03 12:43 Alex Yu 阅读(142601) 评论(11) 推荐(21)

导航