基于K-mean实现无线传感器网络布局优化附Matlab代码
1 简介针对无线传感器网络的能耗问题,提出了一种基于K-means聚类的能耗均衡路由算法(KBECRA).​2 部分代码%************************************************************************************************clear allclcclose all%***************************** global variables ********************************************REPerB84*2;%resource elements per resourse blockCategory[1,2,3];% 1:urban, 2:suburban,3:ruralF_HATA1500;%MHzNoiceFigure10; %dBBI15;NoisePower -174 10*log10(180*10^3)NoiceFigureBI;SINRmin-9.3;%dLbody3;%dB body lossLbpl18;%dB building penetration lossLj2;%jumber loosGa5;% gain%***************************** end global variables ******************************************%***************************** configuration of MeNB ******************************************MeNB(1).x500;% x coordinateMeNB(1).y500;% y coordinateMeNB(1).ChannelBandwidth20;%MHzMeNB(1).carrier1.8*10^9;%MHzMeNB(1).takeBitPerMilisec100000;%MHzMeNB(1).powerTransmit45; %dBmMeNB(1).height100; %metresfor i1:20MeNB(1).UEdata(i)0;%MHzendMaxPathLossCalculate_MaxPathLoss(MeNB(1).powerTransmit,NoisePower,SINRmin);%Max Path Loss%***************************** End configuration of MeNB ******************************************%***************************** configuration of 20-UEs %*****************************************% Here we locate the Ues In the Gridfor i1:50UE(i).x400;% x coordinateUE(i).y500;% y coordinateUE(i).height1.7;UserLocationX(i) 0;UserLocationY(i) 0;UserLocationZ(i) 0;endi1x400;% x coordinatey500while i51xrandi(1000, 1, 1);yrandi(1000, 1, 1);if (x400 || x500) (y400 || y500)UE(i).xx;% x coordinateUE(i).yy;% y coordinateUserLocationX(i) UE(i).x;UserLocationY(i) UE(i).y;UserLocationZ(i) 1.7;ii1;endend%***************************** End configuration of 20-UEs %*****************************************%***************************** scatter plot of UEs and ENB %*****************************************figure(Color, white)plot(UserLocationX, UserLocationY, ^, MarkerSize, 5, LineWidth, 3), hold onBaseStationX 500;BaseStationY 500;plot(BaseStationX, BaseStationY, rs, MarkerSize, 5, LineWidth, 4), hold on, grid on, grid minorhleg legend(User Location, Base Station);set(hleg, Location, NorthEastOutside);xlabel(coordinate Χ);ylabel(coordinate Υ);%***************************** End scatter plot of UEs and ENB %*****************************************%***************************** initialization phase of UEs *****************************************% Here we calculate some parameters of the UEs before they moving(PL,SINR,CQI,Max throughput, max resurceBlock that the UE xan take )for i1:50UE(i).distancefrom_eNB_m(1)round(Distance(MeNB(1).x,MeNB(1).y,UE(i).x,UE(i).y));%calculate distance between each UE ad eNBUE(i).PL_dB(1) (HATA_Model((UE(i).distancefrom_eNB_m(1)/1000),F_HATA(1),MeNB(1).height, UE(i).height,Category(2)))LbodyLbplLj;%calculate Path Loss for each UEUE(i).PowerReceive_dBmW(1) MeNB(1).powerTransmit -UE(i).PL_dBGa;%calculate Power receive ( Pr) for each UEUE(i).SNR_dB(1)UE(i).PowerReceive_dBmW-NoisePower;%calculate SINR for each UE [dB]UE(i).SNR(1) 10^(UE(i).SNR_dB(1)/10);%calculate SINR for each UEUE(i).CQI(1)CQI_calculation(UE(i).SNR_dB(1));%calculate CQI for each UE [dB]UE(i).MODULATION(1) Modulation_calculation(UE(i).SNR_dB(1));%calculate Modulation scheme for each UE depending on CQI [dB]UE(i).resurceBlock(1)setRB(UE(i).SNR_dB(1));%calculate how many resource block can each UE receive [dB]% UE(i).throughput(1)throughput_calculation( UE(i).MODULATION,UE(i).resurceBlock(1),UE(i).SNR_dB(1));%calculate throughput each UE receive [dB]end%{Ues request service from providercalcualation of servise prioritysheduler give as many resources as needed min{ can_decode,service_requires}%}for i1:50UE(i).QCI(1)QCI_example_service();UE(i).ExampleServise(1)ExampleServise_calculation(UE(i).QCI);UE(i).PriorityPriority_calculation(UE(i).QCI);UE(i).Resource_Block_Allocation(1)Resource_Block_Allocation_calculation( UE(i).QCI(1), UE(i).resurceBlock(1));UE(i).throughput(1)throughput_calculation( UE(i).MODULATION(1),UE(i).Resource_Block_Allocation(1), UE(i).SNR_dB(1));end%%--------------- Selecting Data of interest ---------------------% ---------------------------- Code ------------------------------Table_UE struct2table(UE);data Table_UE(:,1:2);data table2array(data);%________________________________________________________________%________________________________________________________________%%------------ Selecting Optimal Number of Clusters ------------% -------------- Method 1: Using the Elbow Method ---------------% ---------------------------- Code -----------------------------WCSS [];for k 1:20sumd 0;[idx,C,sumd] kmeans(data,k);WCSS(k) sum(sumd);endfigureplot(1:20, WCSS);ylabel( WCSS,fontsize,14);xlabel( drones,fontsize,14);prompt How many cluster do you want ?: ;clstr input(prompt);%________________________________________________________________%________________________________________________________________%%--------------- Clustering data -------------------------------[idx,C] kmeans(data,clstr);for i1:50UE(i).cluster_id(1)idx(i);end%________________________________________________________________%________________________________________________________________for i1:clstrDrone(i).xC(i,1);% x coordinateDrone(i).yC(i,2);% y coordinateDrone(i).indexi;Drone(i).height100;Drone(i).powerTransmit20;%dbm;endfor i1:clstrfor j1:50if Drone(i).indexUE(j).cluster_idUE(j).distancefromDrone(1)round(Distance(Drone(i).x,Drone(i).y,UE(j).x,UE(j).y));if UE(j).distancefromDrone(1)0UE(j).distancefromDrone(1)2;end% UE(j).PL_Drone_dB(1) (HATA_Model((UE(j).distancefromDrone(1)/1000),F_HATA(1),Drone(i).height, UE(j).height,Category(2)))LbodyLbplLj;%calculate Path Loss for each UEUE(j).PL_Drone_dB(1)Air2Ground(UE(j).distancefromDrone(1)/1000,F_HATA(1),Drone(i).height)LbodyLj;UE(j).PowerReceiveFromDrone_dBmW(1) Drone(i).powerTransmit -UE(j).PL_Drone_dBGa;%calculate Power receive ( Pr) for each UEendendendfor j1:50UE(j).SNR_Drone_dB(1)UE(j).PowerReceiveFromDrone_dBmW-NoisePower;UE(j).resurceBlock_Drone(1)setRB(UE(j).SNR_Drone_dB(1));end%%%%%%%%%%% %%%%%%%%%%% %%%%%%%%%%% PLOTS %%%%%%%%%%% %%%%%%%%%%% %%%%%%%%%%% %%%%%%%%%%%%%--------------- Visualizing the Results------------------------basicwaitbar();if clstr 3legends {Cluster 1, Cluster 2, Cluster 3};endif clstr 4legends {Cluster 1, Cluster 2, Cluster 3, Cluster 4};endif clstr 5legends {Cluster 1, Cluster 2, Cluster 3, Cluster 4, Cluster 5};endif clstr 6legends {Cluster 1, Cluster 2, Cluster 3, Cluster 4, Cluster 5,Cluster 6};endif clstr 7legends {Cluster 1, Cluster 2, Cluster 3, Cluster 4, Cluster 5,Cluster 6,Cluster 7};endif clstr 8legends {Cluster 1, Cluster 2, Cluster 3, Cluster 4, Cluster 5,Cluster 6,Cluster 7,Cluster 8};endif clstr 9legends {Cluster 1, Cluster 2, Cluster 3, Cluster 4, Cluster 5,Cluster 6,Cluster 7,Cluster 8,Cluster 9};endif clstr 10legends {Cluster 1, Cluster 2, Cluster 3, Cluster 4, Cluster 5,Cluster 6,Cluster 7,Cluster 8,Cluster 9,Cluster 10};endif clstr 20legends {Cluster 1, Cluster 2, Cluster 3, Cluster 4, Cluster 5,Cluster 6,Cluster 7,Cluster 8,Cluster 9,Cluster 10,Cluster 11,Cluster 12,Cluster 13,Cluster 14,Cluster 15,Cluster 16,Cluster 17,Cluster 18,Cluster 19,Cluster 20};endfigure,%plot(UserLocationX, UserLocationY, ^, MarkerSize, 5, LineWidth, 3), hold ongscatter(data(:,1),data(:,2),idx);hold onfor i 1:clstrscatter(C(i,1),C(i,2) ,96, black,filled);end%{hold onplot(BaseStationX, BaseStationY, rs, MarkerSize, 5, LineWidth, 4);%}legend(legends)xlabel(coordinate Χ);ylabel(coordinate Υ);hold offfor i1:50SINR_Receive_Comparison_BarChar(i,1)UE(i).SNR_Drone_dB;SINR_Receive_Comparison_BarChar(i,2)UE(i).SNR_dB;Power_Receive_Comparison_BarChar(i,1) UE(i).PowerReceiveFromDrone_dBmW;Power_Receive_Comparison_BarChar(i,2)UE(i).PowerReceive_dBmW;endMean_Power_Receive_Comparison_BarChar[ mean(Power_Receive_Comparison_BarChar(:,1)) mean(Power_Receive_Comparison_BarChar(:,2)) ];Mean_SINR_Comparison_BarChar[ mean(SINR_Receive_Comparison_BarChar(:,1)) mean(SINR_Receive_Comparison_BarChar(:,2)) ];x[1:50];y[1,2];figureX categorical({Drone,Base Station});X reordercats(X,{Drone,Base Station});bar(X,Mean_SINR_Comparison_BarChar);ylabel( Average SINR[dB],fontsize,14);%{figurebar(x,SINR_Receive_Comparison_BarChar);figureX categorical({Drone,Base Station});X reordercats(X,{Drone,Base Station});bar(X,Mean_Power_Receive_Comparison_BarChar);for i1:50UserIndex(i)UE(i).cluster_id;end%}disntance0;PathLoss0;PowerReceive0;SINR0;Rb0;for i1:50if UE(i).distancefrom_eNB_mUE(i).distancefromDronedisntancedisntance1;endif UE(i).PL_Drone_dBUE(i).PL_dBPathLossPathLoss1;endif UE(i).PowerReceiveFromDrone_dBmWUE(i).PowerReceive_dBmWPowerReceivePowerReceive1;endif UE(i).SNR_Drone_dBUE(i).SNR_dBSINRSINR1;endif UE(i).resurceBlock_DroneUE(i).resurceBlockRbRb1;endend3 仿真结果4 参考文献[1] Wanlei, Zhao , et al. RB-K-means Based Adaptive Mean shift基于RB-K平均带宽设定的Adaptive Mean shift. 中国图象图形学报 11.4(2006):511-515.[2]张海燕, and 刘虹. 基于K-means聚类的WSN能耗均衡路由算法. 传感技术学报 024.011(2011):1639-1643.博主简介擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真相关matlab代码问题可私信交流。部分理论引用网络文献若有侵权联系博主删除。1 简介针对无线传感器网络的能耗问题,提出了一种基于K-means聚类的能耗均衡路由算法(KBECRA).​2 部分代码%************************************************************************************************clear allclcclose all%***************************** global variables ********************************************REPerB84*2;%resource elements per resourse blockCategory[1,2,3];% 1:urban, 2:suburban,3:ruralF_HATA1500;%MHzNoiceFigure10; %dBBI15;NoisePower -174 10*log10(180*10^3)NoiceFigureBI;SINRmin-9.3;%dLbody3;%dB body lossLbpl18;%dB building penetration lossLj2;%jumber loosGa5;% gain%***************************** end global variables ******************************************%***************************** configuration of MeNB ******************************************MeNB(1).x500;% x coordinateMeNB(1).y500;% y coordinateMeNB(1).ChannelBandwidth20;%MHzMeNB(1).carrier1.8*10^9;%MHzMeNB(1).takeBitPerMilisec100000;%MHzMeNB(1).powerTransmit45; %dBmMeNB(1).height100; %metresfor i1:20MeNB(1).UEdata(i)0;%MHzendMaxPathLossCalculate_MaxPathLoss(MeNB(1).powerTransmit,NoisePower,SINRmin);%Max Path Loss%***************************** End configuration of MeNB ******************************************%***************************** configuration of 20-UEs %*****************************************% Here we locate the Ues In the Gridfor i1:50UE(i).x400;% x coordinateUE(i).y500;% y coordinateUE(i).height1.7;UserLocationX(i) 0;UserLocationY(i) 0;UserLocationZ(i) 0;endi1x400;% x coordinatey500while i51xrandi(1000, 1, 1);yrandi(1000, 1, 1);if (x400 || x500) (y400 || y500)UE(i).xx;% x coordinateUE(i).yy;% y coordinateUserLocationX(i) UE(i).x;UserLocationY(i) UE(i).y;UserLocationZ(i) 1.7;ii1;endend%***************************** End configuration of 20-UEs %*****************************************%***************************** scatter plot of UEs and ENB %*****************************************figure(Color, white)plot(UserLocationX, UserLocationY, ^, MarkerSize, 5, LineWidth, 3), hold onBaseStationX 500;BaseStationY 500;plot(BaseStationX, BaseStationY, rs, MarkerSize, 5, LineWidth, 4), hold on, grid on, grid minorhleg legend(User Location, Base Station);set(hleg, Location, NorthEastOutside);xlabel(coordinate Χ);ylabel(coordinate Υ);%***************************** End scatter plot of UEs and ENB %*****************************************%***************************** initialization phase of UEs *****************************************% Here we calculate some parameters of the UEs before they moving(PL,SINR,CQI,Max throughput, max resurceBlock that the UE xan take )for i1:50UE(i).distancefrom_eNB_m(1)round(Distance(MeNB(1).x,MeNB(1).y,UE(i).x,UE(i).y));%calculate distance between each UE ad eNBUE(i).PL_dB(1) (HATA_Model((UE(i).distancefrom_eNB_m(1)/1000),F_HATA(1),MeNB(1).height, UE(i).height,Category(2)))LbodyLbplLj;%calculate Path Loss for each UEUE(i).PowerReceive_dBmW(1) MeNB(1).powerTransmit -UE(i).PL_dBGa;%calculate Power receive ( Pr) for each UEUE(i).SNR_dB(1)UE(i).PowerReceive_dBmW-NoisePower;%calculate SINR for each UE [dB]UE(i).SNR(1) 10^(UE(i).SNR_dB(1)/10);%calculate SINR for each UEUE(i).CQI(1)CQI_calculation(UE(i).SNR_dB(1));%calculate CQI for each UE [dB]UE(i).MODULATION(1) Modulation_calculation(UE(i).SNR_dB(1));%calculate Modulation scheme for each UE depending on CQI [dB]UE(i).resurceBlock(1)setRB(UE(i).SNR_dB(1));%calculate how many resource block can each UE receive [dB]% UE(i).throughput(1)throughput_calculation( UE(i).MODULATION,UE(i).resurceBlock(1),UE(i).SNR_dB(1));%calculate throughput each UE receive [dB]end%{Ues request service from providercalcualation of servise prioritysheduler give as many resources as needed min{ can_decode,service_requires}%}for i1:50UE(i).QCI(1)QCI_example_service();UE(i).ExampleServise(1)ExampleServise_calculation(UE(i).QCI);UE(i).PriorityPriority_calculation(UE(i).QCI);UE(i).Resource_Block_Allocation(1)Resource_Block_Allocation_calculation( UE(i).QCI(1), UE(i).resurceBlock(1));UE(i).throughput(1)throughput_calculation( UE(i).MODULATION(1),UE(i).Resource_Block_Allocation(1), UE(i).SNR_dB(1));end%%--------------- Selecting Data of interest ---------------------% ---------------------------- Code ------------------------------Table_UE struct2table(UE);data Table_UE(:,1:2);data table2array(data);%________________________________________________________________%________________________________________________________________%%------------ Selecting Optimal Number of Clusters ------------% -------------- Method 1: Using the Elbow Method ---------------% ---------------------------- Code -----------------------------WCSS [];for k 1:20sumd 0;[idx,C,sumd] kmeans(data,k);WCSS(k) sum(sumd);endfigureplot(1:20, WCSS);ylabel( WCSS,fontsize,14);xlabel( drones,fontsize,14);prompt How many cluster do you want ?: ;clstr input(prompt);%________________________________________________________________%________________________________________________________________%%--------------- Clustering data -------------------------------[idx,C] kmeans(data,clstr);for i1:50UE(i).cluster_id(1)idx(i);end%________________________________________________________________%________________________________________________________________for i1:clstrDrone(i).xC(i,1);% x coordinateDrone(i).yC(i,2);% y coordinateDrone(i).indexi;Drone(i).height100;Drone(i).powerTransmit20;%dbm;endfor i1:clstrfor j1:50if Drone(i).indexUE(j).cluster_idUE(j).distancefromDrone(1)round(Distance(Drone(i).x,Drone(i).y,UE(j).x,UE(j).y));if UE(j).distancefromDrone(1)0UE(j).distancefromDrone(1)2;end% UE(j).PL_Drone_dB(1) (HATA_Model((UE(j).distancefromDrone(1)/1000),F_HATA(1),Drone(i).height, UE(j).height,Category(2)))LbodyLbplLj;%calculate Path Loss for each UEUE(j).PL_Drone_dB(1)Air2Ground(UE(j).distancefromDrone(1)/1000,F_HATA(1),Drone(i).height)LbodyLj;UE(j).PowerReceiveFromDrone_dBmW(1) Drone(i).powerTransmit -UE(j).PL_Drone_dBGa;%calculate Power receive ( Pr) for each UEendendendfor j1:50UE(j).SNR_Drone_dB(1)UE(j).PowerReceiveFromDrone_dBmW-NoisePower;UE(j).resurceBlock_Drone(1)setRB(UE(j).SNR_Drone_dB(1));end%%%%%%%%%%% %%%%%%%%%%% %%%%%%%%%%% PLOTS %%%%%%%%%%% %%%%%%%%%%% %%%%%%%%%%% %%%%%%%%%%%%%--------------- Visualizing the Results------------------------basicwaitbar();if clstr 3legends {Cluster 1, Cluster 2, Cluster 3};endif clstr 4legends {Cluster 1, Cluster 2, Cluster 3, Cluster 4};endif clstr 5legends {Cluster 1, Cluster 2, Cluster 3, Cluster 4, Cluster 5};endif clstr 6legends {Cluster 1, Cluster 2, Cluster 3, Cluster 4, Cluster 5,Cluster 6};endif clstr 7legends {Cluster 1, Cluster 2, Cluster 3, Cluster 4, Cluster 5,Cluster 6,Cluster 7};endif clstr 8legends {Cluster 1, Cluster 2, Cluster 3, Cluster 4, Cluster 5,Cluster 6,Cluster 7,Cluster 8};endif clstr 9legends {Cluster 1, Cluster 2, Cluster 3, Cluster 4, Cluster 5,Cluster 6,Cluster 7,Cluster 8,Cluster 9};endif clstr 10legends {Cluster 1, Cluster 2, Cluster 3, Cluster 4, Cluster 5,Cluster 6,Cluster 7,Cluster 8,Cluster 9,Cluster 10};endif clstr 20legends {Cluster 1, Cluster 2, Cluster 3, Cluster 4, Cluster 5,Cluster 6,Cluster 7,Cluster 8,Cluster 9,Cluster 10,Cluster 11,Cluster 12,Cluster 13,Cluster 14,Cluster 15,Cluster 16,Cluster 17,Cluster 18,Cluster 19,Cluster 20};endfigure,%plot(UserLocationX, UserLocationY, ^, MarkerSize, 5, LineWidth, 3), hold ongscatter(data(:,1),data(:,2),idx);hold onfor i 1:clstrscatter(C(i,1),C(i,2) ,96, black,filled);end%{hold onplot(BaseStationX, BaseStationY, rs, MarkerSize, 5, LineWidth, 4);%}legend(legends)xlabel(coordinate Χ);ylabel(coordinate Υ);hold offfor i1:50SINR_Receive_Comparison_BarChar(i,1)UE(i).SNR_Drone_dB;SINR_Receive_Comparison_BarChar(i,2)UE(i).SNR_dB;Power_Receive_Comparison_BarChar(i,1) UE(i).PowerReceiveFromDrone_dBmW;Power_Receive_Comparison_BarChar(i,2)UE(i).PowerReceive_dBmW;endMean_Power_Receive_Comparison_BarChar[ mean(Power_Receive_Comparison_BarChar(:,1)) mean(Power_Receive_Comparison_BarChar(:,2)) ];Mean_SINR_Comparison_BarChar[ mean(SINR_Receive_Comparison_BarChar(:,1)) mean(SINR_Receive_Comparison_BarChar(:,2)) ];x[1:50];y[1,2];figureX categorical({Drone,Base Station});X reordercats(X,{Drone,Base Station});bar(X,Mean_SINR_Comparison_BarChar);ylabel( Average SINR[dB],fontsize,14);%{figurebar(x,SINR_Receive_Comparison_BarChar);figureX categorical({Drone,Base Station});X reordercats(X,{Drone,Base Station});bar(X,Mean_Power_Receive_Comparison_BarChar);for i1:50UserIndex(i)UE(i).cluster_id;end%}disntance0;PathLoss0;PowerReceive0;SINR0;Rb0;for i1:50if UE(i).distancefrom_eNB_mUE(i).distancefromDronedisntancedisntance1;endif UE(i).PL_Drone_dBUE(i).PL_dBPathLossPathLoss1;endif UE(i).PowerReceiveFromDrone_dBmWUE(i).PowerReceive_dBmWPowerReceivePowerReceive1;endif UE(i).SNR_Drone_dBUE(i).SNR_dBSINRSINR1;endif UE(i).resurceBlock_DroneUE(i).resurceBlockRbRb1;endend3 仿真结果4 参考文献[1] Wanlei, Zhao , et al. RB-K-means Based Adaptive Mean shift基于RB-K平均带宽设定的Adaptive Mean shift. 中国图象图形学报 11.4(2006):511-515.[2]张海燕, and 刘虹. 基于K-means聚类的WSN能耗均衡路由算法. 传感技术学报 024.011(2011):1639-1643.博主简介擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真相关matlab代码问题可私信交流。部分理论引用网络文献若有侵权联系博主删除。

