public NCRPNode select() { double[] weights = new double[children.size() + 1]; weights[0] = gamma / (gamma + customers); int i = 1; for (NCRPNode child: children) { weights[i] = (double) child.customers / (gamma + customers); i++; } int choice = random.nextDiscrete(weights); if (choice == 0) { return(addChild()); } else { return children.get(choice - 1); } }
public NCRPNode select() { double[] weights = new double[children.size() + 1]; weights[0] = gamma / (gamma + customers); int i = 1; for (NCRPNode child: children) { weights[i] = (double) child.customers / (gamma + customers); i++; } int choice = random.nextDiscrete(weights); if (choice == 0) { return(addChild()); } else { return children.get(choice - 1); } }
public NCRPNode select() { double[] weights = new double[children.size() + 1]; weights[0] = gamma / (gamma + customers); int i = 1; for (NCRPNode child: children) { weights[i] = (double) child.customers / (gamma + customers); i++; } int choice = random.nextDiscrete(weights); if (choice == 0) { return(addChild()); } else { return children.get(choice - 1); } }
public NCRPNode getNewLeaf() { NCRPNode node = this; for (int l=level; l<numLevels - 1; l++) { node = node.addChild(); } return node; }
public NCRPNode getNewLeaf() { NCRPNode node = this; for (int l=level; l<numLevels - 1; l++) { node = node.addChild(); } return node; }
public NCRPNode getNewLeaf() { NCRPNode node = this; for (int l=level; l<numLevels - 1; l++) { node = node.addChild(); } return node; }