开发工具:
文件大小: 32kb
下载次数: 0
上传时间: 2013-06-01
详细说明: 求解交通流量分配模型的有效方法 #include "stdafx.h" #include #include #include "os.h" #include "my_types.h" #include "md_alloc.h" #include "my_util.h" #include "message.h" #include "tui.h" #include "meta.h" #include "link_functions.h" #include "od_table.h" #include "od_flow.h" #include "mincostroutes.h" #include "ls_bisect.h" #include "fw_status.h" extern int no_zones, no _nodes, no_links; /* Gloabal variables */ my_float **ODflow, TotalODflow; /* Local Declarations */ /* void FW(void); Should there be a function for fw, or should it be included in main? */ static void Init(char *tuiFileName); static void Close(char *tuiFileName); static void InitODflow(void); static void CloseODflow(void); /* End of local declarations. */ void main(int argc, char **argv ) { my_float *MainVolume, *SubVolume, *SDVolume, Lambda; int **MinPathPredLink; struct fw_status_struct fw_status; char *tuiFileName; StatusMessage("General", "Ready, set, go..."); switch(argc){ case 2: tuiFileName=argv[1]; break; case 1: tuiFileName="control.tui"; break; default: ExitMessage("Wrong number of command line arguments (%d). \n" "Syntax: fw .", argc-1); } Init(tuiFileName); MainVolume = (my_float*)Alloc_1D(no_links, sizeof(my_float) ); SDVolume = SubVolume = (my_float*)Alloc_1D(no_links, sizeof(my_float) ); /* Compute search direction and sub-volume in the same place. */ MinPathPredLink = (int**)Alloc_2D(no_zones,no_nodes, sizeof(int)); InitFWstatus(&fw_status); FindMinCostRoutes (MinPathPredLink, NULL); Assign (ODflow,MinPathPredLink,MainVolume); FirstFWstatus(MainVolume, &fw_status); UpdateLinkCost(MainVolume); for ( fw_status.Iteration = 1; ContinueFW(fw_status); fw_status.Iteration++) { FindMinCostRoutes (MinPathPredLink, NULL); Assign (ODflow,MinPathPredLink,SubVolume); VolumeDifference( SubVolume, MainVolume, SDVolume); /* Which yields the search direction. */ Lambda = LinksSDLineSearch ( MainVolume, SDVolume ); UpdateFWstatus(MainVolume, SDVolume, &fw_status); UpdateVolume ( MainVolume, SDVolume, Lambda ); UpdateLinkCost (MainVolume); } CloseFWstatus(MainVolume); free(MainVolume); free(SubVolume); Free_2D((void**)MinPathPredLink,no_zones,no_nodes); Close(tuiFileName); StatusMessage("General","The end"); } static void Init(char *tuiFileName){ tuiInit(tuiFileName); InitLinks(); InitODflow(); InitLineSearch(); } static void Close(char *tuiFileName){ StatusMessage("General", "Closing all modules"); tuiClose(tuiFileName); CloseLinks(); CloseODflow(); CloseLineSearch(); } static void InitODflow(void){ char *ODflowFileName; int input_no_zones; double Factor=1.0; struct meta_struct meta_data; tuiGetInputFileName( "OD flow file name", TRUE, &ODflowFileName); StatusMessage("General", "Reading OD flow file '%s'", ODflowFileName); ODflow = Read_ODflow (ODflowFileName, &TotalODflow, &input_no_zones, &meta_data); if(input_no_zones != no_zones) ExitMessage("OD flow file '%s' is for %d zones, and not for %d zones.", ODflowFileName , input_no_zones, no_zones); tuiGetDouble( "OD flow factor", FALSE, &Factor); if(Factor <= 0.0) ExitMessage( "OD flow factor %lf is invalid, if must be positive.", Factor); if(Factor != 1.0) Factor_ODtable (ODflow, (my_float) Factor, no_zones) ; } static void CloseODflow(void){ Free_2D((void **)ODflow, no_zones, no_zones); } ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.