相关新闻

KoboldCpp技术深度解析:构建企业级AI模型部署框架的架构设计与实践

KoboldCpp技术深度解析:构建企业级AI模型部署框架的架构设计与实践

KoboldCpp技术深度解析:构建企业级AI模型部署框架的架构设计与实践 【免费下载链接】koboldcpp Run GGUF models easily with a KoboldAI UI. One File. Zero Install. 项目地址: https://gitcode.com/gh_mirrors/ko/koboldcpp 在当今AI技术快速发展的背景下…

2026/7/20 19:07:59阅读更多 →
【BP预测】基于海鸥算法优化BP神经网络实现数据预测附matlab代码

【BP预测】基于海鸥算法优化BP神经网络实现数据预测附matlab代码

1 简介为降低某车型前保险杠注塑成型中产生的翘曲变形,基于数值模拟结果,将BP神经网络与海鸥算法结合,确定了BP神经网络的初始权值和阈值.将SOA-BP模型代入遗传算法中求解最佳工艺参数.由极差分析可知,影响翘曲变形最显著的因素为保压时间和模具温度.基于极差分析设计补充实验,…

2026/7/20 19:07:59阅读更多 →
Android课程表控件新选择:TimetableView性能优化与高效调用秘籍

Android课程表控件新选择:TimetableView性能优化与高效调用秘籍

