Search for the correct constraint when removing an inequality constraint. This finally deletes the slack variable and the helper constraint.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42422 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler 2011-07-14 07:13:35 +00:00
parent f7d98b0923
commit 1245d875a3
2 changed files with 3 additions and 1 deletions

View File

@ -45,6 +45,7 @@ QPSolverInterface::ConstraintAdded(Constraint* constraint)
data.minSlackConstraint = fLinearSpec->AddConstraint(1.,
data.slack->Var(), kEQ, 0., constraint->PenaltyNeg(),
constraint->PenaltyPos());
data.constraint = constraint;
fInEqSlackConstraints.push_back(data);
SummandList* leftSide = constraint->LeftSide();
@ -63,7 +64,7 @@ QPSolverInterface::ConstraintRemoved(Constraint* constraint)
for (unsigned int i = 0; i < fInEqSlackConstraints.size(); i++) {
SoftInEqData& data = fInEqSlackConstraints[i];
if (data.minSlackConstraint != constraint)
if (data.constraint != constraint)
continue;
SummandList* leftSide = constraint->LeftSide();

View File

@ -27,6 +27,7 @@ public:
private:
struct SoftInEqData {
Summand* slack;
Constraint* constraint;
Constraint* minSlackConstraint;
};