Search in sources :

Example 1 with TruthPolation

use of nars.task.TruthPolation in project narchy by automenta.

the class RTreeBeliefTable method truth.

@Override
public Truth truth(long start, long end, EternalTable eternal, int dur) {
    assert (end >= start);
    final Task ete = eternal != null ? eternal.strongest() : null;
    int s = size();
    x: if (s > 0) {
        if (start == ETERNAL) {
            LongInterval r = ((LongInterval) root().bounds());
            if (r == null)
                break x;
            // return ete != null ? ete.truth() : null;
            start = r.start();
            end = r.end();
        }
        int maxTruths = TRUTHPOLATION_LIMIT;
        int maxTries = (int) Math.max(1, Math.ceil(capacity * SCAN_QUALITY));
        maxTries = Math.min(s * 2, /* in case the same task is encountered twice HACK*/
        maxTries);
        ScanFilter tt = new ScanFilter(maxTruths, maxTruths, task(// taskRelevance(start, end)
        taskStrength(start, end, dur)), maxTries).scan(this, start - dur, end + dur);
        if (!tt.isEmpty()) {
            return new TruthPolation(start, end, dur, tt).truth(ete);
        // PreciseTruth pt = Param.truth(null, start, end, dur, tt);
        // if (pt!=null && (ete == null || (pt.evi() >= ete.evi())))
        // return pt;
        }
    }
    return ete != null ? ete.truth() : null;
}
Also used : SignalTask(nars.task.signal.SignalTask) NALTask(nars.task.NALTask) Task(nars.Task) LongInterval(jcog.math.LongInterval) TruthPolation(nars.task.TruthPolation)

Example 2 with TruthPolation

use of nars.task.TruthPolation in project narchy by automenta.

the class ScalarBeliefTable method eval.

protected Truthed eval(boolean taskOrJustTruth, long start, long end, NAR nar) {
    int dur = nar.dur();
    DynTruth d = series.truth(start, end, dur, nar);
    if (d == null)
        return null;
    TruthPolation p = new TruthPolation(start, end, dur, d);
    Truth pp = p.truth(false);
    if (pp == null)
        return null;
    float freqRes = taskOrJustTruth ? Math.max(nar.freqResolution.floatValue(), res.asFloat()) : 0;
    float confRes = // nar.confResolution.floatValue();
    0;
    float eviMin = Truth.EVI_MIN;
    return d.eval(term, (dd, n) -> pp, taskOrJustTruth, beliefOrGoal, freqRes, confRes, eviMin, nar);
}
Also used : TruthPolation(nars.task.TruthPolation) Truth(nars.truth.Truth)

Aggregations

TruthPolation (nars.task.TruthPolation)2 LongInterval (jcog.math.LongInterval)1 Task (nars.Task)1 NALTask (nars.task.NALTask)1 SignalTask (nars.task.signal.SignalTask)1 Truth (nars.truth.Truth)1