Android课程表控件新选择:TimetableView性能优化与高效调用秘籍 【免费下载链接】TimetableView 一款开源、完善、高效的Android课程表控件,支持添加广告、课程重叠自动处理、透明背景设置、空白格子点击事件处理等丰富的功能,并且有完善的开…

2026/7/21 21:03:21阅读更多 →
kafka broker不设置分区key,会将同一topic的消息存放到不同的分区,但读取数据不能将不同分区的数据一次性查询出来怎么解决

kafka broker不设置分区key,会将同一topic的消息存放到不同的分区,但读取数据不能将不同分区的数据一次性查询出来怎么解决

在使用Apache Kafka时,如果不设置分区键(partition key),Kafka 会根据消息的键(key)或消息本身的内容来决定将消息发送到哪个分区。如果没有指定消息的key,Kafka通常会采用默认的分区策略&#…

2026/7/22 0:33:32阅读更多 →
flink rocksdb 配置memtable大小

flink rocksdb 配置memtable大小

在使用Apache Flink的RocksDBStateBackend时,配置RocksDB的memtable大小是一个常见的需求,特别是在处理大规模状态数据时。RocksDB的memtable是用来存储键值对数据,直到它们被写入到磁盘上的SSTable文件中的。调整memtable的大小可以影响状态…

