Add an alternative solver to lp_solve. The solver based on Ingo's active set solver but is able to handle arbitrary hard and soft constraints. The advantage to lp_solve is that the active set solver can optimize variable in respect to a quadratic objective function. This makes it possible to minimise the quadratic derivation to a desired value e.g. \Sum_i(x_i - x_{i,pref})^2 -> min.
The solver part has been refactored in this way that both solver can be used with the same layout specifications. The active set solver is default now; the performance is not as good as lp_solve, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40285 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -124,8 +124,6 @@ private:
|
||||
/*! Add a view without initialize the Area. */
|
||||
BLayoutItem* _CreateLayoutItem(BView* view);
|
||||
|
||||
void _SolveLayout();
|
||||
|
||||
void _UpdateAreaConstraints();
|
||||
|
||||
BSize _CalculateMinSize();
|
||||
@@ -152,8 +150,10 @@ private:
|
||||
|
||||
Area* fCurrentArea;
|
||||
|
||||
#if USE_SCALE_VARIABLE
|
||||
Variable* fScaleWidth;
|
||||
Variable* fScaleHeight;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace BALM
|
||||
|
||||
+11
-1
@@ -20,6 +20,9 @@
|
||||
#include "Tab.h"
|
||||
|
||||
|
||||
#define USE_SCALE_VARIABLE 1
|
||||
|
||||
|
||||
class Constraint;
|
||||
|
||||
|
||||
@@ -106,6 +109,7 @@ public:
|
||||
private:
|
||||
Area(BLayoutItem* item);
|
||||
|
||||
#if USE_SCALE_VARIABLE
|
||||
void _Init(LinearSpec* ls, XTab* left, YTab* top,
|
||||
XTab* right, YTab* bottom,
|
||||
Variable* scaleWidth,
|
||||
@@ -113,6 +117,11 @@ private:
|
||||
void _Init(LinearSpec* ls, Row* row, Column* column,
|
||||
Variable* scaleWidth,
|
||||
Variable* scaleHeight);
|
||||
#else
|
||||
void _Init(LinearSpec* ls, XTab* left, YTab* top,
|
||||
XTab* right, YTab* bottom);
|
||||
void _Init(LinearSpec* ls, Row* row, Column* column);
|
||||
#endif
|
||||
|
||||
void _DoLayout();
|
||||
|
||||
@@ -152,9 +161,10 @@ private:
|
||||
double fContentAspectRatio;
|
||||
Constraint* fContentAspectRatioC;
|
||||
|
||||
#if USE_SCALE_VARIABLE
|
||||
Variable* fScaleWidth;
|
||||
Variable* fScaleHeight;
|
||||
|
||||
#endif
|
||||
public:
|
||||
friend class BALMLayout;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user