Allows to write M_.objective_tmp_nbr in the driver.m file

Writes the number of temporary terms of the planner objective function derivatives objective_tmp_nbr in the driver.m file.
Useful for the k-order approximations of welfare.
issue#70
NormannR 2021-06-11 12:37:31 +02:00
parent 74ef3457b4
commit d0ec5eb155
2 changed files with 12 additions and 1 deletions

View File

@ -2214,7 +2214,11 @@ PlannerObjectiveStatement::writeOutput(ostream &output, const string &basename,
output << "M_.NNZDerivatives_objective = [";
for (int i=1; i < static_cast<int>(model_tree.getNNZDerivatives().size()); i++)
output << (i > model_tree.getComputedDerivsOrder() ? -1 : model_tree.getNNZDerivatives()[i]) << ";";
output << "];";
output << "];" << endl;
output << "M_.objective_tmp_nbr = [";
for (const auto &temporary_terms_derivative : model_tree.getTemporaryTermsDerivatives())
output << temporary_terms_derivative.size() << "; ";
output << "];" << endl;
model_tree.writeStaticFile(basename + ".objective", false, false, false, "", {}, {}, false);
}

View File

@ -462,6 +462,13 @@ public:
return NNZDerivatives;
}
//! Returns the vector of temporary terms derivatives
inline const vector<temporary_terms_t> &
getTemporaryTermsDerivatives() const
{
return temporary_terms_derivatives;
}
//!Returns the maximum order of computed derivatives
inline int
getComputedDerivsOrder() const