Indexing variables from 1 on and not 0.

This commit is contained in:
Patrick Lühne 2016-11-24 15:23:38 +01:00
parent de34d05898
commit 223d380a03
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
3 changed files with 3 additions and 3 deletions

View File

@ -19,7 +19,7 @@ struct Context
output::Logger logger;
std::vector<const Clingo::AST::Term *> headTerms;
size_t auxiliaryBodyLiteralID = 0;
size_t auxiliaryBodyLiteralID = 1;
};
////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -175,7 +175,7 @@ struct TermPrintSubstitutedVisitor
assert(matchingTerm != context.headTerms.cend());
const auto variableName = std::string(AuxiliaryHeadVariablePrefix) + std::to_string(matchingTerm - context.headTerms.cbegin());
const auto variableName = std::string(AuxiliaryHeadVariablePrefix) + std::to_string(matchingTerm - context.headTerms.cbegin() + 1);
outputStream << output::Variable(variableName.c_str());
}

View File

@ -46,7 +46,7 @@ struct StatementVisitor
if (i != context.headTerms.cbegin())
outputStream << ", ";
const auto variableName = std::string(AuxiliaryHeadVariablePrefix) + std::to_string(i - context.headTerms.cbegin());
const auto variableName = std::string(AuxiliaryHeadVariablePrefix) + std::to_string(i - context.headTerms.cbegin() + 1);
outputStream
<< output::Variable(variableName.c_str())