GCS: report partially redundant constraints
This commit is contained in:
committed by
abdullahtahiriyo
parent
e46b821f7c
commit
567c80fb67
@@ -226,6 +226,7 @@ public:
|
||||
void LogQRSystemInformation(const System &system, int paramsNum = 0, int constrNum = 0, int rank = 0);
|
||||
|
||||
void LogGroupOfConstraints(const std::string & str, std::vector< std::vector<Constraint *> > constraintgroups);
|
||||
void LogSetOfConstraints(const std::string & str, std::set<Constraint *> constraintset);
|
||||
void LogGroupOfParameters(const std::string & str, std::vector< std::vector<double *> > parametergroups);
|
||||
|
||||
void LogMatrix(const std::string str, Eigen::MatrixXd matrix);
|
||||
@@ -368,6 +369,20 @@ void SolverReportingManager::LogGroupOfConstraints(const std::string & str, std:
|
||||
LogString(tempstream.str());
|
||||
}
|
||||
|
||||
void SolverReportingManager::LogSetOfConstraints(const std::string & str, std::set<Constraint *> constraintset)
|
||||
{
|
||||
std::stringstream tempstream;
|
||||
|
||||
tempstream << str << ": [";
|
||||
|
||||
for(auto c : constraintset)
|
||||
tempstream << c->getTag() << " ";
|
||||
|
||||
tempstream << "]" << '\n';
|
||||
|
||||
LogString(tempstream.str());
|
||||
}
|
||||
|
||||
void SolverReportingManager::LogGroupOfParameters(const std::string & str, std::vector< std::vector<double *> > parametergroups)
|
||||
{
|
||||
std::stringstream tempstream;
|
||||
@@ -558,6 +573,7 @@ void System::clear()
|
||||
redundant.clear();
|
||||
conflictingTags.clear();
|
||||
redundantTags.clear();
|
||||
partiallyRedundantTags.clear();
|
||||
|
||||
reference.clear();
|
||||
clearSubSystems();
|
||||
@@ -3884,6 +3900,7 @@ SolverReportingManager::Manager().LogToFile("GCS::System::diagnose()\n");
|
||||
redundant.clear();
|
||||
conflictingTags.clear();
|
||||
redundantTags.clear();
|
||||
partiallyRedundantTags.clear();
|
||||
|
||||
// This QR diagnosis uses a reduced Jacobian matrix to calculate the rank of the system and identify
|
||||
// conflicting and redundant constraints.
|
||||
@@ -4482,6 +4499,11 @@ void System::identifyConflictingRedundantConstraints( Algorithm alg,
|
||||
}
|
||||
}
|
||||
|
||||
// Augment information regarding the choice made by popularity contest
|
||||
if(debugMode==IterationLevel) {
|
||||
SolverReportingManager::Manager().LogSetOfConstraints("Chosen redundants", skipped);
|
||||
}
|
||||
|
||||
std::vector<Constraint *> clistTmp;
|
||||
clistTmp.reserve(clist.size());
|
||||
for (std::vector<Constraint *>::iterator constr=clist.begin();
|
||||
@@ -4560,20 +4582,28 @@ void System::identifyConflictingRedundantConstraints( Algorithm alg,
|
||||
conflictingTags.begin());
|
||||
|
||||
// output of redundant tags
|
||||
SET_I redundantTagsSet;
|
||||
for (std::set<Constraint *>::iterator constr=redundant.begin();
|
||||
constr != redundant.end(); ++constr)
|
||||
SET_I redundantTagsSet, partiallyRedundantTagsSet;
|
||||
for (std::set<Constraint *>::iterator constr=redundant.begin(); constr != redundant.end(); ++constr) {
|
||||
redundantTagsSet.insert((*constr)->getTag());
|
||||
partiallyRedundantTagsSet.insert((*constr)->getTag());
|
||||
}
|
||||
|
||||
// remove tags represented at least in one non-redundant constraint
|
||||
for (std::vector<Constraint *>::iterator constr=clist.begin();
|
||||
constr != clist.end(); ++constr) {
|
||||
for (std::vector<Constraint *>::iterator constr=clist.begin(); constr != clist.end(); ++constr)
|
||||
if (redundant.count(*constr) == 0)
|
||||
redundantTagsSet.erase((*constr)->getTag());
|
||||
}
|
||||
|
||||
redundantTags.resize(redundantTagsSet.size());
|
||||
std::copy(redundantTagsSet.begin(), redundantTagsSet.end(),
|
||||
redundantTags.begin());
|
||||
|
||||
for(auto r : redundantTagsSet)
|
||||
partiallyRedundantTagsSet.erase(r);
|
||||
|
||||
partiallyRedundantTags.resize(partiallyRedundantTagsSet.size());
|
||||
std::copy(partiallyRedundantTagsSet.begin(), partiallyRedundantTagsSet.end(),
|
||||
partiallyRedundantTags.begin());
|
||||
|
||||
nonredundantconstrNum = constrNum;
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace GCS
|
||||
|
||||
int dofs;
|
||||
std::set<Constraint *> redundant;
|
||||
VEC_I conflictingTags, redundantTags;
|
||||
VEC_I conflictingTags, redundantTags, partiallyRedundantTags;
|
||||
|
||||
bool hasUnknowns; // if plist is filled with the unknown parameters
|
||||
bool hasDiagnosis; // if dofs, conflictingTags, redundantTags are up to date
|
||||
@@ -361,6 +361,8 @@ namespace GCS
|
||||
{ conflictingOut = hasDiagnosis ? conflictingTags : VEC_I(0); }
|
||||
void getRedundant(VEC_I &redundantOut) const
|
||||
{ redundantOut = hasDiagnosis ? redundantTags : VEC_I(0); }
|
||||
void getPartiallyRedundant (VEC_I &partiallyredundantOut) const
|
||||
{ partiallyredundantOut = hasDiagnosis ? partiallyRedundantTags : VEC_I(0); }
|
||||
void getDependentParams(VEC_pD &pdependentparameterlist) const
|
||||
{ pdependentparameterlist = pDependentParameters;}
|
||||
void getDependentParamsGroups(std::vector<std::vector<double *>> &pdependentparametergroups) const
|
||||
|
||||
Reference in New Issue
Block a user