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

📄 tourclueelempicker.java

📁 pso源程序
💻 JAVA
字号:
/**
 * Description: get tournamental selected index with small value
 *
 * @ Author        Create/Modi     Note
 * Xiaofeng Xie    Dec 04, 2006
 *
 *
 * @version 1.0
 */

package implement.common.behavior.elemPick.increment.candidatePick.clueBased.pick;

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

import maosKernel.behavior.AbsBehavior;

public class TourClueElemPicker extends AbsBehavior implements ICluePickEngine {
  private int[] tourSelIDArray = new int[1];

  //temp
  IElemDGetbyIDEngine clueArray;

  public TourClueElemPicker(){}

  public void initUtilities() {
    super.initUtilities();
    initUtility(new IntegerUtility("nTour", tourSelIDArray.length));
  }

  public void shortcutInit() throws Exception {
    super.shortcutInit();
    tourSelIDArray = new int[TypeConverter.toInteger(getValue("nTour"))];
  }

  public void setRealClue(IElemDGetbyIDEngine clueArray) {
    this.clueArray = clueArray;
  }

  public int pickBehavior(IBasicICollectionEngine idsArray) {
    int ntour = Math.min(idsArray.getSize(), tourSelIDArray.length);
    RandomGenerator.randomDistinctSelection(tourSelIDArray, idsArray.getSize(), ntour);
    double selV, baseV = Double.MAX_VALUE;
    int selID, baseID = -1;
    for (int i=0; i<ntour; i++) {
      selID = idsArray.getElementAt(tourSelIDArray[i]);
      selV = clueArray.getRealElementAt(selID);
      if (selV<baseV) {
        baseV = selV;
        baseID = selID;
      }
    }
    return baseID;
  }
}

⌨️ 快捷键说明

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