遗传算法如何生成解决方案..?

how does genetic algorithm generate solution..?

我正在使用下面给出的 GA 代码。我想知道 ga 遵循什么序列来生成可行的解决方案。? 它首先满足哪个约束是线性的还是非线性的?如果两个约束都不满足,它给出了什么样的解决方案? 是否有任何程序来确定约束的优先级(例如必须满足其中一个约束)?

%cost_1 is Objective function, reli_1 is nonlinear constraint function

%time_1 is matrix containing time of different components and no. of components = NoOfVariable

lb=zeros(NoOfVariables,1);

ub=ones(NoOfVariables,1);

IntCon=[1:NoOfVariables];

[v, fval] = ga(@cost_1, NoOfVariables,time_1,400, [], [], lb, ub, @reli_1,IntCon);

来自documentation

The ga solver handles linear constraints and bounds differently from nonlinear constraints. All the linear constraints and bounds are satisfied throughout the optimization. However, ga may not satisfy all the nonlinear constraints at every generation. If ga converges to a solution, the nonlinear constraints will be satisfied at that solution.

这意味着线性约束总是开箱即用,因为种群生成和交配策略会考虑到这一点(除非您实现自己的交叉函数并将其搞砸),但非线性约束会在之后评估并且可能不满意。所以在人口中会有一定比例的个体不满足这种线性约束,这些结果将被丢弃。你可以看到运行后有多少人被丢弃了。

据我所知,没有办法控制这种行为或交换评估的顺序。