当前位置:首页>java>代码分享 | TSP问题四算法对比分析

代码分享 | TSP问题四算法对比分析

  • 2026-01-20 18:32:11
代码分享 | TSP问题四算法对比分析

蚁群算法在大规模算例中性能较好已经得到验证,但是我现在关心小规模算例中这类启发式算法的表现是否还能保持优异,同时引入擅长做小规模求解的暴力求解,贪心算法和求解器进行对比分析。

一、问题背景与核心定义

旅行商问题(Travelling Salesman Problem, TSP)是组合优化领域的经典问题,其目标是在给定的城市集合中找到一条最短路径,要求每个城市恰好访问一次并返回起点。设城市数量为 n,则问题可抽象为在完全图 G=(V,E) 中寻找最短哈密顿回路,其中顶点 V 表示城市,边 E 的权重为城市间的距离。

数学描述:设距离矩阵为 D∈Rn×n,其中 Di,j 表示城市 i 到城市 j 的距离(Di,i=∞ 以避免自环)。TSP的目标是找到一个排列 π=(π1,π2,...,πn)(π1=πn+1,即回到起点),使得总距离 L 最小。

二、核心数据预处理

在算法开始前,需根据城市坐标生成距离矩阵。设城市 i 的坐标为 (xi,yi),则城市 i 与 j 之间的欧氏距离公式为:

若 i=j,则 Di,j=∞(避免路径中重复访问同一城市)。

三、四种求解算法的原理与数学框架

1. 暴力求解(精确算法)

核心思想:枚举所有可能的路径组合,计算总距离并选择最小值。

数学原理:对于 n 个城市,路径总数为 (n−1)!(固定起点以消除对称性)。例如,当 n=6 时,需评估 5!=120 条路径。

总距离计算:对每条路径 π,通过公式 L=∑Dπk,πk+1 计算总长度,最终保留最小 L 对应的路径。

时间复杂度:O(n!),仅适用于 n≤8 的小规模问题。

2. 最邻近算法(贪心算法)

核心思想:从起点出发,每次选择距离当前城市最近的未访问城市,直至所有城市被访问。

数学步骤:

初始化:选择起点 c1,标记为已访问。

迭代:对当前城市 ci,选择未访问城市中距离最小的 cj,即 cj=argminDci,k。

终止:所有城市访问完毕后返回起点,形成闭合路径。

优缺点:时间复杂度 O(n2),计算速度快,但解的质量依赖初始点和城市分布,可能陷入局部最优。

3. 蚁群算法(启发式算法)

核心思想:模拟蚂蚁群体觅食行为,通过信息素浓度引导路径搜索,逐步逼近最优解。

数学模型:

信息素矩阵:设 τi,j(t) 为 t 时刻城市 i 到 j 的信息素浓度,初始时 τi,j(0)=1(均匀分布)。

转移概率:蚂蚁从城市 i 转移到未访问城市 j 的概率为:

其中,ηi,j=1/Di,j 为启发因子(距离越近,启发值越大),α,β 分别为信息素和启发因子的权重。

信息素更新:迭代结束后,信息素挥发并根据蚂蚁路径质量增强:

其中,ρ∈(0,1) 为挥发系数,Δτi,j=∑k=1mQ/Lk(m 为蚂蚁数量,Q 为常数,Lk 为第 k 只蚂蚁的路径长度)。

关键参数:蚂蚁数量 m、最大迭代次数、α,β,ρ,需通过调参平衡探索与利用能力。

4. intlinprog求解器(整数线性规划)

核心思想:将TSP转化为整数线性规划问题,通过分支定界法求解。

数学建模:

决策变量:引入二进制变量 xi,j∈{0,1},若路径包含从城市 i 到 j 的边,则 xi,j=1,否则为 0。

目标函数:最小化总距离 min∑Di,jxi,j。

约束条件

入度约束:每个城市仅被进入一次。

出度约束:每个城市仅被离开一次。

消除子回路:引入辅助变量 ui(表示访问顺序),确保路径无闭环。

求解过程:调用MATLAB的 intlinprog 函数,通过整数规划求解器寻找满足约束的最优解。

四、性能对比与数学指标

为量化各算法的优劣,引入以下指标:

最优距离:算法输出的最短路径长度。

计算时间:算法运行耗时(秒)。

相对误差:以所有算法中的最小距离为基准,计算各算法的误差率:

对比结论:

