Code covered by the BSD License  

Highlights from
Finding optimal path on a terrain

image thumbnail

Finding optimal path on a terrain

by

 

13 Nov 2012 (Updated )

Finding optimal path on a terrain using forward dynamic programming.

main.m
% This is the main simulation file
%
% manurung.auralius@gmail.com
% 17.11.2012

clc;
clear all;

START_NODE = 1;  % Terrian1.mat, from 1 to 4225
% START_NODE = 1;  % Terrian2.mat, from 1 to 16641

% Warning: Terrain2.mat is a huge map, it will takes quite a lot of time to
% proceed.
load ('Terrain1.mat');
% load ('Terrain2.mat'); 

figure;
hold on;
visualizeTerrain(T);

P = createTransitionCostMat(T);
[stageCostMat, predMat] = dpa(P, START_NODE);

% Keep in mind that DPA propagates through all the nodes. Basically DPA
% tries to find optimal path from all nodes to one certain node.

for toNode = 1 : 500 : 3000
    [optimalPath, optimalCost] = processPredMat(stageCostMat, predMat, START_NODE, toNode);
    visualizePath(T, optimalPath);
end

Contact us