for (WeightedValue<Resource> v : resultMatrix.columnNorm().normalize().toSortedArray()) {
if (++i > maxAnswers) {
break;
}
NodeSetList nsList = null;
int j = 0;
for (WeightedValue<Resource> v2 : resultMatrix.getRow(v.value).normalize().toSortedArray()) {
if (++j > maxJustifications) {
break;
}
NodeSet ns = new NodeSet(v2.value, (float) v2.weight, new AssumptionStep(context), context);
// FIXME: these will be in reverse order of weight, which is counterintuitive
nsList = new NodeSetList(ns, nsList, context);
}
InferenceStep infStep = new InferenceStep(rule, nsList, context);
NodeSet ns = new NodeSet(v.value, (float) v.weight, infStep, context);
answers.add(ns);