精确算法(暴力求解、intlinprog):误差率为 0,但时间复杂度高,适用于小规模问题。

启发式算法(最邻近、蚁群):误差率较高(最邻近约 5%-20%,蚁群约 1%-5%),但可处理更大规模问题(蚁群算法适用于 n=10−100)。

TSP问题的求解需在精度与效率间权衡:

小规模问题(n≤8):优先选择暴力求解或intlinprog,确保最优解。

中等规模问题(10≤n≤100):最邻近算法可快速生成可行解,作为近似方案。

大规模问题(n>100):蚁群算法通过信息素机制平衡探索与利用,解的质量接近最优。

代码

%% TSP问题:多种算法对比分析% 功能:对比暴力求解、最邻近算法、蚁群算法和intlinprog求解器clear; clc; close all;%% 参数设置n_cities = 6;           % 城市数量(建议4-6,确保所有算法都能运行)%% 生成城市坐标rng(42); % 设置随机种子以保证结果可重现if n_cities == 6cities_x = [012103];cities_y = [000112];elseif n_cities == 5cities_x = [02420,];cities_y = [00222];else    % 随机分布    cities_x = rand(n_cities, 1) * 10;    cities_y = rand(n_cities, 1) * 10;end%% 计算距离矩阵distance_matrix = zeros(n_cities, n_cities);for i = 1:n_cities    for j = 1:n_cities        if i ~= j            distance_matrix(i,j) = sqrt((cities_x(i)-cities_x(j))^2 + ...                                      (cities_y(i)-cities_y(j))^2);        else            distance_matrix(i,j) = inf; % 避免自循环        end    endendfprintf('=== TSP问题设置 ===\n');fprintf('城市数量: %d\n', n_cities);fprintf('城市坐标:\n');for i = 1:n_cities    fprintf('  城市%d: (%.2f, %.2f)\n', i, cities_x(i), cities_y(i));end%% 方法1:暴力求解(精确算法)fprintf('\n=== 暴力求解 ===\n');if n_cities <= 8  % 暴力求解限制在8个城市以内    [best_route_brute, best_distance_brute, time_brute] = solve_brute_force(distance_matrix);else    fprintf('城市数过多,跳过暴力求解\n');    best_route_brute = [];    best_distance_brute = NaN;    time_brute = NaN;end%% 方法2:最邻近算法(贪心算法)fprintf('\n=== 最邻近算法 ===\n');[best_route_nn, best_distance_nn, time_nn] = solve_nearest_neighbor(distance_matrix);%% 方法3:蚁群算法(启发式算法)fprintf('\n=== 蚁群算法 ===\n');[best_route_aco, best_distance_aco, time_aco] = solve_aco(distance_matrix);%% 方法4:intlinprog求解器fprintf('\n=== intlinprog求解器 ===\n');if license('test''Optimization_Toolbox') && n_cities <= 6    [best_route_exact, best_distance_exact, time_exact, exact_success] = solve_tsp_practical(distance_matrix);    if ~exact_success        fprintf('intlinprog求解失败\n');        best_route_exact = [];        best_distance_exact = NaN;        time_exact = NaN;    endelse    if ~license('test''Optimization_Toolbox')        fprintf('未安装MATLAB优化工具箱,跳过intlinprog求解\n');    else        fprintf('城市数过多,跳过intlinprog求解\n');    end    best_route_exact = [];    best_distance_exact = NaN;    time_exact = NaN;end%% 结果可视化figure('Position', [1001001400600]);% 子图1:城市分布和路径对比subplot(131);plot(cities_x, cities_y, 'ro''MarkerSize'12'LineWidth'2);hold on;% 标注城市编号for i = 1:n_cities    text(cities_x(i)+0.1, cities_y(i)+0.1, num2str(i), 'FontSize'12'FontWeight''bold');end% 绘制各种算法结果legend_items = {'城市''城市编号'};% 最邻近算法(蓝色)if ~isempty(best_route_nn)    route_x_nn = cities_x([best_route_nn, best_route_nn(1)]);    route_y_nn = cities_y([best_route_nn, best_route_nn(1)]);    plot(route_x_nn, route_y_nn, 'b-''LineWidth'1.5);    legend_items{end+1} = sprintf('最邻近(%.2f)', best_distance_nn);end% 蚁群算法(红色)if ~isempty(best_route_aco)    route_x_aco = cities_x([best_route_aco, best_route_aco(1)]);    route_y_aco = cities_y([best_route_aco, best_route_aco(1)]);    plot(route_x_aco, route_y_aco, 'r-.''LineWidth'2);    legend_items{end+1} = sprintf('蚁群算法(%.2f)', best_distance_aco);end% intlinprog(绿色)if ~isempty(best_route_exact)    route_x_exact = cities_x([best_route_exact, best_route_exact(1)]);    route_y_exact = cities_y([best_route_exact, best_route_exact(1)]);    plot(route_x_exact, route_y_exact, 'g--''LineWidth'1.5);    legend_items{end+1} = sprintf('intlinprog(%.2f)', best_distance_exact);end% 暴力求解(品红)if ~isempty(best_route_brute)    route_x_brute = cities_x([best_route_brute, best_route_brute(1)]);    route_y_brute = cities_y([best_route_brute, best_route_brute(1)]);    plot(route_x_brute, route_y_brute, 'm:''LineWidth'2);    legend_items{end+1} = sprintf('暴力求解(%.2f)', best_distance_brute);endxlabel('X坐标');ylabel('Y坐标');title(sprintf('TSP问题多种算法求解结果对比 (%d个城市)', n_cities));legend(legend_items, 'Location''best');grid on;% 子图2:算法性能对比(距离)subplot(132);algorithms = {'最邻近''蚁群算法''intlinprog''暴力求解'};distances = [best_distance_nn, best_distance_aco, best_distance_exact, best_distance_brute];times = [time_nn, time_aco, time_exact, time_brute];% 只显示有效的算法valid_distances = distances(~isnan(distances));if ~isempty(valid_distances)    best_known = min(valid_distances);    valid_algorithms = {};    valid_distances_plot = [];    valid_times_plot = [];    if ~isnan(best_distance_nn)        valid_algorithms{end+1} = '最邻近';        valid_distances_plot(end+1) = best_distance_nn;        valid_times_plot(end+1) = time_nn;    end    if ~isnan(best_distance_aco)        valid_algorithms{end+1} = '蚁群算法';        valid_distances_plot(end+1) = best_distance_aco;        valid_times_plot(end+1) = time_aco;    end    if ~isnan(best_distance_exact)        valid_algorithms{end+1} = 'intlinprog';        valid_distances_plot(end+1) = best_distance_exact;        valid_times_plot(end+1) = time_exact;    end    if ~isnan(best_distance_brute)        valid_algorithms{end+1} = '暴力求解';        valid_distances_plot(end+1) = best_distance_brute;        valid_times_plot(end+1) = time_brute;    end    bar(1:length(valid_distances_plot), valid_distances_plot, 'FaceColor', [0.20.60.8]);    set(gca, 'XTick'1:length(valid_distances_plot), 'XTickLabel', valid_algorithms);    ylabel('最短距离');    title('算法结果质量对比');    grid on;    % 在柱状图上标注数值    for i = 1:length(valid_distances_plot)        text(i, valid_distances_plot(i) + max(valid_distances_plot)*0.02, ...             sprintf('%.2f', valid_distances_plot(i)), ...             'HorizontalAlignment''center''FontWeight''bold');    endend% 子图3:时间对比subplot(133);if exist('valid_times_plot''var') && ~isempty(valid_times_plot)    bar(1:length(valid_times_plot), valid_times_plot, 'FaceColor', [0.80.40.2]);    set(gca, 'XTick'1:length(valid_times_plot), 'XTickLabel', valid_algorithms);    ylabel('计算时间 (秒)');    title('算法计算时间对比');    grid on;    % 在柱状图上标注数值    for i = 1:length(valid_times_plot)        text(i, valid_times_plot(i) + max(valid_times_plot)*0.02, ...             sprintf('%.3fs', valid_times_plot(i)), ...             'HorizontalAlignment''center''FontWeight''bold');    endend%% 性能对比表fprintf('\n=== 性能对比结果 ===\n');fprintf('城市数量: %d\n', n_cities);fprintf('--------------------------------------------------------\n');fprintf('%-15s %-15s %-15s %-15s\n''算法''最优距离''计算时间(s)''相对误差(%)');fprintf('--------------------------------------------------------\n');% 找到最佳解作为基准valid_distances = distances(~isnan(distances));if ~isempty(valid_distances)    best_known = min(valid_distances);    if ~isnan(best_distance_nn)        error_nn = abs(best_distance_nn - best_known) / best_known * 100;        fprintf('%-15s %-15.2f %-15.4f %-15.2f\n''最邻近算法', best_distance_nn, time_nn, error_nn);    end    if ~isnan(best_distance_aco)        error_aco = abs(best_distance_aco - best_known) / best_known * 100;        fprintf('%-15s %-15.2f %-15.4f %-15.2f\n''蚁群算法', best_distance_aco, time_aco, error_aco);    end    if ~isnan(best_distance_exact)        error_exact = abs(best_distance_exact - best_known) / best_known * 100;        fprintf('%-15s %-15.2f %-15.4f %-15.2f\n''intlinprog', best_distance_exact, time_exact, error_exact);    end    if ~isnan(best_distance_brute)        error_brute = abs(best_distance_brute - best_known) / best_known * 100;        fprintf('%-15s %-15.2f %-15.4f %-15.2f\n''暴力求解', best_distance_brute, time_brute, error_brute);    endendfprintf('--------------------------------------------------------\n');%% 暴力求解算法function [best_route, best_distance, time_taken] = solve_brute_force(distance_matrix)    tic;    n_cities = size(distance_matrix, 1);    % 生成所有可能的排列(固定起点为城市1    if n_cities > 1        perms_list = perms(2:n_cities);    else        perms_list = [];    end    best_distance = inf;    best_route = [];    % 检查所有可能的路径    if isempty(perms_list)        best_route = [12];        best_distance = distance_matrix(12) + distance_matrix(21);    else        for i = 1:size(perms_list, 1)            route = [1, perms_list(i, :)];            distance = calculate_total_distance(route, distance_matrix);            if distance < best_distance                best_distance = distance;                best_route = route;            end        end    end    time_taken = toc;    fprintf('最优距离: %.2f,耗时: %.4f秒\n', best_distance, time_taken);    fprintf('最优路径: ');    fprintf('%d ', best_route);    fprintf('\n');end%% 最邻近算法function [best_route, best_distance, time_taken] = solve_nearest_neighbor(distance_matrix)    tic;    n_cities = size(distance_matrix, 1);    best_route = nearest_neighbor_tsp(distance_matrix);    best_distance = calculate_total_distance(best_route, distance_matrix);    time_taken = toc;    fprintf('最优距离: %.2f,耗时: %.6f秒\n', best_distance, time_taken);    fprintf('最优路径: ');    fprintf('%d ', best_route);    fprintf('\n');endfunction route = nearest_neighbor_tsp(distance_matrix)    n_cities = size(distance_matrix, 1);    route = zeros(1, n_cities);    % 从第一个城市开始    current_city = 1;    route(1) = current_city;    visited = false(1, n_cities);    visited(current_city) = true;    % 依次选择最近的未访问城市    for i = 2:n_cities        min_distance = inf;        next_city = 0;        for j = 1:n_cities            if ~visited(j) && j ~= current_city && isfinite(distance_matrix(current_city, j))                if distance_matrix(current_city, j) < min_distance                    min_distance = distance_matrix(current_city, j);                    next_city = j;                end            end        end        if next_city > 0 && next_city <= n_cities            route(i) = next_city;            visited(next_city) = true;            current_city = next_city;        else            % 如果找不到有效城市,选择第一个未访问的城市            for j = 1:n_cities                if ~visited(j)                    route(i) = j;                    visited(j) = true;                    current_city = j;                    break;                end            end        end    endend%% 蚁群算法function [best_route, best_distance, time_taken] = solve_aco(distance_matrix)    tic;    n_cities = size(distance_matrix, 1);    max_iter = 30;    n_ants = 15;    alpha = 1;    beta = 5;    rho = 0.1;    Q = 100;    [best_route, best_distance, ~] = ant_colony_optimization(...        distance_matrix, n_ants, max_iter, alpha, beta, rho, Q);    time_taken = toc;    fprintf('最优距离: %.2f,耗时: %.4f秒\n', best_distance, time_taken);    fprintf('最优路径: ');    fprintf('%d ', best_route);    fprintf('\n');endfunction [best_route, best_distance, distance_history] = ant_colony_optimization(...    distance_matrix, n_ants, max_iter, alpha, beta, rho, Q)    n_cities = size(distance_matrix, 1);    % 初始化信息素矩阵    pheromone = ones(n_cities, n_cities);    % 初始化最佳解    best_distance = inf;    best_route = [];    distance_history = zeros(max_iter, 1);    % 主循环    for iter = 1:max_iter        % 每只蚂蚁构建解        routes = cell(n_ants, 1);        distances = zeros(n_ants, 1);        for ant = 1:n_ants            routes{ant} = construct_solution(distance_matrix, pheromone, ...                                           alpha, beta, n_cities);            distances(ant) = calculate_total_distance(routes{ant}, distance_matrix);        end        % 更新全局最佳解        [min_dist, min_idx] = min(distances);             if iter>1        if min_dist==best_distance       rho=max(0.7*(1-(iter/max_iter)),0.1);        else            rho=0.1;        end      end        if min_dist < best_distance && min_dist > 0            best_distance = min_dist;            best_route = routes{min_idx};        end        % 更新信息素        update_pheromone(pheromone, routes, distances, rho, Q, n_cities);        distance_history(iter) = best_distance;    end    % 确保返回有效解    if isempty(best_route)        best_route = 1:n_cities;        best_distance = calculate_total_distance(best_route, distance_matrix);    endendfunction route = construct_solution(distance_matrix, pheromone, alpha, beta, n_cities)    % 随机选择起始城市    current_city = randi(n_cities);    route = current_city;    unvisited = setdiff(1:n_cities, current_city);    % 逐个城市构建路径    while ~isempty(unvisited)        % 计算转移概率        probabilities = zeros(length(unvisited), 1);        for i = 1:length(unvisited)            next_city = unvisited(i);            if current_city >= 1 && current_city <= n_cities && ...               next_city >= 1 && next_city <= n_cities                tau = pheromone(current_city, next_city)^alpha;                eta = (1/distance_matrix(current_city, next_city))^beta;                probabilities(i) = tau * eta;            end        end        % 归一化概率        if sum(probabilities) > 0            probabilities = probabilities / sum(probabilities);        else            probabilities = ones(size(probabilities)) / length(probabilities);        end        % 轮盘赌选择下一个城市        r = rand();        cumulative_prob = 0;        selected_idx = 1;        for i = 1:length(probabilities)            cumulative_prob = cumulative_prob + probabilities(i);            if r <= cumulative_prob                selected_idx = i;                break;            end        end        % 移动到选中的城市        current_city = unvisited(selected_idx);        route = [route, current_city];        unvisited(selected_idx) = [];    end    % 验证路径    if length(route) ~= n_cities || any(route < 1) || any(route > n_cities)        route = 1:n_cities; % 返回默认路径    endendfunction update_pheromone(pheromone, routes, distances, rho, Q, n_cities)    % 信息素挥发    pheromone = (1 - rho) * pheromone;    % 根据蚂蚁路径添加信息素    n_ants = length(routes);    for ant = 1:n_ants        if distances(ant) > 0            delta_pheromone = Q / distances(ant);            route = routes{ant};            if ~isempty(route) && all(route >= 1) && all(route <= n_cities)                n = length(route);                for i = 1:n                    from_city = route(i);                    to_city = route(mod(i, n) + 1);                    if from_city >= 1 && from_city <= n_cities && ...                       to_city >= 1 && to_city <= n_cities                        pheromone(from_city, to_city) = pheromone(from_city, to_city) + delta_pheromone;                        pheromone(to_city, from_city) = pheromone(to_city, from_city) + delta_pheromone;                    end                end            end        end    end    % 确保对角线为0    pheromone(logical(eye(n_cities))) = 0;end%% intlinprog求解器(实用版本)function [best_route, best_distance, time_taken, success] = solve_tsp_practical(distance_matrix)    success = false;    best_route = [];    best_distance = inf;    time_taken = 0;    tic;    try        n = size(distance_matrix, 1);        % 多次独立求解        for attempt = 1:10            [f, Aeq, beq, lb, ub, intcon, var_idx] = build_basic_tsp_model(distance_matrix);            options = optimoptions('intlinprog', ...                'Display''off', ...                'MaxTime'10, ...                'RelativeGapTolerance',0.1);            [x, fval, exitflag] = intlinprog(f, intcon, [], [], Aeq, beq, lb, ub, options);            if exitflag > 0                % 验证解的有效性                route = extract_tsp_route(x, var_idx, n);                if ~isempty(route) && length(route) == n                    distance = calculate_total_distance(route, distance_matrix);                    if distance < best_distance                        best_distance = distance;                        best_route = route;                        success = true;                    end                end            end        end        time_taken = toc;        if success            fprintf('最优距离: %.2f,耗时: %.4f秒\n', best_distance, time_taken);            fprintf('最优路径: ');            fprintf('%d ', best_route);            fprintf('\n');        else            fprintf('求解失败,总耗时: %.4f秒\n', time_taken);        end    catch ME        fprintf('求解器错误: %s\n', ME.message);        time_taken = toc;        success = false;    endendfunction [f, Aeq, beq, lb, ub, intcon, var_idx] = build_basic_tsp_model(distance_matrix)    n = size(distance_matrix, 1);    % 创建变量索引    var_count = n * (n - 1);    f = zeros(var_count, 1);    var_idx = zeros(n, n);    var_counter = 0;    for i = 1:n        for j = 1:n            if i ~= j                var_counter = var_counter + 1;                var_idx(i, j) = var_counter;                f(var_counter) = distance_matrix(i, j);            end        end    end    % 约束条件    Aeq = [];    beq = [];    % 出度约束    for i = 1:n        aeq = zeros(1, var_count);        for j = 1:n            if i ~= j && var_idx(i, j) > 0                aeq(var_idx(i, j)) = 1;            end        end        Aeq = [Aeq; aeq];        beq = [beq; 1];    end    % 入度约束    for j = 1:n        aeq = zeros(1, var_count);        for i = 1:n            if i ~= j && var_idx(i, j) > 0                aeq(var_idx(i, j)) = 1;            end        end        Aeq = [Aeq; aeq];        beq = [beq; 1];    end    % 变量边界和整数约束    lb = zeros(var_count, 1);    ub = ones(var_count, 1);    intcon = 1:var_count;endfunction route = extract_tsp_route(x, var_idx, n)    route = [];    % 构建邻接矩阵    adj_matrix = zeros(n, n);    threshold = 0.5;    for i = 1:n        for j = 1:n            if i ~= j && var_idx(i, j) > 0 && var_idx(i, j) <= length(x)                if x(var_idx(i, j)) >= threshold                    adj_matrix(i, j) = 1;                end            end        end    end    % 提取路径    current = 1;    route = [current];    visited = false(1, n);    visited(current) = true;    for step = 1:(n-1)        next_city = find(adj_matrix(current, :) == 1);        if ~isempty(next_city) && ~visited(next_city)            current = next_city;            route = [route, current];            visited(current) = true;        else            route = [];            return;        end    endend%% 计算路径总距离function total_distance = calculate_total_distance(route, distance_matrix)    if isempty(route)        total_distance = inf;        return;    end    n = length(route);    if n == 0        total_distance = inf;        return;    end    total_distance = 0;    for i = 1:n        from_city = route(i);        to_city = route(mod(i, n) + 1); % 回到起点        if from_city >= 1 && from_city <= size(distance_matrix, 1) && ...           to_city >= 1 && to_city <= size(distance_matrix, 2)            dist = distance_matrix(from_city, to_city);            if isfinite(dist)                total_distance = total_distance + dist;            else                total_distance = inf;                return;            end        else            total_distance = inf;            return;        end    endend

计算结果

与我交流(为方便长期交流合作,加友请按要求备注行业/专业,不胜感激))

微信号wx18813053116

常用马甲|Grandfissure

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-08 09:19:16 HTTP/2.0 GET : https://f.mffb.com.cn/a/465656.html
  2. 运行时间 : 0.106571s [ 吞吐率:9.38req/s ] 内存消耗:5,037.12kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=22f009c5ec7b62dbc702bd64e2c1bf1b
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000852s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001490s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000954s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000948s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001413s ]
  6. SELECT * FROM `set` [ RunTime:0.000624s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001473s ]
  8. SELECT * FROM `article` WHERE `id` = 465656 LIMIT 1 [ RunTime:0.003613s ]
  9. UPDATE `article` SET `lasttime` = 1770513556 WHERE `id` = 465656 [ RunTime:0.005219s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 65 LIMIT 1 [ RunTime:0.000591s ]
  11. SELECT * FROM `article` WHERE `id` < 465656 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001101s ]
  12. SELECT * FROM `article` WHERE `id` > 465656 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.001014s ]
  13. SELECT * FROM `article` WHERE `id` < 465656 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.002520s ]
  14. SELECT * FROM `article` WHERE `id` < 465656 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.002438s ]
  15. SELECT * FROM `article` WHERE `id` < 465656 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.002886s ]
0.108158s