diff --git a/problem-solver/cxx/searchModule/agents/FindSolvingMethodAgent.cpp b/problem-solver/cxx/searchModule/agents/FindSolvingMethodAgent.cpp index 32316cb7..d932036a 100644 --- a/problem-solver/cxx/searchModule/agents/FindSolvingMethodAgent.cpp +++ b/problem-solver/cxx/searchModule/agents/FindSolvingMethodAgent.cpp @@ -85,9 +85,16 @@ ScResult FindSolvingMethodAgent::DoProgram(ScActionInitiatedEvent const & event, generatedStruct << templateResult[i]; } ScTemplateSearchResult searchResult; - - if (m_context.SearchByTemplate(targetSituationTemplate, searchResult) && - isGeneratedStructureFound(generatedStruct, searchResult)) + bool isGeneratedConstructionFound = false; + m_context.SearchByTemplate( + targetSituationTemplate, + [&isGeneratedConstructionFound](ScTemplateSearchResultItem const & item) -> void { + isGeneratedConstructionFound = true; + }, + [this, generatedStruct](ScAddr const & elementAddr) -> bool { + return m_context.CheckConnector(generatedStruct, elementAddr, ScType::EdgeAccessConstPosPerm); + }); + if (isGeneratedConstructionFound) { suitableMethods.insert(solvingMethod); break;