515 发表于 2007-9-6 10:52

遗传算法工具箱 非线性条件如何编写

Aeq=;
H =;
非线性限制条件为Aeq*x’-0.5*x*H*x‘-13=0
但是不知道在遗传算法工具箱中的Nonlinear constraint 该如何编写?
请教高手指点

心灯 发表于 2007-9-6 11:53

doc ga

x = ga(fitnessfcn,nvars,A,b,Aeq,beq,LB,UB,nonlcon) subjects
the minimization to the constraints defined in nonlcon.
The function nonlcon accepts x and
returns the vectors C and Ceq, representing
the nonlinear inequalities and equalities respectively. ga minimizes
the fitnessfcn such that C(x)≤0 and Ceq(x)=0.
(Set LB=[] and UB=[] if no bounds exist.)

所以 x = ga(fitnessfcn,nvars,A,b,Aeq,beq,LB,UB,@mynoncon)

其中
function = mynoncon(x)

c=...
ceq = ...

心灯 发表于 2007-9-6 11:55

另外,你用help ga能够看到说明里给举了例子的,仔细看一下吧
页: [1]
查看完整版本: 遗传算法工具箱 非线性条件如何编写