Don't add soft constraints to the active constraints. Fix some smaller stuff.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40339 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler 2011-02-01 03:25:48 +00:00
parent b2d0aaa9e6
commit d339d2ae8f
2 changed files with 7 additions and 5 deletions

View File

@ -369,7 +369,7 @@ ActiveSetSolver::Solve()
system.B(rowIndex) = constraint->RightSide();
for (int32 sIndex = 0; sIndex < leftSide->CountItems(); sIndex++ ) {
Summand* summand = leftSide->ItemAt(sIndex);
int32 coefficient = summand->Coeff();
double coefficient = summand->Coeff();
system.A(rowIndex, summand->VariableIndex()) = coefficient;
}
if (constraint->Op() == kLE) {

View File

@ -498,6 +498,7 @@ typedef BPrivate::AutoDeleter<double*, MatrixDelete> MatrixDeleter;
LayoutOptimizer::LayoutOptimizer(const ConstraintList& list,
int32 variableCount)
:
fVariableCount(0),
fTemp1(NULL),
fTemp2(NULL),
fZtrans(NULL),
@ -693,7 +694,7 @@ TRACE_ONLY(
ConstraintList activeConstraints(constraintCount);
for (int32 i = 0; i < constraintCount; i++) {
Constraint* constraint = (Constraint*)fConstraints.ItemAt(i);
Constraint* constraint = fConstraints.ItemAt(i);
if (constraint->IsSoft())
continue;
double actualValue = _ActualValue(constraint, x);
@ -739,6 +740,8 @@ TRACE_ONLY(
for (int32 i = 0; i < activeCount; i++) {
Constraint* constraint = activeConstraints.ItemAt(i);
if (constraint->IsSoft())
continue;
SummandList* summands = constraint->LeftSide();
for (int32 s = 0; s < summands->CountItems(); s++) {
Summand* summand = summands->ItemAt(s);
@ -811,8 +814,7 @@ TRACE_ONLY(
index = 0;
for (int i = 0; i < activeCount; i++) {
if (independentRows[i]) {
Constraint* constraint
= (Constraint*)activeConstraints.ItemAt(i);
Constraint* constraint = activeConstraints.ItemAt(i);
if (constraint->Op() != LinearProgramming::kEQ) {
if (lambda[index] < minLambda) {
minLambda = lambda[index];
@ -838,7 +840,7 @@ TRACE_ONLY(
int barrier = -1;
// if alpha_k < 1, add a barrier constraint to W^k
for (int32 i = 0; i < constraintCount; i++) {
Constraint* constraint = (Constraint*)fConstraints.ItemAt(i);
Constraint* constraint = fConstraints.ItemAt(i);
if (activeConstraints.HasItem(constraint))
continue;