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:
@@ -369,7 +369,7 @@ ActiveSetSolver::Solve()
|
|||||||
system.B(rowIndex) = constraint->RightSide();
|
system.B(rowIndex) = constraint->RightSide();
|
||||||
for (int32 sIndex = 0; sIndex < leftSide->CountItems(); sIndex++ ) {
|
for (int32 sIndex = 0; sIndex < leftSide->CountItems(); sIndex++ ) {
|
||||||
Summand* summand = leftSide->ItemAt(sIndex);
|
Summand* summand = leftSide->ItemAt(sIndex);
|
||||||
int32 coefficient = summand->Coeff();
|
double coefficient = summand->Coeff();
|
||||||
system.A(rowIndex, summand->VariableIndex()) = coefficient;
|
system.A(rowIndex, summand->VariableIndex()) = coefficient;
|
||||||
}
|
}
|
||||||
if (constraint->Op() == kLE) {
|
if (constraint->Op() == kLE) {
|
||||||
|
|||||||
@@ -498,6 +498,7 @@ typedef BPrivate::AutoDeleter<double*, MatrixDelete> MatrixDeleter;
|
|||||||
LayoutOptimizer::LayoutOptimizer(const ConstraintList& list,
|
LayoutOptimizer::LayoutOptimizer(const ConstraintList& list,
|
||||||
int32 variableCount)
|
int32 variableCount)
|
||||||
:
|
:
|
||||||
|
fVariableCount(0),
|
||||||
fTemp1(NULL),
|
fTemp1(NULL),
|
||||||
fTemp2(NULL),
|
fTemp2(NULL),
|
||||||
fZtrans(NULL),
|
fZtrans(NULL),
|
||||||
@@ -693,7 +694,7 @@ TRACE_ONLY(
|
|||||||
ConstraintList activeConstraints(constraintCount);
|
ConstraintList activeConstraints(constraintCount);
|
||||||
|
|
||||||
for (int32 i = 0; i < constraintCount; i++) {
|
for (int32 i = 0; i < constraintCount; i++) {
|
||||||
Constraint* constraint = (Constraint*)fConstraints.ItemAt(i);
|
Constraint* constraint = fConstraints.ItemAt(i);
|
||||||
if (constraint->IsSoft())
|
if (constraint->IsSoft())
|
||||||
continue;
|
continue;
|
||||||
double actualValue = _ActualValue(constraint, x);
|
double actualValue = _ActualValue(constraint, x);
|
||||||
@@ -739,6 +740,8 @@ TRACE_ONLY(
|
|||||||
|
|
||||||
for (int32 i = 0; i < activeCount; i++) {
|
for (int32 i = 0; i < activeCount; i++) {
|
||||||
Constraint* constraint = activeConstraints.ItemAt(i);
|
Constraint* constraint = activeConstraints.ItemAt(i);
|
||||||
|
if (constraint->IsSoft())
|
||||||
|
continue;
|
||||||
SummandList* summands = constraint->LeftSide();
|
SummandList* summands = constraint->LeftSide();
|
||||||
for (int32 s = 0; s < summands->CountItems(); s++) {
|
for (int32 s = 0; s < summands->CountItems(); s++) {
|
||||||
Summand* summand = summands->ItemAt(s);
|
Summand* summand = summands->ItemAt(s);
|
||||||
@@ -811,8 +814,7 @@ TRACE_ONLY(
|
|||||||
index = 0;
|
index = 0;
|
||||||
for (int i = 0; i < activeCount; i++) {
|
for (int i = 0; i < activeCount; i++) {
|
||||||
if (independentRows[i]) {
|
if (independentRows[i]) {
|
||||||
Constraint* constraint
|
Constraint* constraint = activeConstraints.ItemAt(i);
|
||||||
= (Constraint*)activeConstraints.ItemAt(i);
|
|
||||||
if (constraint->Op() != LinearProgramming::kEQ) {
|
if (constraint->Op() != LinearProgramming::kEQ) {
|
||||||
if (lambda[index] < minLambda) {
|
if (lambda[index] < minLambda) {
|
||||||
minLambda = lambda[index];
|
minLambda = lambda[index];
|
||||||
@@ -838,7 +840,7 @@ TRACE_ONLY(
|
|||||||
int barrier = -1;
|
int barrier = -1;
|
||||||
// if alpha_k < 1, add a barrier constraint to W^k
|
// if alpha_k < 1, add a barrier constraint to W^k
|
||||||
for (int32 i = 0; i < constraintCount; i++) {
|
for (int32 i = 0; i < constraintCount; i++) {
|
||||||
Constraint* constraint = (Constraint*)fConstraints.ItemAt(i);
|
Constraint* constraint = fConstraints.ItemAt(i);
|
||||||
if (activeConstraints.HasItem(constraint))
|
if (activeConstraints.HasItem(constraint))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user