⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chindgeng.java

📁 关于改进pso的源程序
💻 JAVA
字号:
/**
 * Description: chindgeng's function.
 *
 * @ Author        Create/Modi     Note
 * Xiaofeng Xie    Jun 01, 2005
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * Please acknowledge the author(s) if you use this code in any way.
 *
 * @version 1.0
 * @Since MAOS1.0
 */

package problem.constrained;

import problem.*;
import Global.*;

public class Chindgeng extends ProblemEncoder {
  private double d1 = 2.5;
  private double d2 = 4.5;
  private double d3 = 4.3;
  private double d4 = 8.6;

  public Chindgeng() throws Exception {
    super(4, 4);
    setDefaultYAt(0, BasicBound.MINDOUBLE, BasicBound.MINDOUBLE); // Minimize Objective
    setDefaultYAt(1, 0, BasicBound.MAXDOUBLE); //Largthan constraints (<0)
    setDefaultYAt(2, 0, BasicBound.MAXDOUBLE);
    setDefaultYAt(3, 0, BasicBound.MAXDOUBLE);

    setDefaultXAt(0, 3, 12.4);
    setDefaultXAt(1, 5.5, 36);
    setDefaultXAt(2, 9.5, 50);
    setDefaultXAt(3, 3, 75);
  }

  protected double calcTargetAt(int index, double[] VX) {
    double value = 0;
    double t1 = VX[0];
    double t2 = VX[1];
    double t3 = VX[2];
    double t4 = VX[3];
    double u1 = t2-t1-9;
    double u2 = t3-t2-8;
    double u3 = t4-t3-8;
    switch(index) {
      case 0:
        value = d1*d1*d1/(t1*t1)+d2*d2*d2/(u1*u1)+d3*d3/(u2*u2)+d4*d4*d4/(u3*u3);
        break;
      case 1:
        value = t2-t1-9;
        break;
      case 2:
        value = t3-t2-8;
        break;
      case 3:
        value = t4-t3-8;
        break;
      default:
        return Double.NaN;
    }
    return value;
  }
}

⌨️ 快捷键说明

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