castar 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,90 @@
1
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
2
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
3
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
4
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
5
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
6
+ 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,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1
90
+ 1,1,1,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1,1,1,9,9,9,9,1,1
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "castar/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "castar"
7
+ s.version = Castar::VERSION
8
+ s.authors = ["John Wilde"]
9
+ s.email = ["johnwilde@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Ruby interface to a C++ implementation of the A* algorithm}
12
+ s.description = File.read(File.join(File.dirname(__FILE__), 'README.markdown'))
13
+
14
+ s.rubyforge_project = "castar"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.extensions = ["ext/extconf.rb"]
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib","ext"]
21
+
22
+ # specify any dependencies here; for example:
23
+ # s.add_runtime_dependency "rest-client"
24
+ s.add_development_dependency "rspec"
25
+ s.add_development_dependency "rspec-core"
26
+ end
@@ -0,0 +1,3 @@
1
+ require 'mkmf'
2
+ $libs = append_library($libs, "supc++")
3
+ create_makefile('heyes')
@@ -0,0 +1,498 @@
1
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2
+
3
+ // STL A* Search implementation
4
+ // (C)2001 Justin Heyes-Jones
5
+ //
6
+ // Finding a path on a simple grid maze
7
+ // This shows how to do shortest path finding using A*
8
+
9
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
10
+
11
+ #ifndef STLASTAR_H
12
+ #include "stlastar.h" // See header for copyright and usage information
13
+ #endif
14
+
15
+ #include <iostream>
16
+ #include <math.h>
17
+ #include <time.h>
18
+
19
+ #define DEBUG_LISTS 0
20
+ #define DEBUG_LIST_LENGTHS_ONLY 0
21
+
22
+ using namespace std;
23
+
24
+ // Global data
25
+ int DEBUG = 0;
26
+
27
+
28
+
29
+ // The world map
30
+ class Map{
31
+ public:
32
+ enum
33
+ {
34
+ MAP_OUT_OF_BOUNDS = 9,
35
+ MAP_NO_WALK = 10
36
+ };
37
+
38
+ int width;
39
+ int height;
40
+ int* map;
41
+
42
+ Map(int width = 90, int height = 90) : width(width), height(height)
43
+ {
44
+ map = new int[ width * height ];
45
+ memset( map, 0, sizeof( int ) * width * height );
46
+ }
47
+
48
+ ~Map(){
49
+ free(map);
50
+ }
51
+
52
+ // map helper functions
53
+ int getCost( int x, int y )
54
+ {
55
+ if( x < 0 ||
56
+ x >= width ||
57
+ y < 0 ||
58
+ y >= height
59
+ )
60
+ {
61
+ return MAP_OUT_OF_BOUNDS;
62
+ }
63
+ return map[(y*width)+x];
64
+ }
65
+
66
+ void setCost( int x, int y, int value )
67
+ {
68
+ if( x < 0 ||
69
+ x >= width ||
70
+ y < 0 ||
71
+ y >= height
72
+ )
73
+ {
74
+ return;
75
+ }
76
+ map[(y*width)+x] = value;
77
+ }
78
+ };
79
+
80
+ Map* MAP = NULL;
81
+ int NUMBER_OF_NEIGHBORS;
82
+
83
+ // Definitions
84
+
85
+ class MapSearchNode
86
+ {
87
+ public:
88
+ unsigned int x; // the (x,y) positions of the node
89
+ unsigned int y;
90
+
91
+ MapSearchNode() { x = y = 0; }
92
+ MapSearchNode( unsigned int px, unsigned int py ) { x=px; y=py; }
93
+
94
+ float GoalDistanceEstimate( MapSearchNode &nodeGoal );
95
+ bool IsGoal( MapSearchNode &nodeGoal );
96
+ bool GetSuccessors( AStarSearch<MapSearchNode> *astarsearch, MapSearchNode *parent_node );
97
+ float GetCost( MapSearchNode &successor );
98
+ bool IsSameState( MapSearchNode &rhs );
99
+
100
+ void PrintNodeInfo();
101
+ };
102
+
103
+ class HeyesDriver{
104
+ #define MAX_PATH_LENGTH 200
105
+ int path_x[MAX_PATH_LENGTH];
106
+ int path_y[MAX_PATH_LENGTH];
107
+ int path_length;
108
+
109
+
110
+ public:
111
+ enum{
112
+ FOUR_NEIGHBORS,
113
+ EIGHT_NEIGHBORS
114
+ };
115
+
116
+ MapSearchNode nodeStart;
117
+ MapSearchNode nodeEnd;
118
+
119
+ double timeElapsed;
120
+
121
+ HeyesDriver(Map* map, int numMoves=FOUR_NEIGHBORS )
122
+ {
123
+ NUMBER_OF_NEIGHBORS = numMoves;
124
+ MAP = map;
125
+ timeElapsed = 0.0;
126
+ }
127
+
128
+ int run(int startx, int starty, int goalx, int goaly, int maxNodes = 10000)
129
+ {
130
+
131
+ //cout << "STL A* Search implementation\n(C)2001 Justin Heyes-Jones\n";
132
+
133
+ // Our sample problem defines the world as a 2d array representing a terrain
134
+ // Each element contains an integer from 0 to 5 which indicates the cost
135
+ // of travel across the terrain. Zero means the least possible difficulty
136
+ // in travelling (think ice rink if you can skate) whilst 5 represents the
137
+ // most difficult. 9 indicates that we cannot pass.
138
+
139
+ // Create an instance of the search class...
140
+
141
+ clock_t begin,end;
142
+ begin=clock();
143
+ AStarSearch<MapSearchNode> astarsearch(maxNodes);
144
+
145
+ unsigned int SearchCount = 0;
146
+
147
+ const unsigned int NumSearches = 1;
148
+ while(SearchCount < NumSearches)
149
+ {
150
+ // Create a start state
151
+ nodeStart.x = startx;
152
+ nodeStart.y = starty;
153
+
154
+ // Define the goal state
155
+ nodeEnd.x = goalx; //rand()%MAP_WIDTH;
156
+ nodeEnd.y = goaly; //rand()%MAP_HEIGHT;
157
+
158
+ // Set Start and goal states
159
+
160
+ astarsearch.SetStartAndGoalStates( nodeStart, nodeEnd );
161
+
162
+ unsigned int SearchState;
163
+ unsigned int SearchSteps = 0;
164
+
165
+ do
166
+ {
167
+ SearchState = astarsearch.SearchStep();
168
+ SearchSteps++;
169
+ } while( SearchState == AStarSearch<MapSearchNode>::SEARCH_STATE_SEARCHING );
170
+
171
+ if( SearchState == AStarSearch<MapSearchNode>::SEARCH_STATE_SUCCEEDED )
172
+ {
173
+
174
+ MapSearchNode *node = astarsearch.GetSolutionStart();
175
+
176
+ int steps = 0;
177
+
178
+ path_x[steps] = node->x;
179
+ path_y[steps] = node->y;
180
+ for( ;; )
181
+ {
182
+ steps++;
183
+ node = astarsearch.GetSolutionNext();
184
+
185
+ if( !node )
186
+ {
187
+ break;
188
+ }
189
+
190
+ path_x[steps] = node->x;
191
+ path_y[steps] = node->y;
192
+ };
193
+
194
+ path_length = steps;
195
+ // Once you're done with the solution you can free the nodes up
196
+ astarsearch.FreeSolutionNodes();
197
+
198
+
199
+ }
200
+ else if( SearchState == AStarSearch<MapSearchNode>::SEARCH_STATE_FAILED )
201
+ {
202
+ cout << "Search terminated. Did not find goal state\n";
203
+ }
204
+
205
+ end=clock();
206
+ timeElapsed = double(diffclock(end,begin));
207
+ // Display the number of loops the search went through
208
+ if (DEBUG){
209
+ cout << "SearchSteps : " << SearchSteps << "\n";
210
+ cout << "Time elapsed: " << timeElapsed << " ms"<< endl;
211
+ }
212
+
213
+ SearchCount ++;
214
+
215
+ astarsearch.EnsureMemoryFreed();
216
+ }
217
+
218
+ return 0;
219
+ }
220
+
221
+ Map* getMap(){ return MAP; }
222
+
223
+ int getPathLength(){
224
+ return path_length;
225
+ }
226
+ int getPathYAtIndex( int i ){
227
+ if ( i < path_length && i >= 0)
228
+ return path_y[i];
229
+ else
230
+ return -1;
231
+ }
232
+
233
+ int getPathXAtIndex( int i ){
234
+ if ( i < path_length && i >= 0 )
235
+ return path_x[i];
236
+ else
237
+ return -1;
238
+ }
239
+
240
+ double diffclock(clock_t clock1,clock_t clock2)
241
+ {
242
+ double diffticks=clock1-clock2;
243
+ double diffms=(diffticks*10)/CLOCKS_PER_SEC;
244
+ return diffms;
245
+ }
246
+ };
247
+
248
+
249
+
250
+ bool MapSearchNode::IsSameState( MapSearchNode &rhs )
251
+ {
252
+
253
+ // same state in a maze search is simply when (x,y) are the same
254
+ if( (x == rhs.x) &&
255
+ (y == rhs.y) )
256
+ {
257
+ return true;
258
+ }
259
+ else
260
+ {
261
+ return false;
262
+ }
263
+
264
+ }
265
+
266
+ void MapSearchNode::PrintNodeInfo()
267
+ {
268
+ cout << "Node position : (" << x << ", " << y << ")" << endl;
269
+ }
270
+
271
+ // Here's the heuristic function that estimates the distance from a Node
272
+ // to the Goal.
273
+
274
+ float MapSearchNode::GoalDistanceEstimate( MapSearchNode &nodeGoal )
275
+ {
276
+ float xd = fabs(float(((float)x - (float)nodeGoal.x)));
277
+ float yd = fabs(float(((float)y - (float)nodeGoal.y)));
278
+
279
+ return xd + yd;
280
+ }
281
+
282
+ bool MapSearchNode::IsGoal( MapSearchNode &nodeGoal )
283
+ {
284
+
285
+ if( (x == nodeGoal.x) &&
286
+ (y == nodeGoal.y) )
287
+ {
288
+ return true;
289
+ }
290
+
291
+ return false;
292
+ }
293
+
294
+ // This generates the successors to the given Node. It uses a helper function called
295
+ // AddSuccessor to give the successors to the AStar class. The A* specific initialisation
296
+ // is done for each node internally, so here you just set the state information that
297
+ // is specific to the application
298
+ bool MapSearchNode::GetSuccessors( AStarSearch<MapSearchNode> *astarsearch, MapSearchNode *parent_node )
299
+ {
300
+
301
+ int parent_x = -1;
302
+ int parent_y = -1;
303
+
304
+ if( parent_node )
305
+ {
306
+ parent_x = parent_node->x;
307
+ parent_y = parent_node->y;
308
+ }
309
+
310
+
311
+ MapSearchNode NewNode;
312
+
313
+ // push each possible move except allowing the search to go backwards
314
+
315
+ int dx, dy;
316
+ for ( dx=-1; dx<2; dx++ ){
317
+ for ( dy=-1; dy<2; dy++){
318
+ switch (NUMBER_OF_NEIGHBORS){
319
+
320
+ case HeyesDriver::FOUR_NEIGHBORS:
321
+ if (abs(dx)==abs(dy))
322
+ continue;
323
+ break;
324
+ case HeyesDriver::EIGHT_NEIGHBORS:
325
+ if (dx==0 && dy==0)
326
+ continue;
327
+ }
328
+
329
+ if( (MAP->getCost( x+dx, y+dy ) < 9)
330
+ && !((parent_x == x+dx) && (parent_y == y+dy))
331
+ )
332
+ {
333
+ NewNode = MapSearchNode( x+dx, y+dy );
334
+ astarsearch->AddSuccessor( NewNode );
335
+ }
336
+
337
+ }
338
+ }
339
+ return true;
340
+ }
341
+
342
+ // given this node, what does it cost to move to successor. In the case
343
+ // of our MAP the answer is the MAP terrain value at this node since that is
344
+ // conceptually where we're moving
345
+
346
+ float MapSearchNode::GetCost( MapSearchNode &successor )
347
+ {
348
+ return (float) MAP->getCost( x, y );
349
+
350
+ }
351
+
352
+
353
+ // Main
354
+ #if 0
355
+ int testmain(int startx, int starty, int goalx, int goaly)
356
+ {
357
+
358
+ //cout << "STL A* Search implementation\n(C)2001 Justin Heyes-Jones\n";
359
+
360
+ // Our sample problem defines the world as a 2d array representing a terrain
361
+ // Each element contains an integer from 0 to 5 which indicates the cost
362
+ // of travel across the terrain. Zero means the least possible difficulty
363
+ // in travelling (think ice rink if you can skate) whilst 5 represents the
364
+ // most difficult. 9 indicates that we cannot pass.
365
+
366
+ // Create an instance of the search class...
367
+
368
+ clock_t begin,end;
369
+ begin=clock();
370
+ AStarSearch<MapSearchNode> astarsearch(10000);
371
+
372
+ unsigned int SearchCount = 0;
373
+
374
+ const unsigned int NumSearches = 1;
375
+ while(SearchCount < NumSearches)
376
+ {
377
+ // Create a start state
378
+ MapSearchNode nodeStart;
379
+ nodeStart.x = startx; //rand()%MAP_WIDTH;
380
+ nodeStart.y = starty; //rand()%MAP_HEIGHT;
381
+
382
+ // Define the goal state
383
+ MapSearchNode nodeEnd;
384
+ nodeEnd.x = goalx; //rand()%MAP_WIDTH;
385
+ nodeEnd.y = goaly; //rand()%MAP_HEIGHT;
386
+
387
+ // Set Start and goal states
388
+
389
+ astarsearch.SetStartAndGoalStates( nodeStart, nodeEnd );
390
+
391
+ unsigned int SearchState;
392
+ unsigned int SearchSteps = 0;
393
+
394
+ do
395
+ {
396
+ SearchState = astarsearch.SearchStep();
397
+
398
+ SearchSteps++;
399
+
400
+ #if DEBUG_LISTS
401
+
402
+ cout << "Steps:" << SearchSteps << "\n";
403
+
404
+ int len = 0;
405
+
406
+ cout << "Open:\n";
407
+ MapSearchNode *p = astarsearch.GetOpenListStart();
408
+ while( p )
409
+ {
410
+ len++;
411
+ #if !DEBUG_LIST_LENGTHS_ONLY
412
+ ((MapSearchNode *)p)->PrintNodeInfo();
413
+ #endif
414
+ p = astarsearch.GetOpenListNext();
415
+
416
+ }
417
+
418
+ cout << "Open list has " << len << " nodes\n";
419
+
420
+ len = 0;
421
+
422
+ cout << "Closed:\n";
423
+ p = astarsearch.GetClosedListStart();
424
+ while( p )
425
+ {
426
+ len++;
427
+ #if !DEBUG_LIST_LENGTHS_ONLY
428
+ p->PrintNodeInfo();
429
+ #endif
430
+ p = astarsearch.GetClosedListNext();
431
+ }
432
+
433
+ cout << "Closed list has " << len << " nodes\n";
434
+ #endif
435
+
436
+ }
437
+ while( SearchState == AStarSearch<MapSearchNode>::SEARCH_STATE_SEARCHING );
438
+
439
+ if( SearchState == AStarSearch<MapSearchNode>::SEARCH_STATE_SUCCEEDED )
440
+ {
441
+ // cout << "Search found goal state\n";
442
+
443
+ MapSearchNode *node = astarsearch.GetSolutionStart();
444
+
445
+ //#if DISPLAY_SOLUTION
446
+ // cout << "Displaying solution\n";
447
+ int steps = 0;
448
+
449
+ // node->PrintNodeInfo();
450
+ path_x[steps] = node->x;
451
+ path_y[steps] = node->y;
452
+ for( ;; )
453
+ {
454
+ node = astarsearch.GetSolutionNext();
455
+
456
+ if( !node )
457
+ {
458
+ break;
459
+ }
460
+
461
+ // node->PrintNodeInfo();
462
+ steps ++;
463
+ path_x[steps] = node->x;
464
+ path_y[steps] = node->y;
465
+ };
466
+
467
+ // cout << "Solution steps " << steps << endl;
468
+ path_length = steps;
469
+ //#endif
470
+ // Once you're done with the solution you can free the nodes up
471
+ astarsearch.FreeSolutionNodes();
472
+
473
+
474
+ }
475
+ else if( SearchState == AStarSearch<MapSearchNode>::SEARCH_STATE_FAILED )
476
+ {
477
+ cout << "Search terminated. Did not find goal state\n";
478
+
479
+ }
480
+
481
+ end=clock();
482
+ // cout << "Time elapsed: " << double(diffclock(end,begin)) << " ms"<< endl;
483
+
484
+ // Display the number of loops the search went through
485
+ if (DEBUG){
486
+ cout << "SearchSteps : " << SearchSteps << "\n";
487
+ }
488
+
489
+ SearchCount ++;
490
+
491
+ astarsearch.EnsureMemoryFreed();
492
+ }
493
+
494
+ return 0;
495
+ }
496
+ #endif
497
+
498
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////