2013年5月24日

CUDA速度测试

摘要: CPU ==> AMD X4 635GPU ==> GeForce GT 240三个很简单的测试..1. 最笨的算法,一堆FOR..2. 四个线程(4物理核的CPU)..各算一块3.GPU 分成64*64个BLOCK..每个BLOCK 16*16个线程4.使用CUBLAS库结果如下6687720.500000, 6869132.500000, 6410965.000000, 6952017.500000TIMES: 471256687720.500000, 6869132.500000, 6410965.000000, 6952017.500000TIMES: 1420366877 阅读全文

posted @ 2013-05-24 21:25 郁郁思扬 阅读(3829) 评论(0) 推荐(0) 编辑

2013年5月22日

人工鱼群算法 AFSA

摘要: 寻优还可以,速度跟不上.. 国产的支持一把 1 -- 人工鱼群算法 AFSA 2 3 -- lua 相关简易操作 4 sin = math.sin 5 cos = math.cos 6 sqrt = math.sqrt 7 pi = math.pi 8 random = math.random 9 exp = math.exp 10 int = math.floor 11 12 -- 获得不同的随机序列 13 math.randomseed(os.time()) 14 15 -- ==============================求解函数===========... 阅读全文

posted @ 2013-05-22 04:11 郁郁思扬 阅读(1325) 评论(0) 推荐(1) 编辑

2013年5月21日

遗传算法 GA

摘要: 保留精英, 选择函数可能有问题 1 -- 遗传算法 GA 2 3 -- lua 相关简易操作 4 sin = math.sin 5 cos = math.cos 6 sqrt = math.sqrt 7 pi = math.pi 8 random = math.random 9 exp = math.exp 10 int = math.floor 11 12 13 -- 获得不同的随机序列 14 math.randomseed(os.time()) 15 16 17 -- ==============================求解函数=============... 阅读全文

posted @ 2013-05-21 12:49 郁郁思扬 阅读(643) 评论(0) 推荐(0) 编辑

2013年5月20日

粒子群算法 PSO

摘要: 中规中矩, 没有ABC快 1 -- 粒子群算法 PSO(全局,变权重) 2 3 -- lua 相关简易操作 4 sin = math.sin 5 cos = math.cos 6 sqrt = math.sqrt 7 pi = math.pi 8 random = math.random 9 exp = math.exp 10 int = math.floor 11 12 13 -- 获得不同的随机序列 14 math.randomseed(os.time()) 15 16 17 -- ==============================求解函数======... 阅读全文

posted @ 2013-05-20 20:19 郁郁思扬 阅读(682) 评论(0) 推荐(0) 编辑

人工蜂群算法 ABC

摘要: 刚用LUA写了AGSO算法,效果奇差无比. 可能写错了..下面这个蜂群算法.效果很好.跳出局部最优的能力比较强! 1 -- 人工蜂群算法 ABC 2 3 4 -- lua 相关简易操作 5 sin = math.sin 6 cos = math.cos 7 sqrt = math.sqrt 8 pi = math.pi 9 random = math.random 10 exp = math.exp 11 int = math.floor 12 13 14 -- 获得不同的随机序列 15 math.randomseed(os.time()) 16 17 18 --... 阅读全文

posted @ 2013-05-20 02:19 郁郁思扬 阅读(6900) 评论(0) 推荐(1) 编辑

2013年5月19日

AGSO 萤火虫算法

摘要: -- 今天用LUA写了一个萤火虫算法..发现很差....可能写的不对..改天再改一下 1 --算法说明:荧火虫算法 2 3 4 -- ================================初始化开始================================ 5 domx = { { -1, 2 }, { -1, 2 } }; -- 定义域 6 rho = 0.4 --荧光素挥发因子 7 gamma = 0.6 -- 适应度提取比例 8 beta = 0.08 -- 邻域变化率 9 nt = 5 -- 邻域阀值(邻域荧火虫数) 10 s = 0.3 -- 步... 阅读全文

posted @ 2013-05-19 22:45 郁郁思扬 阅读(4088) 评论(0) 推荐(3) 编辑

2013年3月29日

用于WTL工具栏的辅助类CToolBarHelper

摘要: 1 #pragma once 2 3 template <typename T> 4 class ATL_NO_VTABLE CToolBarHelper 5 { 6 HFONT m_nonClientFont; 7 8 CSimpleMap<UINT, UINT> m_mapMenu; 9 10 public: 11 CToolBarHelper() : m_nonClientFont( NULL ) {} 12 13 ~CToolBarHelper() 14 { 15 if ( m_nonClientFon... 阅读全文

posted @ 2013-03-29 16:11 郁郁思扬 阅读(660) 评论(0) 推荐(0) 编辑

2013年3月28日

A*算法

摘要: 1 #include <stdlib.h> 2 #include <stdio.h> 3 #include <string.h> 4 #include <math.h> 5 6 7 #define NODEEQUAL(a, b) (*((unsigned int *)(a)) == *((unsigned int *)(b))) 8 //#define GETDIST(a, b) ((abs((a)->x - (b)->x) + abs((a)->y - (b)->y)) * 10) 9 //#define GETDIST 阅读全文

posted @ 2013-03-28 13:51 郁郁思扬 阅读(253) 评论(0) 推荐(0) 编辑

2013年3月15日

关于结构体内存对齐

摘要: 转发自:http://hi.baidu.com/wvdsnwggfxbeqrd/item/4fd2fadce8bf253a48e1dd79内存对齐”应该是编译器的“管辖范围”。编译器为程序中的每个“数据单元”安排在适当的位置上。但是C语言的一个特点就是太灵活,太强大,它允许你干预“内存对齐”。如果你想了解更加底层的秘密,“内存对齐”对你就不应该再透明了。一、内存对齐的原因大部分的参考资料都是如是说的:1、平台原因(移植原因):不是所有的硬件平台都能访问任意地址上的任意数据的;某些硬件平台只能在某些地址处取某些特定类型的数据,否则抛出硬件异常。2、性能原因:数据结构(尤其是栈)应该尽可能地在自然 阅读全文

posted @ 2013-03-15 01:29 郁郁思扬 阅读(244) 评论(0) 推荐(0) 编辑

2013年1月7日

VS2010 添加项目依赖

摘要: 在2010以下的版本中,只用添加依赖即可.在VS2010中,必须针对项目设置,"框架和引用" 阅读全文

posted @ 2013-01-07 02:04 郁郁思扬 阅读(2546) 评论(0) 推荐(0) 编辑

导航