摘要: 下面举例说明如何运用GA工具箱求解多约束非线性规划问题: function f =fitness(x) f=exp(x(1))*(4*x(1)^2+2*x(2)^2+4*x(1)*x(2)+2*x(2)+1); function [c,ceq]=constraint(x) c(1)=1.5+x(1) 阅读全文
posted @ 2018-09-05 22:13 clemente 阅读(5169) 评论(0) 推荐(0) 编辑
摘要: 求非线性规划 min f(x)= x(1)^2 + x(2)^2 + 8 s.t. { x(1)^2-x(2)>=0 , -x(1) - x(2)^2 +2 = 0, x(1)>=0 ,x(2)>=0 } 首先定义增广目标函数 编写M函数 fitness.m function g =fitness( 阅读全文
posted @ 2018-09-05 20:42 clemente 阅读(636) 评论(0) 推荐(0) 编辑
摘要: import matplotlib.pyplot as plt X=[56.70466067,56.70466067,56.70466067,56.70466067,56.70466067,58.03256629,58.03256629,58.03256629,58.03256629,58.0325 阅读全文
posted @ 2018-09-05 16:35 clemente 阅读(496) 评论(0) 推荐(0) 编辑
摘要: %x=[randn(30,2)*.4;randn(40,2)*.5+ones(40,1)*[4 4]]; 测试 数据 或者 可以另外指定 X=[56.70466067,56.70466067,56.70466067,56.70466067,56.70466067,58.03256629,58.032 阅读全文
posted @ 2018-09-05 16:03 clemente 阅读(1498) 评论(0) 推荐(0) 编辑