Frank wolfe

上传者: u010912131 | 上传时间: 2023-02-22 15:32:50 | 文件大小: 32KB | 文件类型: ZIP
求解交通流量分配模型的有效方法 #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); }

文件下载

资源详情

[{"title":"( 32 个子文件 32KB ) Frank wolfe","children":[{"title":"Source","children":[{"title":"tap","children":[{"title":"ls_bisect.cpp <span style='color:#111;'> 2.06KB </span>","children":null,"spread":false},{"title":"fw.cpp <span style='color:#111;'> 3.32KB </span>","children":null,"spread":false},{"title":"mincostroutes.cpp <span style='color:#111;'> 6.74KB </span>","children":null,"spread":false},{"title":"links.cpp <span style='color:#111;'> 14.68KB </span>","children":null,"spread":false},{"title":"od_table.cpp <span style='color:#111;'> 10.30KB </span>","children":null,"spread":false},{"title":"od_flow.cpp <span style='color:#111;'> 7.50KB </span>","children":null,"spread":false},{"title":"nodes.cpp <span style='color:#111;'> 2.78KB </span>","children":null,"spread":false},{"title":"fw_status.cpp <span style='color:#111;'> 4.27KB </span>","children":null,"spread":false}],"spread":true},{"title":"util","children":[{"title":"my_list.cpp <span style='color:#111;'> 8.21KB </span>","children":null,"spread":false},{"title":"meta.cpp <span style='color:#111;'> 5.26KB </span>","children":null,"spread":false},{"title":"tui.cpp <span style='color:#111;'> 10.56KB </span>","children":null,"spread":false},{"title":"message_pc.cpp <span style='color:#111;'> 1.44KB </span>","children":null,"spread":false},{"title":"md_alloc.cpp <span style='color:#111;'> 3.61KB </span>","children":null,"spread":false},{"title":"my_util.cpp <span style='color:#111;'> 4.95KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"Include","children":[{"title":"tap","children":[{"title":"ls_bisect.h <span style='color:#111;'> 187B </span>","children":null,"spread":false},{"title":"links.h <span style='color:#111;'> 670B </span>","children":null,"spread":false},{"title":"od_table.h <span style='color:#111;'> 1.33KB </span>","children":null,"spread":false},{"title":"link_functions.h <span style='color:#111;'> 1.52KB </span>","children":null,"spread":false},{"title":"od_flow.h <span style='color:#111;'> 660B </span>","children":null,"spread":false},{"title":"nodes.h <span style='color:#111;'> 73B </span>","children":null,"spread":false},{"title":"fw_status.h <span style='color:#111;'> 561B </span>","children":null,"spread":false},{"title":"mincostroutes.h <span style='color:#111;'> 455B </span>","children":null,"spread":false}],"spread":true},{"title":"util","children":[{"title":"pc","children":[{"title":"os.h <span style='color:#111;'> 111B </span>","children":null,"spread":false}],"spread":true},{"title":"my_list.h <span style='color:#111;'> 1.11KB </span>","children":null,"spread":false},{"title":"os.h <span style='color:#111;'> 115B </span>","children":null,"spread":false},{"title":"tui.h <span style='color:#111;'> 549B </span>","children":null,"spread":false},{"title":"unix","children":[{"title":"os.h <span style='color:#111;'> 68B </span>","children":null,"spread":false}],"spread":true},{"title":"my_util.h <span style='color:#111;'> 820B </span>","children":null,"spread":false},{"title":"md_alloc.h <span style='color:#111;'> 407B </span>","children":null,"spread":false},{"title":"my_types.h <span style='color:#111;'> 413B </span>","children":null,"spread":false},{"title":"message.h <span style='color:#111;'> 278B </span>","children":null,"spread":false},{"title":"meta.h <span style='color:#111;'> 531B </span>","children":null,"spread":false}],"spread":true}],"spread":true}],"spread":true}]

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明