derandtobest1exp.java

来自「Differential Evolution(JAVA)」· Java 代码 · 共 33 行

JAVA
33
字号
package DeApp1.de;


public class DERandToBest1Exp extends DEStrategy
/***********************************************************
**                                                        **
** This strategy seems to be one of the best strategies.  **
** Try F=0.85 and CR=1. If you get misconvergence try to  **
** increase NP. If this doesn't help you should play      **
** around with all three control variables.               **
**                                                        **
** Authors:            Mikal Keenan                       **
**                     Rainer Storn                       **
**                                                        **
***********************************************************/
{
  public void apply (double F, double Cr, int dim, double[]x, double[]gen_best,
  double[][]g0)
  {
    prepare (dim);
    do
    {
	  x[i] += F * ((gen_best[i] - x[i]) + (g0[0][i] - g0[1][i]));		
      i = ++i % dim;
    } while ((deRandom.nextDouble() < Cr) && (++counter < dim));
  }
}





⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?