2

Is there a trick to getting Octave's genetic algorithm solver to respect upper and lower bounds? For example,

options = gaoptimset('Generations', 10);
nvars = 6;
LB = ones(1,nvars);
UB = LB*10;
[soln, fval, exitflag] = ga(@fitnessfcn, nvars, [], [], [], [], LB, UB, [], options)

The solver returns a solution with undetermined bounds. For example,

soln = 0.551420   1.369775  -0.313379  -0.038621   0.274696   1.359802

UPDATE: I checked the scripts in the Octave package. I am pretty sure the ga function does not use the upper and lower bounds arguments. It does seems to read some upper/lower bound information from the gaoptim set. I'll play around with it when I have some time.

4

2 回答 2

0

根据 0.10 版,作为参数传递的边界似乎ga几乎被忽略了。目前,指定边界的唯一方法是通过参数PopInitRangeof gaoptimset,这需要一个 2xN 矩阵,其中包含第一行中的 LB 和第二行中的 UB。如果提供了 2x1 向量。

LB 和 UB 参数应该模仿原始 Matlab 的ga功能,但显然实现是在采取他自己的方式。

于 2013-05-16T08:27:14.937 回答
0

问题

我可以确认ga()octave ga数据包中的实现没有使用参数边界。

解决方法

我通过检查我的 score 函数ParaOutOfRangePenalty中的边界并在违反边界时给出一个恒定的高罚分来解决这个限制。您可以在您的fitnessfcn():

% Your problem specific score calculation goes here:
score = myfitnessfcn(data,parameters);

% Add score for each parameter outside limits to create a "soft" punishment
score = score + sum(parameters(:) < lowerBound))*ParaOutOfRangePenalty;
score = score + sum(parameters(:) > upperBound))*ParaOutOfRangePenalty;

结果

我发现 octavega()算法显然尊重使用这种方法的边界。

于 2018-04-27T11:52:24.497 回答