use of org.eclipse.collections.api.tuple.primitive.ByteLongPair in project narchy by automenta.
the class Tasklinks method linkTaskTemplates.
public static void linkTaskTemplates(Concept c, Task t, float priApplied, NAR nar) {
Concept[] cc = c.templates().conceptsShuffled(nar, true);
int ccs = cc.length;
if (ccs <= 0)
return;
MutableFloat overflow = new MutableFloat();
float p = priApplied;
float pEach = p / ccs;
if (pEach > Pri.EPSILON) {
Pair<Term, ByteLongPair> tlSeed = TaskLink.GeneralTaskLink.seed(t, false, nar);
final float headRoom = 1f - pEach;
for (int i = 0; i < ccs; i++) {
float o = overflow.get();
// spread overflow of saturated targets to siblings
float change;
if (o >= Pri.EPSILON) {
overflow.subtract(change = Math.min(o, headRoom));
} else {
change = 0;
}
TaskLink xx = // new TaskLink.DirectTaskLink(t, pEach + change);
new TaskLink.GeneralTaskLink(tlSeed, pEach + change);
linkTask(xx, cc[i].tasklinks(), overflow);
}
}
}
Aggregations