2026/7/22 0:33:32阅读更多 →
draw.io桌面版终极指南:完全免费的跨平台图表工具

draw.io桌面版终极指南:完全免费的跨平台图表工具

draw.io桌面版终极指南:完全免费的跨平台图表工具 【免费下载链接】drawio-desktop Official electron build of draw.io 项目地址: https://gitcode.com/GitHub_Trending/dr/drawio-desktop 还在为昂贵的图表软件发愁吗?想要一款真正免费、功能强…

2026/7/22 0:31:26阅读更多 →
HarmonyOS应用开发实战:小事记 - @Link 与 @Prop 双向同步:父子组件状态协调的深层原理

HarmonyOS应用开发实战:小事记 - @Link 与 @Prop 双向同步:父子组件状态协调的深层原理

前言 在 ArkUI 中,Link 和 Prop 都用于父子组件间的数据传递,但它们的同步方向和使用场景不同。Prop 是单向的(父 → 子),而 Link 是双向同步的。本文以小事记(xiaoshiji_ohos_app) 的组件扩展…

2026/7/22 0:31:26阅读更多 →
台湾阳明交通大学攻克事件相机视频重建难题

台湾阳明交通大学攻克事件相机视频重建难题

这项由台湾阳明交通大学多位研究人员联合完成的研究,发表于2026年7月的SIGGRAPH Conference Papers(会议时间为2026年7月19日至23日,在美国洛杉矶举行),论文编号为DOI 10.1145/3799902.3811151,arXiv编号26…

