2015年10月6日

差分进化算法-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 阅读(9030) 评论(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 阅读(22224) 评论(6) 推荐(2) 编辑

2015年9月25日

桶排序与快速排序算法结合-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 阅读(768) 评论(0) 推荐(0) 编辑

2015年9月23日

简单桶排序算法-python实现

摘要: 1 #-*- coding: UTF-8 -*- 2 import numpy as np 3 4 def BucketSort(a, n): 5 barrel = np.zeros((1, n), dtype = 'int32') 6 for i in xrange(0,a.s... 阅读全文

posted @ 2015-09-23 11:19 Alex Yu 阅读(563) 评论(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 阅读(396) 评论(0) 推荐(0) 编辑

基数排序算法-python实现

摘要: 1 #-*- coding: UTF-8 -*- 2 import numpy as np 3 4 def RadixSort(a): 5 i = 0 #初始为个位排序 6 n = 1 ... 阅读全文

posted @ 2015-09-23 11:18 Alex Yu 阅读(1157) 评论(0) 推荐(0) 编辑

归并排序算法-python实现

摘要: 1 #-*- coding: UTF-8 -*- 2 import numpy as np 3 4 def Merge(a, f, m, l): 5 i = f 6 j = m + 1 7 tmp = [] 8 while i <= m and j <= l: 9... 阅读全文

posted @ 2015-09-23 11:17 Alex Yu 阅读(331) 评论(0) 推荐(0) 编辑

堆排序算法-python实现

摘要: 1 #-*- coding: UTF-8 -*- 2 import numpy as np 3 4 def MakeHeap(a): 5 for i in xrange(a.size / 2 - 1, -1, -1):#对非叶子节点的子节点进行调节,构建堆 6 Adjus... 阅读全文

posted @ 2015-09-23 11:16 Alex Yu 阅读(723) 评论(0) 推荐(0) 编辑

插入排序算法-python实现

摘要: 1 #-*- coding: UTF-8 -*- 2 import numpy as np 3 4 def InsertSort(a): 5 for i in xrange(1,a.size): 6 for j in xrange(i,0, -1): 7 ... 阅读全文

posted @ 2015-09-23 11:15 Alex Yu 阅读(325) 评论(0) 推荐(0) 编辑

冒泡排序算法-Python实现

摘要: 1 #-*- coding: UTF-8 -*- 2 import numpy as np 3 def BubbleSort(a): 4 for i in xrange(0, a.size): 5 for j in xrange(i,a.size): 6 ... 阅读全文

posted @ 2015-09-23 11:14 Alex Yu 阅读(415) 评论(0) 推荐(0) 编辑

导航