Commit da63d21f authored by MichelJuillard's avatar MichelJuillard

fixing problems with Ramsey policy and auxiliary variables

parent e5cee0fd
......@@ -1739,7 +1739,7 @@ StaticModel::writeStaticFile(const string &basename, bool block, bool bytecode,
writeStaticJuliaFile(basename);
else
writeStaticMFile(basename);
writeAuxVarRecursiveDefinitions(basename, julia);
writeSetAuxiliaryVariables(basename, julia);
}
void
......@@ -2099,8 +2099,9 @@ StaticModel::writeAuxVarInitval(ostream &output, ExprNodeOutputType output_type)
}
}
void StaticModel::writeAuxVarRecursiveDefinitions(const string &basename, const bool julia) const
void StaticModel::writeSetAuxiliaryVariables(const string &basename, const bool julia) const
{
string func_name = basename + "_set_auxiliary_variables";
string filename = julia ? func_name + ".jl" : func_name + ".m";
string comment = julia ? "#" : "%";
......@@ -2127,10 +2128,17 @@ void StaticModel::writeAuxVarRecursiveDefinitions(const string &basename, const
if (dynamic_cast<ExprNode *>(aux_equations[i])->containsExternalFunction())
dynamic_cast<ExprNode *>(aux_equations[i])->writeExternalFunctionOutput(output, oMatlabStaticModel,
temporary_terms, tef_terms);
writeAuxVarRecursiveDefinitions(output, oMatlabStaticModel);
}
void
StaticModel::writeAuxVarRecursiveDefinitions(ostream &output, ExprNodeOutputType output_type) const
{
deriv_node_temp_terms_t tef_terms;
temporary_terms_t temporary_terms;
for (int i = 0; i < (int) aux_equations.size(); i++)
{
dynamic_cast<ExprNode *>(aux_equations[i]->substituteStaticAuxiliaryDefinition())->writeOutput(output, oMatlabStaticModel, temporary_terms, tef_terms);
dynamic_cast<ExprNode *>(aux_equations[i]->substituteStaticAuxiliaryDefinition())->writeOutput(output, output_type, temporary_terms, tef_terms);
output << ";" << endl;
}
}
......
......@@ -183,7 +183,8 @@ public:
void writeAuxVarInitval(ostream &output, ExprNodeOutputType output_type) const;
//! Writes definition of the auxiliary variables in a .m or .jl file
void writeAuxVarRecursiveDefinitions(const string &basename, const bool julia) const;
void writeSetAuxiliaryVariables(const string &basename, const bool julia) const;
void writeAuxVarRecursiveDefinitions(ostream &output, ExprNodeOutputType output_type) const;
virtual int getDerivID(int symb_id, int lag) const throw (UnknownDerivIDException);
virtual void addAllParamDerivId(set<int> &deriv_id_set);
......
......@@ -161,7 +161,7 @@ SteadyStateModel::writeSteadyStateFile(const string &basename, bool ramsey_model
output << " % Auxiliary equations" << endl;
else
output << " # Auxiliary equations" << endl;
static_model.writeAuxVarInitval(output, output_type);
static_model.writeAuxVarRecursiveDefinitions(output, output_type);
if (!julia)
output << " check_=0;" << endl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment