第33卷 第2期 内 蒙 古 农 业 大 学 学 报 V01.33 No.2
2012年 3月 Mar.2012
Journalof Inner Mongolia AgriculturalUniversity
最短路径动态规划 问题及 C语言实现
张 捷 , 张仁杰 , 王科岩
(1. 内蒙古农业大学能源与交通工程学院,呼和浩特 010010;2. 计算机与信息工程学院,呼和浩特 010010)
摘要: 利用动态规划思想求解运输最短路径问题并不是一个新的问题,但利用这种思想编写计算机程序,辅助完
成其最短路径的求解,可以为解决最短路径问题提供了一个有效的工具。在编写程序 时建立数学模型、借助数学工
具写出其源程序,并在Vc环境下得以实现。程序简单易懂,并没有单纯地对Dijkstra算法进行改进,而是编写了一
种新的程序克服了Dijkstra算法不能实现多路径输出的缺点,在现实生活中为运输出行提供 了更多的选择,更有实
用价值。
关键词: 最短路径; 动态规划; C语言编程
中图分类号:TP312C 文献标识码:A 文章编号:1009—3575(2012)02—0162~04
DYNAMlC PROGRAMMING PROBLEMS OFTHESHORTEST
PATHANPD C LANGUAGE IMPLEMENTATION
ZHANGJie, ZtlANGRen—jie, WANGKe—yan
(1. CollegeofEnergyandTransportationEngineering,InnerMongoliaAgricultureUniversity,ttohhot 010010,China;
2. CollegeofComputerandInformationEngineering,InnerMongoliaAgricultureUniversi@,tlohhot010010,China)
Abstract: Itisntanew problem thatusingdynamicprogrammingalgorithm forsolvingtheshortestpathtransportationproblem ,butit
providesaneffectivetoolforsolvingthesho~estpathproblem thatthethoughtofcompilingthecomputerpmgram assistingtocomplete
itsshortestpathsolution.Inthepreparationofprocedures,amathematicalmodelisestablished.Bymeansofmathematicaltoolsthe
sourcecodeCallbewrittenandachievedintheVCenvironment.Theprogramsareeasytounderstandandnotsimplytoimproveonthe
Dijkstraalgorithm,buttowriteanewproceduretoovercometheshortcomingthatDijkstraalgorithmcantachievemulti—pathoutput.
Itprovidesmorechoice,morepracticalvalueinreallifeofrtransportnadtrave1.
Keywords: Shortestpath; dynamicprogramming; Cprogramminglanguage
径问题上其计算复杂,用时较长。为此人们研究出
1 概述 用动态规划的思想解决实际问题。具体采用顺序标