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

📄 edgeratiotopology.java

📁 pso源程序
💻 JAVA
字号:
/**
 * Description: The connection topology: each node has fixed number of connected nodes
 *   -> the number is determined by locRatio*nodeNumber
 *
 * @ Author        Create/Modi     Note
 * Xiaofeng Xie    Mar 19, 2007
 */

package maosKernel.topology;

import Global.basic.nodes.utilities.*;
import Global.methods.*;

public class EdgeRatioTopology extends AbsEdgeTopology {
  private double locRatio = 1;

  public EdgeRatioTopology() {}

 protected int initLocNumber(int nodeNumber) {
    if (locRatio<0||locRatio>1) locRatio = 1;
    return (int)Math.rint(locRatio*nodeNumber);
  }

  public void initUtilities() {
    super.initUtilities();
    initUtility(new DoubleUtility("locRatio", locRatio));
  }

  public void shortcutInit() throws Exception {
    super.shortcutInit();
    locRatio = TypeConverter.toDouble(getValue("locRatio"));
  }
}

⌨️ 快捷键说明

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