Skip to content

Commit

Permalink
Excise old justification when duplicate is made
Browse files Browse the repository at this point in the history
This is a POC that makes the unit test pass. Still need to spruce up the output
and restrict the excision to only o-supported productions.

See #529
  • Loading branch information
garfieldnate committed Feb 13, 2025
1 parent d07589e commit e53179d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Core/SoarKernel/src/decision_process/rete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3808,12 +3808,19 @@ byte add_production_to_rete(agent* thisAgent, production* p, condition* lhs_top,
output << "\nIgnoring "
<< p->name->to_string(true)
<< " because it is a duplicate of "
<< p_node->b.p.prod->name->to_string(true)
<< duplicate_rule->name->to_string(true)
<< " ";
xml_generate_warning(thisAgent, output.str().c_str());

thisAgent->outputManager->printa_sf(thisAgent, "Ignoring %y because it is a duplicate of %y\n",
p->name, p_node->b.p.prod->name);
p->name, duplicate_rule->name);
}
// TODO: only excise previous if o-supported
// TODO: reorganize and fix outputs; should not say it's ignoring the justification, but should say previous is being excised.
if (p->type == JUSTIFICATION_PRODUCTION_TYPE) {
thisAgent->outputManager->printa_sf(thisAgent, "Excising existing duplicate justification %y to replace with %y\n", duplicate_rule->name, p->name);
excise_production_from_rete(thisAgent, duplicate_rule);
break;
}
thisAgent->symbolManager->deallocate_symbol_list_removing_references(rhs_unbound_vars_for_new_prod);
return DUPLICATE_PRODUCTION;
Expand Down

0 comments on commit e53179d

Please sign in to comment.