无约束多维优化坐标轮换法vb编程
更新时间:2023-05-16 21:59:01 阅读量: 实用文档 文档下载
- 多维无约束优化求目标函数推荐度:
- 相关推荐
VB
坐标轮换法程序框图
VB
Vb运行界面
Vb编程程序
Private Sub Command1_Click()
Dim s110 As Double
Dim s100 As Double
Dim s200 As Double
Dim s210 As Double
Dim x100(10000000) As Double
Dim x110(10000000) As Double
Dim x200(10000000) As Double
Dim x210(10000000) As Double
Dim αα1 As Double
Dim αα2 As Double
Dim k As Long
Dim a1#, a2#, a3#, a4#, a5#, a6#
Dim h#, e1#, e#
Dim α0#, α1#, α2#, α3#, a#, b#
Dim xx1#, xx2#, yy1#, yy2#, yy3#
Dim f2#, f1#, fxx#
α0 = Val(Text10.Text)
h = Val(Text11.Text)
e1 = Val(Text12.Text)
x100(0) = Val(Text7.Text)
x110(0) = Val(Text8.Text)
VB
a1 = Val(Text1.Text): a2 = Val(Text2.Text): a3 = Val(Text3.Text): a4 = Val(Text4.Text): a5 = Val(Text5.Text): a6 = Val(Text6.Text)
e = Val(Text9.Text)
k = 0
m1: s100 = 1: s110 = 0
'一维搜索求最优解
α1 = α0
xx1 = x100(k) + s100 * α1: xx2 = x110(k) + s110 * α1: yy1 = a1 * xx1 ^ 2 + a2 * xx2 ^ 2 + a3 * xx1 * xx2 + a4 * xx1 + a5 * xx2 + a6
α2 = α0 + h
xx1 = x100(k) + s100 * α2: xx2 = x110(k) + s110 * α2: yy2 = a1 * xx1 ^ 2 + a2 * xx2 ^ 2 + a3 * xx1 * xx2 + a4 * xx1 + a5 * xx2 + a6
If yy1 > yy2 Then
h = 2 * h
Else
h = -0.25 * h
α3 = α1
α1 = α2
α2 = α3
yy3 = yy1
yy1 = yy2
yy2 = yy3
End If
α3 = α0 + h
xx1 = x100(k) + s100 * α3: xx2 = x110(k) + s110 * α3: yy3 = a1 * xx1 ^ 2 + a2 * xx2 ^ 2 + a3 * xx1 * xx2 + a4 * xx1 + a5 * xx2 + a6
Do While yy2 > yy3
h = 2 * h
α1 = α2
yy1 = yy2
α2 = α3
yy2 = yy3
α3 = α0 + h
xx1 = x100(k) + s100 * α3: xx2 = x110(k) + s110 * α3: yy3 = a1 * xx1 ^ 2 + a2 * xx2 ^ 2 + a3 * xx1 * xx2 + a4 * xx1 + a5 * xx2 + a6
Loop
If h > 0 Then
a = α1
ya = yy1
b = α3
yb = yy3
Else
a = α3
b = α1
VB
yb = yy1
End If
α1 = a + 0.382 * (b - a)
α2 = a + 0.618 * (b - a)
xx1 = x100(k) + s100 * α1: xx2 = x110(k) + s110 * α1: yy1 = a1 * xx1 ^ 2 + a2 * xx2 ^ 2 + a3 * xx1 * xx2 + a4 * xx1 + a5 * xx2 + a6
xx1 = x100(k) + s100 * α2: xx2 = x110(k) + s110 * α2: yy2 = a1 * xx1 ^ 2 + a2 * xx2 ^ 2 + a3 * xx1 * xx2 + a4 * xx1 + a5 * xx2 + a6
Do While Abs(b - a) > e1
If yy1 < yy2 Then
n0 = 0
b = α2
α2 = α1
yy2 = yy1
Else
n0 = 1
a = α1
α1 = α2
yy1 = yy2
End If
If n0 = 0 Then
α1 = a + 0.382 * (b - a)
xx1 = x100(k) + s100 * α1: xx2 = x110(k) + s110 * α1: yy1 = a1 * xx1 ^ 2 + a2 * xx2 ^ 2 + a3 * xx1 * xx2 + a4 * xx1 + a5 * xx2 + a6
Else
α2 = a + 0.618 * (b - a)
xx1 = x100(k) + s100 * α2: xx2 = x110(k) + s110 * α2: yy2 = a1 * xx1 ^ 2 + a2 * xx2 ^ 2 + a3 * xx1 * xx2 + a4 * xx1 + a5 * xx2 + a6
End If
Loop
αα1 = (a + b) / 2
x200(k) = x100(k) + s100 * αα1
x210(k) = x110(k) + s110 * αα1
s200 = 0: s210 = 1
'一维搜索求最优解
α1 = α0
xx1 = x200(k) + s200 * α1: xx2 = x210(k) + s210 * α1: yy1 = a1 * xx1 ^ 2 + a2 * xx2 ^ 2 + a3 * xx1 * xx2 + a4 * xx1 + a5 * xx2 + a6
α2 = α0 + h
xx1 = x200(k) + s200 * α2: xx2 = x210(k) + s210 * α2: yy2 = a1 * xx1 ^ 2 + a2 * xx2 ^ 2 + a3 * xx1 * xx2 + a4 * xx1 + a5 * xx2 + a6
If yy1 > yy2 Then
VB
Else
h = -0.25 * h
α3 = α1
α1 = α2
α2 = α3
yy3 = yy1
yy1 = yy2
yy2 = yy3
End If
α3 = α0 + h
xx1 = x200(k) + s200 * α3: xx2 = x210(k) + s210 * α3: yy3 = a1 * xx1 ^ 2 + a2 * xx2 ^ 2 + a3 * xx1 * xx2 + a4 * xx1 + a5 * xx2 + a6
Do While yy2 > yy3
h = 2 * h
α1 = α2
yy1 = yy2
α2 = α3
yy2 = yy3
α3 = α0 + h
xx1 = x200(k) + s200 * α3: xx2 = x210(k) + s210 * α3: yy3 = a1 * xx1 ^ 2 + a2 * xx2 ^ 2 + a3 * xx1 * xx2 + a4 * xx1 + a5 * xx2 + a6
Loop
If h > 0 Then
a = α1
ya = yy1
b = α3
yb = yy3
Else
a = α3
b = α1
ya = yy3
yb = yy1
End If
α1 = a + 0.382 * (b - a)
α2 = a + 0.618 * (b - a)
xx1 = x200(k) + s200 * α1: xx2 = x210(k) + s210 * α1: yy1 = a1 * xx1 ^ 2 + a2 * xx2 ^ 2 + a3 * xx1 * xx2 + a4 * xx1 + a5 * xx2 + a6
xx1 = x200(k) + s200 * α2: xx2 = x210(k) + s210 * α2: yy2 = a1 * xx1 ^ 2 + a2 * xx2 ^ 2 + a3 * xx1 * xx2 + a4 * xx1 + a5 * xx2 + a6
Do While Abs(b - a) > e1
If yy1 < yy2 Then
n0 = 0
b = α2
VB
α2 = α1
yy2 = yy1
Else
n0 = 1
a = α1
α1 = α2
yy1 = yy2
End If
If n0 = 0 Then
α1 = a + 0.382 * (b - a)
xx1 = x200(k) + s200 * α1: xx2 = x210(k) + s210 * α1: yy1 = a1 * xx1 ^ 2 + a2 * xx2 ^ 2 + a3 * xx1 * xx2 + a4 * xx1 + a5 * xx2 + a6
Else
α2 = a + 0.618 * (b - a)
xx1 = x200(k) + s200 * α2: xx2 = x210(k) + s210 * α2: yy2 = a1 * xx1 ^ 2 + a2 * xx2 ^ 2 + a3 * xx1 * xx2 + a4 * xx1 + a5 * xx2 + a6
End If
Loop
αα2 = (a + b) / 2
x200(k + 1) = x200(k) + s200 * αα2
x210(k + 1) = x210(k) + s210 * αα2
xx1 = x200(k): xx2 = x210(k): f1 = a1 * xx1 ^ 2 + a2 * xx2 ^ 2 + a3 * xx1 * xx2 + a4 * xx1 + a5 * xx2 + a6
xx1 = x200(k + 1): xx2 = x210(k + 1): f2 = a1 * xx1 ^ 2 + a2 * xx2 ^ 2 + a3 * xx1 * xx2 + a4 * xx1 + a5 * xx2 + a6
If Abs((x200(k + 1) - x200(k)) ^ 2 + (x210(k + 1) - x210(k)) ^ 2) <= e And Abs((f2 - f1) / f2) <= e Then
xx1 = x200(k + 1): xx2 = x210(k + 1)
fxx = a1 * xx1 ^ 2 + a2 * xx2 ^ 2 + a3 * xx1 * xx2 + a4 * xx1 + a5 * xx2 + a6
Else
x100(k + 1) = x200(k): x110(k + 1) = x210(k)
k = k + 1
GoTo m1
End If
Text13.Text = xx1
Text14.Text = xx2
Text15.Text = fxx
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
正在阅读:
无约束多维优化坐标轮换法vb编程05-16
某建设集团公司职业卫生管理制度04-30
职高政治课中的多媒体教学03-18
大直径重载齿轮渗碳淬火变形的有效控制05-10
气电集团与淮南矿业集团内河LNG项目- 中国煤炭工业协会02-27
如何设计清洁类化妆品项目可行性研究报告(技术工艺+设备选型+财务概算+厂区规划)投资方案05-05
副县长在2023年全县突出环境问题整治工作专题会议上的讲话最新讲03-22
2016年上半年幼儿教师资格证考试《幼儿综合素质》真题及答案12-27
1920年以前力学发展史06-11
境外直接投资人民币结算试点管理办法07-19
- 教学能力大赛决赛获奖-教学实施报告-(完整图文版)
- 互联网+数据中心行业分析报告
- 2017上海杨浦区高三一模数学试题及答案
- 招商部差旅接待管理制度(4-25)
- 学生游玩安全注意事项
- 学生信息管理系统(文档模板供参考)
- 叉车门架有限元分析及系统设计
- 2014帮助残疾人志愿者服务情况记录
- 叶绿体中色素的提取和分离实验
- 中国食物成分表2020年最新权威完整改进版
- 推动国土资源领域生态文明建设
- 给水管道冲洗和消毒记录
- 计算机软件专业自我评价
- 高中数学必修1-5知识点归纳
- 2018-2022年中国第五代移动通信技术(5G)产业深度分析及发展前景研究报告发展趋势(目录)
- 生产车间巡查制度
- 2018版中国光热发电行业深度研究报告目录
- (通用)2019年中考数学总复习 第一章 第四节 数的开方与二次根式课件
- 2017_2018学年高中语文第二单元第4课说数课件粤教版
- 上市新药Lumateperone(卢美哌隆)合成检索总结报告
- 多维
- 轮换
- 坐标
- 约束
- 优化
- 编程
- 一阶直线倒立摆系统的可控性研究
- 《社会主义市场经济理论》试卷及答案汇总
- 长虹遥控器与整机型号对照表
- 2012年秋季精英班入学测试卷-数学三
- 城市园林绿化企业资质申请表
- 芮城县幼儿园中班下学期保教目标
- 抗日战争词汇汇总
- 古代汉语复习资料
- 学生会2013--2014年第二学期工作计划
- 口腔溃疡的治疗验方大全
- 浅论基督徒家庭的儿女教育
- 内蒙古乌兰察布市卓资县第三产业生产总值和城镇常住居民人均可支配收入数据解读报告2020版
- 中考数学作图题复习
- 中职物联网技术应用专业定位与课程设置
- 医疗机构手术及高风险有创操作分级与分类管理规范
- 北师大版第五册《长方形、正方形周长的计算》教学设计
- 2012创新方案 实验专题实验09 描绘小电珠的伏安特性曲线
- 陈毅之子陈昊苏:中国外交该强硬时会强硬
- 人教版初中语文知识树
- 青岛版2014年小学数学三年级上册第一二单元测试题