Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,26 @@ ScResult DirectInferenceAgent::DoProgram(ScActionInitiatedEvent const & event, S
ScAddr solutionNode = inferenceManager->getSolutionTreeManager()->createSolution(outputStructure, targetAchieved);

action.FormResult(solutionNode);

ScIterator3Ptr successSolutionEdgeIterator =
m_context.CreateIterator3(InferenceKeynodes::concept_success_solution, ScType::Unknown, solutionNode); //searching for successSoclutionEdge Type
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider specifying the expected edge type in CreateIterator3 instead of using ScType::Unknown for clarity and to avoid ambiguity.

// type is negative - target wasn't achieved
// type is positive - target was achieved

while (successSolutionEdgeIterator->Next())
{
ScAddr successSolutionEdge = successSolutionEdgeIterator->Get(1);
ScType const & successSolutionEdgeType = m_context.GetElementType(successSolutionEdge);
if (successSolutionEdgeType == ScType::EdgeAccessConstNegPerm)
{
SC_AGENT_LOG_ERROR("Target wasn't achieved");
return action.FinishUnsuccessfully();
}
}


return action.FinishSuccessfully();
}

ScAddr DirectInferenceAgent::GetActionClass() const
{
return InferenceKeynodes::action_direct_inference;
Expand Down