登录
首页 » c,c++ » 粒子群算法

粒子群算法

于 2022-06-19 发布 文件大小:1.03 kB
0 83
下载积分: 2 下载次数: 1

代码说明:

粒子群算法 粒子群优化算法的起源:粒子群优化算法(PSO)是一种进化计算技术(evolutionary computation),1995 年由Eberhart 博士和Kennedy 博士提出,源于对鸟群捕食的行为研究 。该算法最初是受到飞鸟集群活动的规律性启发,动物行为学家曾仔细观察过蚂蚁的觅食行为,发现不管初始时同一蚁巢的蚂蚁从蚁巢到食物的觅食路径是如何的随机,随着觅食的蚂蚁往返次数的增加,蚁群总能找到最短的觅食路径。著名的蚁群算法正是受蚁群觅食行为的启发而产生的进而利用群体智能建立的一个简化模型。利用群体中的个体对信息的共享使整个群体的运动在问题求解空间中产生从无序到有序的演化过程,从而获得最优解。

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • MFC显示网络URL图片
    MFC通过CHttpFile指针读取网络URL图片流,然后通过Ole将图片输出到屏幕上,支持jpg等
    2022-07-20 14:04:22下载
    积分:1
  • STM32 ADS1298驱动程序
    本程序是STM32 ADS1298的驱动程序。调通完全可以用,有需要的小伙伴们开来下载吧,通过spi 的DMA 读取数据,然后通过串口发出。大家可以测试一下正式应用到产品上了。
    2023-07-17 09:25:03下载
    积分:1
  • winform DataGridViewRowStyle 常见用法实例源码下载 有图
    DataGridViewRowStyle  核心用法 截图: 核心代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace TestDataGridViewRowStyle{ public partial class Form1 : Form { //定义两种行样式 private DataGridViewCellStyle m_RowStyleNormal; private DataGridViewCellStyle m_RowStyleAlternate; //成绩单DataTable private DataTable m_GradeTable; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { this.dgvGrade.AutoGenerateColumns = false; this.SetRowStyle(); this.BindData(); } /// /// 设置行样式 /// private void SetRowStyle() { //可根据需要设置更多样式属性,如字体、对齐、前景色、背景色等 this.m_RowStyleNormal = new DataGridViewCellStyle(); this.m_RowStyleNormal.BackColor = Color.LightBlue; this.m_RowStyleNormal.SelectionBackColor = Color.LightSteelBlue; this.m_RowStyleAlternate = new DataGridViewCellStyle(); this.m_RowStyleAlternate.BackColor = Color.LightGray; this.m_RowStyleAlternate.SelectionBackColor = Color.LightSlateGray; } /// /// 绑定数据 /// private void BindData() { //建立一个DataTable并填充数据,然后绑定到DataGridView控件上 m_GradeTable = new DataTable(); m_GradeTable.Columns.Add("Class", typeof(string)); m_GradeTable.Columns.Add("Name", typeof(string)); m_GradeTable.Columns.Add("Grade", typeof(int)); m_GradeTable.Rows.Add(new string[] { "Class1", "Jim", "89" }); m_GradeTable.Rows.Add(new string[] { "Class1", "Jack", "77" }); m_GradeTable.Rows.Add(new string[] { "Class1", "Bill", "91" }); m_GradeTable.Rows.Add(new string[] { "Class2", "Tom", "58" }); m_GradeTable.Rows.Add(new string[] { "Class2", "Rose", "95" }); m_GradeTable.Rows.Add(new string[] { "Class3", "Peter", "64" }); m_GradeTable.Rows.Add(new string[] { "Class3", "David", "82" }); m_GradeTable.Rows.Add(new string[] { "Class3", "Eric", "68" }); m_GradeTable.Rows.Add(new string[] { "Class3", "Lily", "79" }); this.bdsGrade.DataSource = m_GradeTable; } private void dgvDataTable_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { //在此对行样式进行设置 if (e.ColumnIndex == this.dgvGrade.Columns["ColumnClass"].Index)//根据班级设置行样式 { DataGridViewRow CurrentRow = this.dgvGrade.Rows[e.RowIndex]; CurrentRow.HeaderCell.Value = Convert.ToString(e.RowIndex 1);//显示行号,也可以设置成显示其他信息 //CurrentRow.HeaderCell.ToolTipText = "当前第" Convert.ToString(e.RowIndex 1) "行";//设置ToolTip信息 //以下为根据上一行内容判断所属组的效果 if (e.RowIndex == 0)//首行必须特殊处理,将其设置为常规样式 { CurrentRow.DefaultCellStyle = this.m_RowStyleNormal; } else { //判断和上一行是否属于同一个班级,如果是则设置相同样式,否则设置另一种样式 //需要定义两个DataGridViewCellStyle,用于交替显示,也可以根据需要隐藏一些和上一行重复的信息 //这里当两行是同一个班级时,将下一行的班级信息隐藏掉,选中时则显示班级信息 if (CurrentRow.Cells[e.ColumnIndex].Value != DBNull.Value && CurrentRow.Cells[e.ColumnIndex].Value != null && CurrentRow.Cells[e.ColumnIndex].Value.ToString() == this.dgvGrade.Rows[e.RowIndex - 1].Cells[e.ColumnIndex].Value.ToString()) { CurrentRow.DefaultCellStyle = this.dgvGrade.Rows[e.RowIndex - 1].DefaultCellStyle;//设置和上一行的样式相同 CurrentRow.Cells[e.ColumnIndex].Style.ForeColor = CurrentRow.DefaultCellStyle.BackColor;//用前景色隐藏信息 //如果需要选中时显示完整信息则注释该下面一行 //CurrentRow.Cells[e.ColumnIndex].Style.SelectionForeColor = CurrentRow.DefaultCellStyle.SelectionBackColor;//选中时也使前景色等于背景色,将文字隐藏掉 } else//当前行和上一行不属于同一个班级时 { if (this.dgvGrade.Rows[e.RowIndex - 1].DefaultCellStyle == this.m_RowStyleNormal)//根据上一行的样式设置当前行的样式 CurrentRow.DefaultCellStyle = this.m_RowStyleAlternate; else CurrentRow.DefaultCellStyle = this.m_RowStyleNormal; } }//if(e.RowIndex == 0) } else if (e.ColumnIndex == this.dgvGrade.Columns["ColumnGrade"].Index)//根据成绩设置单元格样式 { if (this.dgvGrade.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != DBNull.Value && Convert.ToInt32(this.dgvGrade.Rows[e.RowIndex].Cells[e.ColumnIndex].Value) < 60)//对不及格的成绩设置特殊样式 { this.dgvGrade.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.ForeColor = Color.Red;//设置小于60的数字显示为红色 this.dgvGrade.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.SelectionForeColor = Color.Red; this.dgvGrade.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.Alignment = DataGridViewContentAlignment.MiddleRight; } } } //根据内容设置行标头 private void dgvDataTable_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { if (this.dgvGrade.Rows[e.RowIndex].Cells["ColumnGrade"].Value == DBNull.Value) return; int intGrade = Convert.ToInt32(this.dgvGrade.Rows[e.RowIndex].Cells["ColumnGrade"].Value);//获取成绩 Image RowIcon;//标头图标 string strToolTip;//提示信息 if (intGrade >= 90) { RowIcon = TestDataGridViewRowStyle.Properties.Resources.GradeA;//从资源文件中获取图片 strToolTip = "Grade A"; } else if (intGrade >= 80) { RowIcon = TestDataGridViewRowStyle.Properties.Resources.GradeB; strToolTip = "Grade B"; } else if (intGrade >= 70) { RowIcon = TestDataGridViewRowStyle.Properties.Resources.GradeC; strToolTip = "Grade C"; } else if (intGrade >= 60) { RowIcon = TestDataGridViewRowStyle.Properties.Resources.GradeD; strToolTip = "Grade D"; } else { RowIcon = TestDataGridViewRowStyle.Properties.Resources.GradeF; strToolTip = "Grade F"; } e.Graphics.DrawImage(RowIcon, e.RowBounds.Left this.dgvGrade.RowHeadersWidth - 20, e.RowBounds.Top 4, 16, 16);//绘制图标 this.dgvGrade.Rows[e.RowIndex].HeaderCell.ToolTipText = strToolTip;//设置提示信息 } private void dgvGrade_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) { if (e.RowIndex >=0 && e.ColumnIndex == 2) { if (this.dgvGrade.Rows[e.RowIndex].Cells["ColumnGrade"].Value == DBNull.Value) return; int intGrade = Convert.ToInt32(this.dgvGrade.Rows[e.RowIndex].Cells["ColumnGrade"].Value); Image img; if (intGrade >= 90) { img = TestDataGridViewRowStyle.Properties.Resources.high; } else if (intGrade >= 80) { img = TestDataGridViewRowStyle.Properties.Resources.arrow; } else if (intGrade >= 70) { img = TestDataGridViewRowStyle.Properties.Resources.up; } else if (intGrade >= 60) { img = TestDataGridViewRowStyle.Properties.Resources.down; } else { img = TestDataGridViewRowStyle.Properties.Resources.low; } Rectangle newRect = new Rectangle(e.CellBounds.X 3, e.CellBounds.Y 5, e.CellBounds.Height - 15, e.CellBounds.Height - 12); using (Brush gridBrush = new SolidBrush(this.dgvGrade.GridColor), backColorBrush = new SolidBrush(e.CellStyle.BackColor)) { using (Pen gridLinePen = new Pen(gridBrush, 2)) { // Erase the cell. e.Graphics.FillRectangle(backColorBrush, e.CellBounds); //划线 Point p1 = new Point(e.CellBounds.Left e.CellBounds.Width, e.CellBounds.Top); Point p2 = new Point(e.CellBounds.Left e.CellBounds.Width, e.CellBounds.Top e.CellBounds.Height); Point p3 = new Point(e.CellBounds.Left, e.CellBounds.Top e.CellBounds.Height); Point[] ps = new Point[] { p1, p2, p3 }; e.Graphics.DrawLines(gridLinePen, ps); //画图标 e.Graphics.DrawImage(img, newRect); //画字符串 e.Graphics.DrawString(intGrade.ToString(), e.CellStyle.Font, Brushes.Crimson, e.CellBounds.Left 20, e.CellBounds.Top 5, StringFormat.GenericDefault); e.Handled = true; } } } } }}
    2014-08-29下载
    积分:1
  • live555 推流到H264 ES 流EasyDarwin
    live555 推流到H264 ES 流EasyDarwin, 循环推送,同时实现了MP4的推送,通过LIVE555实现推送,Linux系统下验证通过,用VLC播放,服务器的地址需要自己手动改。。。
    2022-05-07 09:31:30下载
    积分:1
  • 电磁组智能车程序
    利用官方提供的车模主体,电机,舵机,自行选用传感器,制作电路板,完成指定目标。摄像头组需要用摄像头传感器,检测赛道元素,使车模能够高速流畅的完成整个赛道竞速。电磁组需要用电感传感器来完成对赛道的检测,使车模准确地沿着赛道高速运行。
    2022-03-15 10:26:05下载
    积分:1
  • labview播放器
    labview播放器MP3 一款简单的音乐播放软件,通过labview可转换成多种平台支持的应用程序或APP,也可作为二次开发的基础在此基础上进一步编辑,链接平台
    2022-03-20 06:13:48下载
    积分:1
  • PID焊台
    一个使用ATMEGA88的焊台源码+原理图
    2022-01-25 18:27:19下载
    积分:1
  • TMP75数据手册
    zigebee 自己从网上查到的数据手册 方便下载 #include"iocc2530.h" #include"uart.h" #include"clock.h"   /*管脚定义是 SDA定义为P0.7 SCL定义为P0.6 */  //#define SCL P0_6  //#define SDA P0_7  #define TRUE 1  #define FALSE 0               //错误提示,全局变量 #define SlaveAddress   0x90 //定义器件在IIC总线中的从地址,根据SA0地址引脚不同修改 #define SET_SDA_OUT    P0DIR |= 0x8c; #define SET_SDA_IN     P0DIR &= ~0x8c;  #define SET_SCL_OUT    P0DIR |= 0x4c; #define SCL_H()       P0DIR |= 0x40; P0_6 = 1; #define SCL_L()       P0DIR |= 0x40; P0_6 = 0;  #define SDA_H()       P0DIR |=  0x80;P0_7 = 1;  #define SDA_L()       P0DIR |
    2022-10-15 21:25:08下载
    积分:1
  • MATLAB 点云数据的三维重建
    此程序主要用MATLAB 进行三维点云数据处理,对MATLAB进行三维重建有重要实用价值
    2022-05-27 12:46:25下载
    积分:1
  • 计算方法(迭代算法)
    本文基于计算方法中Jacobi迭代,Gauss-sedel迭代、SOR迭代原理,使用C#语言编写了三种迭代的算法。把算法集成到了窗体程序当中。
    2022-08-10 15:51:49下载
    积分:1
  • 696518资源总数
  • 105895会员总数
  • 18今日下载