2 * Copyright 2007, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
3 * All rights reserved. Distributed under the terms of the MIT License.
5 #ifndef LAYOUT_OPTIMIZER_H
6 #define LAYOUT_OPTIMIZER_H
11 static const double kEqualsEpsilon
= 0.000001;
17 class LayoutOptimizer
{
19 LayoutOptimizer(int32 variableCount
);
22 status_t
InitCheck() const;
24 LayoutOptimizer
* Clone() const;
26 bool AddConstraint(int32 left
, int32 right
,
27 double value
, bool equality
);
28 bool AddConstraintsFrom(
29 const LayoutOptimizer
* solver
);
30 void RemoveAllConstraints();
32 bool Solve(const double* desired
, double size
,
36 bool _Solve(const double* desired
, double* values
);
37 bool _SolveSubProblem(const double* d
, int am
,
39 void _SetResult(const double* x
, double* values
);
51 double** fActiveMatrix
;
52 double** fActiveMatrixTemp
;
56 } // namespace BPrivate
58 using BPrivate::Layout::LayoutOptimizer
;
62 fuzzy_equals(double a
, double b
)
64 return fabs(a
- b
) < kEqualsEpsilon
;
68 #endif // LAYOUT_OPTIMIZER_H