資源簡(jiǎn)介
a*啟發(fā)式搜索算法的matlab仿真程序

代碼片段和文件信息
//?STL?A*?Search?implementation
//?Copyright?2001?Justin?Heyes-Jones
//?used?for?text?debugging
#include?
#include?
#include?
#include?
#include?
#include?
//?stl?includes
#include?
#include?
#include?
using?namespace?std;
//?fast?fixed?size?memory?allocator?used?for?fast?node?memory?management
#include?“fsa.h“
//?Fixed?size?memory?allocator?can?be?disabled?to?compare?performance
//?Uses?std?new?and?delete?instead?if?you?turn?it?off
#define?USE_FSA_MEMORY?1
//?disable?warning?that?debugging?information?has?lines?that?are?truncated
//?occurs?in?stl?headers
#pragma?warning(?disable?:?4786?)
#define?DEBUG_LISTS?0
#define?DEBUG_LIST_LENGTHS_ONLY?0
//?Global?data
//?The?world?map
const?int?MAP_WIDTH?=?20;
const?int?MAP_HEIGHT?=?20;
int?NumofNodes;
int?AvgDist;
/*
int?mymap[?MAP_WIDTH?*?MAP_HEIGHT?]?=?
{
//?0001020304050607080910111213141516171819
11111111111111111111???//?00
19919911191999991111???//?01
11911999191919199911???//?02
19911999191919199911???//?03
11111199191911119911???//?04
11119111191111911111???//?05
19999111111999911111???//?06
11999999911199999991???//?07
19111111111911111111???//?08
11199999991199999991???//?09
11111191191111111111???//?10
19999919191999991111???//?11
19191999191919199911???//?12
19191999191919199911???//?13
19111199191911119911???//?14
11119111191111911111???//?15
19999111111999911111???//?16
11999999911199999991???//?17
19111111111911111111???//?18
11999999991199999911???//?19
};
*/
//let‘s?just?assume?5?nodes?first
//float?coordination[5][2]={{00}?{10}?{20}?{30}?{40}};
//int?connect[5][5]={{0?1?0?0?0}?{1?0?1?0?0}?{0?1?0?1?0}?{0?0?1?0?1}?{0?0?0?1?0}};
//float?coordination[4][2]={{00}?{10}?{0?1}?{1?1}};
//int?connect[4][4]={{0?1?1?0}?{1?0?0?1}?{1?0?0?1}?{0?1?1?0}};
//double?coordination[]?=?{0?0?1?0?0?1?1?1};
//double?connect[]={0?1?1?0?1?0?0?1?1?0?0?1?0?1?1?0};
double?*coordination;
double?*connect;
double?GetX(int?id)
{
//return?coordination[id][0];
return?*(coordination?+?id*2);
}
double?GetY(int?id)
{
//return?coordination[id][1];
return?*(coordination?+?id*2?+?1);
}
//?map?helper?functions
double?GetMap(int?x?int?y)
{
//return?connect[x][y];
return?*(connect?+?x*NumofNodes?+?y);
}
//?The?AStar?search?class.?UserState?is?the?users?state?space?type
template??class?AStarSearch
{
public
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????27278??2005-06-13?18:08??Astar.cpp
?????文件???????24576??2005-08-12?14:43??Astar.dll
?????文件????????3370??2005-08-12?14:28??dijkstra.m
?????文件????????4978??2001-12-02?19:29??fsa.h
?????文件????????2693??2005-08-12?14:46??Spath_test.m
?????文件???????16069??2005-06-13?01:41??stlastar.h
- 上一篇:Turbo碼Matlab仿真程序
- 下一篇:iwssim源程序
評(píng)論
共有 條評(píng)論