use of nars.language.Term in project opennars by opennars.
the class InternalExperience method InternalExperienceFromTaskInternal.
public static boolean InternalExperienceFromTaskInternal(Memory memory, Task task, boolean full) {
if (!enabled) {
return false;
}
// if(OLD_BELIEVE_WANT_EVALUATE_WONDER_STRATEGY ||
// (!OLD_BELIEVE_WANT_EVALUATE_WONDER_STRATEGY && (task.sentence.punctuation==Symbols.QUESTION_MARK || task.sentence.punctuation==Symbols.QUEST_MARK))) {
{
if (task.sentence.punctuation == Symbols.QUESTION_MARK || task.sentence.punctuation == Symbols.QUEST_MARK) {
if (task.getPriority() < MINIMUM_PRIORITY_TO_CREATE_WONDER_EVALUATE) {
return false;
}
} else if (task.getPriority() < MINIMUM_PRIORITY_TO_CREATE_WANT_BELIEVE_ETC) {
return false;
}
}
Term content = task.getTerm();
// to prevent infinite recursions
if (content instanceof Operation) /* || Memory.randomNumber.nextDouble()>Parameters.INTERNAL_EXPERIENCE_PROBABILITY*/
{
return true;
}
Sentence sentence = task.sentence;
TruthValue truth = new TruthValue(1.0f, Parameters.DEFAULT_JUDGMENT_CONFIDENCE);
Stamp stamp = task.sentence.stamp.clone();
stamp.setOccurrenceTime(memory.time());
Term ret = toTerm(sentence, memory);
if (ret == null) {
return true;
}
Sentence j = new Sentence(ret, Symbols.JUDGMENT_MARK, truth, stamp);
BudgetValue newbudget = new BudgetValue(Parameters.DEFAULT_JUDGMENT_CONFIDENCE * INTERNAL_EXPERIENCE_PRIORITY_MUL, Parameters.DEFAULT_JUDGMENT_PRIORITY * INTERNAL_EXPERIENCE_DURABILITY_MUL, BudgetFunctions.truthToQuality(truth));
if (!OLD_BELIEVE_WANT_EVALUATE_WONDER_STRATEGY) {
newbudget.setPriority(task.getPriority() * INTERNAL_EXPERIENCE_PRIORITY_MUL);
newbudget.setDurability(task.getDurability() * INTERNAL_EXPERIENCE_DURABILITY_MUL);
}
Task newTask = new Task(j, (BudgetValue) newbudget, true);
memory.addNewTask(newTask, "Reflected mental operation (Internal Experience)");
return false;
}
use of nars.language.Term in project opennars by opennars.
the class VisionChannel method step_start.
@Override
public void step_start() {
Sentence s = new Sentence(Inheritance.make(new Term("A"), this.label), Symbols.JUDGMENT_MARK, new TruthValue(1.0f, Parameters.DEFAULT_JUDGMENT_CONFIDENCE), new Stamp(nar.memory));
Task T = new Task(s, new BudgetValue(Parameters.DEFAULT_JUDGMENT_PRIORITY, Parameters.DEFAULT_JUDGMENT_DURABILITY, BudgetFunctions.truthToQuality(s.truth)), true);
// feeds results into "upper" sensory channels:
this.results.add(T);
this.step_finished();
}
use of nars.language.Term in project opennars by opennars.
the class VisualSpace method ConstructSpace.
@Override
public ImaginationSpace ConstructSpace(Conjunction program) {
if (program.isSpatial || program.getTemporalOrder() != TemporalRules.ORDER_FORWARD) {
// would be a strange program :)
return null;
}
Term beginning = program.term[0];
if (beginning.imagination == null) {
return null;
}
ImaginationSpace cur = beginning.imagination;
// "execute program":
for (int i = 1; i < program.term.length; i += 1) {
if (!(program.term[i] instanceof Operation)) {
return null;
}
Operation oper = (Operation) program.term[i];
if (!IsOperationInSpace(oper)) {
return null;
}
cur = cur.ProgressSpace(oper, cur);
i++;
}
return null;
}
use of nars.language.Term in project opennars by opennars.
the class Believe method execute.
/**
* To create a judgment with a given statement
* @param args Arguments, a Statement followed by an optional tense
* @param memory The memory in which the operation is executed
*+ * @return Immediate results as Tasks
*/
@Override
protected ArrayList<Task> execute(Operation operation, Term[] args, Memory memory) {
Term content = args[1];
TruthValue truth = new TruthValue(1, Parameters.DEFAULT_JUDGMENT_CONFIDENCE);
Sentence sentence = new Sentence(content, Symbols.JUDGMENT_MARK, truth, new Stamp(memory));
float quality = BudgetFunctions.truthToQuality(truth);
BudgetValue budget = new BudgetValue(Parameters.DEFAULT_JUDGMENT_PRIORITY, Parameters.DEFAULT_JUDGMENT_DURABILITY, quality);
return Lists.newArrayList(new Task(sentence, budget, true));
}
use of nars.language.Term in project opennars by opennars.
the class Consider method execute.
/**
* To activate a concept as if a question has been asked about it
*
* @param args Arguments, a Statement followed by an optional tense
* @param memory The memory in which the operation is executed
* @return Immediate results as Tasks
*/
@Override
protected ArrayList<Task> execute(Operation operation, Term[] args, Memory memory) {
Term term = args[1];
Concept concept = memory.conceptualize(Consider.budgetMentalConcept(operation), term);
DerivationContext cont = new DerivationContext(memory);
cont.setCurrentConcept(concept);
GeneralInferenceControl.fireConcept(cont, 1);
return null;
}
Aggregations