2026/7/22 0:29:26阅读更多 →
当AI开始“懂病“:伊斯法罕医科大学打造会“对症下药“的分子设计师

当AI开始“懂病“:伊斯法罕医科大学打造会“对症下药“的分子设计师

这项由伊斯法罕医科大学再生医学研究中心、伊斯法罕神经科学研究中心、药物化学系、心血管研究中心、遗传与分子生物学系及生物信息学研究中心联合开展的研究,于2026年7月9日以预印本形式发布于arXiv平台,编号为arXiv:2607.08404。感兴趣的读者可通过该编…

2026/7/22 0:29:26阅读更多 →
Go语言静态资源打包方案对比与实践指南

Go语言静态资源打包方案对比与实践指南

1. 项目背景与核心需求在Go语言开发中,我们经常需要处理静态资源文件的打包问题。无论是Web应用的模板文件、前端资源,还是配置文件、证书等,都需要随程序一起分发。传统做法是将这些文件与编译后的二进制文件放在同一目录下,但这…

2026/7/21 0:51:49阅读更多 →
Go语言实现高性能LDAP认证服务的架构与实践

Go语言实现高性能LDAP认证服务的架构与实践

1. 项目背景与核心价值LDAP(轻量级目录访问协议)作为企业级身份认证的黄金标准,已经服务了超过80%的财富500强公司。我在金融科技领域实施统一认证体系时,发现传统Java方案存在启动慢、内存占用高等痛点。而Go语言凭借其协程并发模…

