コード例 #1
0
ファイル: Unified.java プロジェクト: syntheke/FromSVN
  public void getPermutedScore(boolean isNested) {

    if (isNested) {
      int[] un_related = Sample.SampleIndex(0, qualified_Unrelated - 1, qualified_Unrelated);
      for (int i = 0; i < un_related.length; i++) {
        PersonTable.get(i).setPermutedScore(score[un_related[i]]);
      }
      int c = qualified_Unrelated;
      for (int i = 0; i < numSib.length; i++) {
        int[] si = Sample.SampleIndex(0, numSib[i] - 1, numSib[i]);
        for (int j = 0; j < si.length; j++) {
          PersonTable.get(c + j).setPermutedScore(score[c + si[j]]);
        }
        c += si.length;
      }
    } else {
      int[] idx = Sample.SampleIndex(0, PersonTable.size() - 1, PersonTable.size());
      for (int i = 0; i < idx.length; i++) {
        PersonTable.get(i).setPermutedScore(score[idx[i]]);
      }
    }
  }
コード例 #2
0
  public TMSeller(
      BufferHolder bh, PaymentSender ps, ItemSender is, AuctionHouse ah, List<ItemType> itemTypes) {
    super(bh, ps, is, ah);

    int numberOfAuctions = numberOfAuctions(r.nextDouble());
    int numberOfTimeUnits = AuctionHouse.ONE_DAY * (100 - 7);

    List<Integer> listOfTimes = Sample.randomSample(numberOfTimeUnits, numberOfAuctions, r);
    Collections.sort(listOfTimes, Collections.reverseOrder());
    auctionSubmissionTimes = new ArrayDeque<>(listOfTimes);
    //		System.out.println(auctionSubmissionTimes.size());
    itemTypesUsed = new ArrayList<>();
    this.itemTypes = itemTypes;
  }