var_estimation: back end
parent
d0131f3652
commit
279d7931df
|
@ -277,20 +277,16 @@ VarRestrictionsStatement::VarRestrictionsStatement(const string &var_model_name_
|
|||
void
|
||||
VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
|
||||
{
|
||||
output << "nvarrest = 1;" << endl
|
||||
<< "if isfield(M_.var, 'restrictions')" << endl
|
||||
<< " nvarrest = length(M_.var.restrictions);" << endl
|
||||
<< "end" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.name = '" << var_model_name << "';" << endl;
|
||||
string Mstr ("M_.var." + var_model_name + ".restrictions.");
|
||||
|
||||
// Exclusion Restrictions
|
||||
int idx = 1;
|
||||
for (map<int, map<int, SymbolList> >::const_iterator it = exclusion_restrictions.begin();
|
||||
it != exclusion_restrictions.end(); it++, idx++)
|
||||
{
|
||||
output << "M_.var.restrictions{nvarrest}.exclusion_restrictions{" << idx<< "}.lag = "
|
||||
output << Mstr << "exclusion_restrictions{" << idx<< "}.lag = "
|
||||
<< it->first << ";" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.exclusion_restrictions{" << it->first << "}.restrictions = [";
|
||||
<< Mstr << "exclusion_restrictions{" << idx << "}.restrictions = [";
|
||||
for (map<int, SymbolList>::const_iterator it1 = it->second.begin();
|
||||
it1 != it->second.end(); it1++)
|
||||
{
|
||||
|
@ -308,28 +304,28 @@ VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, b
|
|||
for (equation_restrictions_t::const_iterator it = equation_restrictions.begin();
|
||||
it != equation_restrictions.end(); it++, idx++)
|
||||
{
|
||||
output << "M_.var.restrictions{nvarrest}.equation_restriction{" << idx << "}.eqsymb_id = "
|
||||
output << Mstr << "equation_restriction{" << idx << "}.eqsymb_id = "
|
||||
<< it->first + 1 << ";" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.equation_restriction{" << idx << "}.val = "
|
||||
<< Mstr << "equation_restriction{" << idx << "}.val = "
|
||||
<< it->second.second << ";" << endl;
|
||||
|
||||
var_restriction_eq_crosseq_t ls = it->second.first.first;
|
||||
output << "M_.var.restrictions{nvarrest}.equation_restriction{" << idx << "}.lssymb_id = "
|
||||
output << Mstr << "equation_restriction{" << idx << "}.lssymb_id = "
|
||||
<< ls.first.first + 1 << ";" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.equation_restriction{" << idx << "}.lslag = "
|
||||
<< Mstr << "equation_restriction{" << idx << "}.lslag = "
|
||||
<< ls.first.second.second << ";" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.equation_restriction{" << idx << "}.lscoeff = ";
|
||||
<< Mstr << "equation_restriction{" << idx << "}.lscoeff = ";
|
||||
ls.second->writeOutput(output);
|
||||
output << ";" << endl;
|
||||
|
||||
var_restriction_eq_crosseq_t rs = it->second.first.second;
|
||||
if (rs.first.first >= 0)
|
||||
{
|
||||
output << "M_.var.restrictions{nvarrest}.equation_restriction{" << idx << "}.rssymb_id = "
|
||||
output << Mstr << "equation_restriction{" << idx << "}.rssymb_id = "
|
||||
<< rs.first.first + 1 << ";" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.equation_restriction{" << idx << "}.rslag = "
|
||||
<< Mstr << "equation_restriction{" << idx << "}.rslag = "
|
||||
<< rs.first.second.second << ";" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.equation_restriction{" << idx << "}.rscoeff = ";
|
||||
<< Mstr << "equation_restriction{" << idx << "}.rscoeff = ";
|
||||
rs.second->writeOutput(output);
|
||||
output << ";" << endl;
|
||||
}
|
||||
|
@ -340,34 +336,34 @@ VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, b
|
|||
for (crossequation_restrictions_t::const_iterator it = crossequation_restrictions.begin();
|
||||
it != crossequation_restrictions.end(); it++, idx++)
|
||||
{
|
||||
output << "M_.var.restrictions{nvarrest}.crossequation_restriction{" << idx << "}.eqsymb_id1 = "
|
||||
output << Mstr << "crossequation_restriction{" << idx << "}.eqsymb_id1 = "
|
||||
<< it->first.first + 1 << ";" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.crossequation_restriction{" << idx << "}.eqsymb_id2 = "
|
||||
<< Mstr << "crossequation_restriction{" << idx << "}.eqsymb_id2 = "
|
||||
<< it->first.second + 1 << ";" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.crossequation_restriction{" << idx << "}.val = "
|
||||
<< Mstr << "crossequation_restriction{" << idx << "}.val = "
|
||||
<< it->second.second << ";" << endl;
|
||||
|
||||
var_restriction_eq_crosseq_t ls = it->second.first.first;
|
||||
output << "M_.var.restrictions{nvarrest}.crossequation_restriction{" << idx << "}.lssymb_id1 = "
|
||||
output << Mstr << "crossequation_restriction{" << idx << "}.lssymb_id1 = "
|
||||
<< ls.first.first + 1 << ";" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.crossequation_restriction{" << idx << "}.lssymb_id2 = "
|
||||
<< Mstr << "crossequation_restriction{" << idx << "}.lssymb_id2 = "
|
||||
<< ls.first.second.first + 1 << ";" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.crossequation_restriction{" << idx << "}.lslag = "
|
||||
<< Mstr << "crossequation_restriction{" << idx << "}.lslag = "
|
||||
<< ls.first.second.second << ";" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.crossequation_restriction{" << idx << "}.lscoeff = ";
|
||||
<< Mstr << "crossequation_restriction{" << idx << "}.lscoeff = ";
|
||||
ls.second->writeOutput(output);
|
||||
output << ";" << endl;
|
||||
|
||||
var_restriction_eq_crosseq_t rs = it->second.first.second;
|
||||
if (rs.first.first >= 0)
|
||||
{
|
||||
output << "M_.var.restrictions{nvarrest}.crossequation_restriction{" << idx << "}.rssymb_id1 = "
|
||||
output << Mstr << "crossequation_restriction{" << idx << "}.rssymb_id1 = "
|
||||
<< rs.first.first + 1 << ";" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.crossequation_restriction{" << idx << "}.rssymb_id2 = "
|
||||
<< Mstr << "crossequation_restriction{" << idx << "}.rssymb_id2 = "
|
||||
<< rs.first.second.first + 1 << ";" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.crossequation_restriction{" << idx << "}.rslag = "
|
||||
<< Mstr << "crossequation_restriction{" << idx << "}.rslag = "
|
||||
<< rs.first.second.second << ";" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.crossequation_restriction{" << idx << "}.rscoeff = ";
|
||||
<< Mstr << "crossequation_restriction{" << idx << "}.rscoeff = ";
|
||||
rs.second->writeOutput(output);
|
||||
output << ";" << endl;
|
||||
}
|
||||
|
@ -377,24 +373,24 @@ VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, b
|
|||
idx = 1;
|
||||
for (map<pair<int, int>, double>::const_iterator it = covariance_number_restriction.begin();
|
||||
it != covariance_number_restriction.end(); it++, idx++)
|
||||
output << "M_.var.restrictions{nvarrest}.covariance_const_restriction{" << idx << "}.symb_id1 = "
|
||||
output << Mstr << "covariance_const_restriction{" << idx << "}.symb_id1 = "
|
||||
<< it->first.first << ";" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.covariance_const_restriction{" << idx << "}.symb_id2 = "
|
||||
<< Mstr << "covariance_const_restriction{" << idx << "}.symb_id2 = "
|
||||
<< it->first.second << ";" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.covariance_const_restriction{" << idx << "}.val = "
|
||||
<< Mstr << "covariance_const_restriction{" << idx << "}.val = "
|
||||
<< it->second << ";" << endl;
|
||||
|
||||
// Covariance Pair Restrictions
|
||||
idx = 1;
|
||||
for (map<pair<int, int>, pair<int, int> >::const_iterator it = covariance_pair_restriction.begin();
|
||||
it != covariance_pair_restriction.end(); it++, idx++)
|
||||
output << "M_.var.restrictions{nvarrest}.covariance_pair_restriction{" << idx << "}.symb_id11 = "
|
||||
output << Mstr << "covariance_pair_restriction{" << idx << "}.symb_id11 = "
|
||||
<< it->first.first << ";" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.covariance_pair_restriction{" << idx << "}.symb_id12 = "
|
||||
<< Mstr << "covariance_pair_restriction{" << idx << "}.symb_id12 = "
|
||||
<< it->first.second << ";" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.covariance_pair_restriction{" << idx << "}.symb_id21 = "
|
||||
<< Mstr << "covariance_pair_restriction{" << idx << "}.symb_id21 = "
|
||||
<< it->second.first << ";" << endl
|
||||
<< "M_.var.restrictions{nvarrest}.covariance_pair_restriction{" << idx << "}.symb_id22 = "
|
||||
<< Mstr << "covariance_pair_restriction{" << idx << "}.symb_id22 = "
|
||||
<< it->second.second << ";" << endl;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue