Skip to content
TheChatArchiveThe Chat Archive
Metallama-4-maverick-17b-128e-instruct· MetaHugging Face LMArena Human Preference 140K

主干道变为y=20、y=80,x=20、x=80;不要标注客户编号,且客户点不要示例需求量着色

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with grok-4-0709’s answer.
  1. User

    主干道变为y=20、y=80,x=20、x=80;不要标注客户编号,且客户点不要示例需求量着色

  2. Meta Assistant

    好的,我将根据您的要求,调整主干道的位置,并修改客户点的标注方式,不再使用需求量着色,而是标注客户点的坐标。


    修改后的MATLAB代码

    %% 农村配送场景构建 - MATLAB实现
    % 场景范围:[0,100]×[0,100]的二维平面,单位为公里
    % 主要特征:
    %   1. 中心仓库[50,50]
    %   2. 4条主干道(水平/垂直,分别位于y=20、y=80,x=20、x=80)
    %   3. 随机分布的支道(从主干道延伸)
    %   4. 客户点分布在支道末端(80%偏远)和主干道附近(20%)
    
    %% 1. 参数设置
    clear; clc; close all;
    
    % 场景参数
    scene_size = 100; % 场景边长(单位:公里)
    warehouse_loc = [50, 50]; % 仓库位置
    
    % 主干道参数
    num_main_roads = 4;    % 主干道数量(水平+垂直)
    main_road_length = 100; % 主干道长度(公里)
    main_road_width = 2;   % 主干道宽度(公里)
    
    % 支道参数
    branch_length = 15;    % 支道长度(公里)
    branch_density = 0.1; % 支道密度(主干道每公里的支道数量)
    branch_width = 1;     % 支道宽度(公里)
    
    % 客户点参数
    total_customers = 100; % 总客户数
    remote_ratio = 0.8;   % 偏远客户比例(80%)
    
    % 无人车/无人机参数
    vehicle_capacity = 100; % 无人车最大载重(单位:kg)
    vehicle_range = 300;    % 无人车最大行驶里程(公里)
    drone_capacity = 5;     % 无人机最大载重(单位:kg)
    drone_range = 150;     % 无人机最大航程(公里)
    
    %% 2. 生成主干道
    % 主干道包括2条水平和2条垂直道路
    main_roads = cell(num_main_roads, 1);
    
    % 水平主干道(y方向固定)
    main_roads{1} = [linspace(0, scene_size, 100); 20*ones(1, 100)];
    main_roads{2} = [linspace(0, scene_size, 100); 80*ones(1, 100)];
    
    % 垂直主干道(x方向固定)
    main_roads{3} = [20*ones(1, 100); linspace(0, scene_size, 100)];
    main_roads{4} = [80*ones(1, 100); linspace(0, scene_size, 100)];
    
    %% 3. 生成支道
    % 支道从主干道随机延伸
    branch_roads = {};
    
    % 对每条主干道生成支道
    for i = 1:num_main_roads
        road = main_roads{i};
    
        % 计算主干道长度
        road_length = scene_size;
    
        % 计算支道数量
        num_branches = round(road_length * branch_density);
    
        % 随机选择支道位置
        branch_points = randperm(100);
        branch_points = branch_points(1:num_branches);
    
        % 生成支道
        for j = 1:num_branches
            if i <= 2  % 水平主干道
                % 支道从主干道垂直延伸(上下方向)
                x_pos = road(1, branch_points(j));
                y_pos = road(2, branch_points(j));
    
                % 随机选择延伸方向(上或下)
                if rand() < 0.5
                    y_dir = 1; % 向上延伸
                else
                    y_dir = -1; % 向下延伸
                end
    
                % 生成支道坐标
                x_coords = linspace(x_pos, x_pos, 100);
                y_coords = linspace(y_pos, y_pos + y_dir*branch_length, 100);
                branch_roads{end+1} = [x_coords; y_coords];
            else       % 垂直主干道
                % 支道从主干道水平延伸(左右方向)
                x_pos = road(1, branch_points(j));
                y_pos = road(2, branch_points(j));
    
                % 随机选择延伸方向(左或右)
                if rand() < 0.5
                    x_dir = 1; % 向右延伸
                else
                    x_dir = -1; % 向左延伸
                end
    
                % 生成支道坐标
                x_coords = linspace(x_pos, x_pos + x_dir*branch_length, 100);
                y_coords = linspace(y_pos, y_pos, 100);
                branch_roads{end+1} = [x_coords; y_coords];
            end
        end
    end
    
    %% 4. 生成客户点
    customers = [];
    
    % 生成偏远客户(80%)
    num_remote = round(total_customers * remote_ratio);
    for i = 1:num_remote
        % 随机选择一条支道
        branch_idx = randi(length(branch_roads));
        branch_road = branch_roads{branch_idx};
    
        % 在支道末端生成客户点
        % 使用插值函数在支道末端附近生成点
        t = 0.9 + 0.1*rand(); % 在支道末端附近(90%-100%)
        x = interp1(linspace(0,1,100), branch_road(1,:), t);
        y = interp1(linspace(0,1,100), branch_road(2,:), t);
    
        % 确保点在场景范围内
        x = max(0, min(scene_size, x));
        y = max(0, min(scene_size, y));
    
        customers = [customers; x, y];
    end
    
    % 生成主干道附近客户(20%)
    for i = num_remote+1:total_customers
        % 随机选择一条主干道
        main_idx = randi(num_main_roads);
        main_road = main_roads{main_idx};
    
        % 在主干道附近生成客户点
        t = rand(); % 随机位置
        x = interp1(linspace(0,1,100), main_road(1,:), t);
        y = interp1(linspace(0,1,100), main_road(2,:), t);
    
        % 添加小范围随机偏移(模拟实际分布)
        x = x + (rand()-0.5)*5;
        y = y + (rand()-0.5)*5;
    
        % 确保点在场景范围内
        x = max(0, min(scene_size, x));
        y = max(0, min(scene_size, y));
    
        customers = [customers; x, y];
    end
    
    %% 5. 可视化场景
    figure('Name', '农村配送场景', 'Position', [100, 100, 1000, 800]);
    
    % 绘制仓库
    hold on;
    plot(warehouse_loc(1), warehouse_loc(2), 'ro', 'MarkerSize', 15, 'MarkerFaceColor', 'r');
    text(warehouse_loc(1)+2, warehouse_loc(2)+2, '仓库', 'FontSize', 10);
    
    % 绘制主干道
    for i = 1:num_main_roads
        plot(main_roads{i}(1,:), main_roads{i}(2,:), 'b-', 'LineWidth', main_road_width);
    end
    
    % 绘制支道
    for i = 1:length(branch_roads)
        plot(branch_roads{i}(1,:), branch_roads{i}(2,:), 'g--', 'LineWidth', branch_width);
    end
    
    % 绘制客户点
    scatter(customers(:,1), customers(:,2), 50, 'filled');
    title('农村配送场景 - 客户点分布');
    xlabel('X坐标 (公里)');
    ylabel('Y坐标 (公里)');
    xlim([0, scene_size]);
    ylim([0, scene_size]);
    grid on;
    
    % 标注客户点坐标
    for i = 1:size(customers, 1)
        text(customers(i,1)+1, customers(i,2)+1, sprintf('(%.2f, %.2f)', customers(i,1), customers(i,2)), 'FontSize', 8);
    end
    
    %% 6. 输出场景数据
    disp('场景生成完成!');
    disp(['仓库位置: (', num2str(warehouse_loc(1)), ', ', num2str(warehouse_loc(2)), ')']);
    disp(['主干道数量: ', num2str(num_main_roads)]);
    disp(['支道数量: ', num2str(length(branch_roads))]);
    disp(['客户点总数: ', num2str(total_customers)]);
    disp(['偏远客户比例: ', num2str(remote_ratio*100), '%']);
    

    代码详细说明

    1. 主干道生成:
      • 修改了主干道的位置,水平主干道位于y=20和y=80,垂直主干道位于x=20和x=80。
      • 使用linspace函数生成主干道的坐标,确保道路平滑。
    2. 客户点生成:
      • 偏

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.