2026/7/21 0:51:49阅读更多 →
【AI面试官实战指南】:用ChatGPT模拟10类高频技术岗面试,3天提升应答精准度92%

【AI面试官实战指南】:用ChatGPT模拟10类高频技术岗面试,3天提升应答精准度92%

更多请点击: https://intelliparadigm.com 第一章:AI面试官实战指南的核心价值与适用场景 AI面试官并非替代人类HR的“黑箱工具”,而是以可解释、可审计、可迭代的方式,赋能招聘全链路的关键基础设施。其核心价值在于将主观经验沉…

2026/7/21 0:51:49阅读更多 →
中小企业小程序开发公司怎么选:预算、上手和售后避坑指南

中小企业小程序开发公司怎么选:预算、上手和售后避坑指南

中小企业做小程序,最常见的矛盾是预算有限,但又不希望功能太单薄;没有技术团队,但又希望后续能自己运营;想快速上线,又担心隐性收费和售后失联。选型时如果只看“低价套餐”或“案例数量”,很容…

2026/7/22 0:01:17阅读更多 →
GEO优化如何沉淀长期内容资产?广拓时代谈AI搜索时代的内容ROI

GEO优化如何沉淀长期内容资产?广拓时代谈AI搜索时代的内容ROI

企业做营销,最怕钱花完了,资产没有留下。 效果广告能带来一段时间的曝光,但预算停止后,流量往往也随之停止。短视频内容可能在几天内冲高,也可能很快沉下去。AI搜索时代,企业需要重新思考一个问题&#xff…

