配流07—基于BPR函数的Frank Wolfe算法

本文介绍了如何使用基于BPR函数的Frank Wolfe算法进行交通流量的均衡分配。通过路网数据、OD需求和路段能力,经过初始化、全有全无配流、数据更新等步骤,实现交通流量的科学有效分配。算例展示显示了算法能够达到期望的均衡效果。

一、问题描述

在道路网中,已知OD需求,路段走行时间,路段能力和路径路段关系,求流量的均衡分配结果。


二、算法描述

此处只给出大的步骤,精确的算法描述见第三节——算法程序。

step1:给定路网数据,OD需求,路段能力

step2:自动求出路径和路段数量,根据路段数量定义路段名,给定初始数据

step3:构造阻抗函数并求出初始阻抗,此处用BPR函数

step4:全有全无配流

step5:数据更新

step6:求目标函数值

step7:输出计算结果


三、算法程序


clear
clc
disp('========================================================================');
disp('                      《基于BPR函数的Frank Wolfe算法》');
disp('运行环境:MATLAB 8.3.0.532 ');
disp('制 作 人:兰州交通大学   刘志祥');
disp('Q      Q:531548824');
disp('=========================================================================');

%% 1 给定路网数据,OD需求,路段能力
%算例1
%==========================================================================
% Q=1000;
% W=[5 6 6 8 3];
% Cmax=[600 500 600 500 700];
% Mxf=[1 0 0 1 0;1 0 1 0 1;0 1 0 0 1];
%==========================================================================

%算例2
%==================================================
求解交通流量分配模型的有效方法 #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, SDVolum
评论 27
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值