随笔分类 -  Python

萤火虫算法-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 阅读(8367) 评论(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 阅读(3153) 评论(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 阅读(5197) 评论(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 阅读(4355) 评论(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 阅读(3567) 评论(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 阅读(5181) 评论(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 阅读(5538) 评论(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 阅读(7229) 评论(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 阅读(9564) 评论(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 阅读(15850) 评论(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 阅读(9109) 评论(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 阅读(22318) 评论(6) 推荐(2)

桶排序与快速排序算法结合-python实现
摘要:1 #-*- coding: UTF-8 -*- 2 import numpy as np 3 from QuickSort import QuickSort 4 5 def BucketSort(a, n): 6 barrel = {} 7 for i in xrange(0,... 阅读全文

posted @ 2015-09-25 12:18 Alex Yu 阅读(782) 评论(0) 推荐(0)

希尔排序算法-python实现
摘要:1 #-*- coding: UTF-8 -*- 2 import numpy as np 3 4 def ShellSort(a): 5 gap = a.size / 2 6 while gap >= 1: 7 for i in xrange(gap,a.siz... 阅读全文

posted @ 2015-09-23 11:19 Alex Yu 阅读(404) 评论(0) 推荐(0)

Python一些特殊用法(map、reduce、filter、lambda、列表推导式等)
摘要:Map函数:原型:map(function, sequence),作用是将一个列表映射到另一个列表,使用方法:def f(x): return x**2l = range(1,10)map(f,l)Out[3]: [1, 4, 9, 16, 25, 36, 49, 64, 81]Reduce函数原型:reduce(function, sequence, startValue),作用是将一个列表归纳为一个输出,使用方法:def f2(x,y): return x+yreduce(f1,l)Out[7]: 45reduce(f2,l,10)Out[8]: 55Filter函数原型:filter.. 阅读全文

posted @ 2014-01-23 14:13 Alex Yu 阅读(19005) 评论(1) 推荐(6)

导航