GCS: Improvement in redundant constraint detection
================================================== The solver uses some heuristics to determine the "redundant to remove" and notify it to the user. Basically it would pick the solver redundant constraint that affects most groups of redundants (popularity contest). In the simple cases, all the redundants are equally popular and the popularity contest is untied by using the tagid (let say for simplicity it is the number at sketcher level Constraint3, the tagid=3). This means that in simple cases, the solver systematically decides that the redundant constraint to handle from those showing a linear dependency is the one appearing the last. This commits changes the way to untie the popularity contest, by giving more priority to those sketcher constraints that need a lower number of solver constraints (in other words, those constraints that remove a lower amount of DoF). In case of tie, the tagid is then used to break the tie. At least: fixes #3434 fixes #1557
This commit is contained in:
@@ -3685,7 +3685,10 @@ int System::diagnose(Algorithm alg)
|
||||
if (result1 == std::end(pdrivenlist))
|
||||
pdiagnoselist.push_back(plist[j]);
|
||||
}
|
||||
|
||||
|
||||
// map tag to a tag multiplicity (the number of solver constraints associated with the same tag)
|
||||
std::map< int , int> tagmultiplicity;
|
||||
|
||||
Eigen::MatrixXd J(clist.size(), pdiagnoselist.size());
|
||||
int count=0;
|
||||
for (std::vector<Constraint *>::iterator constr=clist.begin(); constr != clist.end(); ++constr) {
|
||||
@@ -3695,6 +3698,12 @@ int System::diagnose(Algorithm alg)
|
||||
for (int j=0; j < int(pdiagnoselist.size()); j++) {
|
||||
J(count-1,j) = (*constr)->grad(pdiagnoselist[j]);
|
||||
}
|
||||
|
||||
// parallel processing: create tag multiplicity map
|
||||
if(tagmultiplicity.find((*constr)->getTag()) == tagmultiplicity.end())
|
||||
tagmultiplicity[(*constr)->getTag()] = 0;
|
||||
else
|
||||
tagmultiplicity[(*constr)->getTag()]++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4021,7 +4030,13 @@ int System::diagnose(Algorithm alg)
|
||||
it != conflictingMap.end(); ++it) {
|
||||
if (static_cast<int>(it->second.size()) > maxPopularity ||
|
||||
(static_cast<int>(it->second.size()) == maxPopularity && mostPopular &&
|
||||
it->first->getTag() > mostPopular->getTag())) {
|
||||
tagmultiplicity[it->first->getTag()] < tagmultiplicity[mostPopular->getTag()]) ||
|
||||
|
||||
(static_cast<int>(it->second.size()) == maxPopularity && mostPopular &&
|
||||
tagmultiplicity[it->first->getTag()] == tagmultiplicity[mostPopular->getTag()] &&
|
||||
it->first->getTag() > mostPopular->getTag())
|
||||
|
||||
) {
|
||||
mostPopular = it->first;
|
||||
maxPopularity = it->second.size();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user