2026/7/22 0:01:17阅读更多 →
Agent 终态判定:何时该停止思考、给出最终回复

Agent 终态判定:何时该停止思考、给出最终回复

Agent 终态判定:何时该停止思考、给出最终回复 一、你的 Agent 在"再想想"的循环里绕了 12 轮,用户已经关窗口了 Agent 与人最大的区别是:人知道什么时候该停下来给答案,Agent 会一直"想"下去。你给 Agent 接…

2026/7/22 0:01:17阅读更多 →
YOLOv8推理性能优化:从1.2FPS到35FPS的全链路加速实践

YOLOv8推理性能优化:从1.2FPS到35FPS的全链路加速实践

如果你在部署 YOLOv8 时,发现推理速度只有可怜的 1-2 FPS,而别人的演示视频却能跑到 30 FPS 以上,那么问题很可能不在模型本身,而在于你的整个处理链路。很多开发者拿到一个训练好的 YOLOv8 模型后,会直接使用官方示例…

2026/7/21 22:53:50阅读更多 →
Coze与Dify对比指南:低代码AI应用开发从入门到实战

Coze与Dify对比指南:低代码AI应用开发从入门到实战

1. 从零到一:为什么你需要了解 Coze 和 Dify?如果你对 AI 应用开发感兴趣,但一看到“大模型”、“智能体”、“工作流”这些词就头疼,觉得门槛太高,那这篇文章就是为你准备的。很多开发者,包括我自己&#…

2026/7/21 18:53:30阅读更多 →
AI生图工具怎么选?2026年6月版实测对比

AI生图工具怎么选?2026年6月版实测对比

做自媒体的朋友应该都有体会:配图一直是个让人头疼的问题。2026年,AI生图工具已经非常成熟了,但工具太多反而不知道怎么选。以下是截至2026年6月我对主流AI生图工具的实测对比。Midjourney V8.1:速度之王2026年6月11日&#xff0c…

2026/7/21 18:53:30阅读更多 →