18#include <QtWidgets/private/qtwidgetsglobal_p.h>
19#include <QtCore/qhash.h>
20#include <QtCore/qpair.h>
21#include <QtCore/qstring.h>
27struct QSimplexVariable
29 QSimplexVariable() : result(0), index(0) {}
37
38
39
40
41
42
43
44
45
46
67 qreal leftHandSide(0);
69 QHash<QSimplexVariable *, qreal>::const_iterator iter;
70 for (iter = variables.constBegin(); iter != variables.constEnd(); ++iter) {
71 leftHandSide += iter.value() * iter.key()->result;
74 Q_ASSERT(constant > 0 || qFuzzyCompare(1, 1 + constant));
76 if ((leftHandSide == constant) || qAbs(leftHandSide - constant) < 0.0000001)
81 return leftHandSide < constant;
83 return leftHandSide > constant;
125 bool setConstraints(
const QList<QSimplexConstraint *> &constraints);
132 inline qreal valueAt(
int row,
int column);
133 inline void setValueAt(
int row,
int column, qreal value);
134 void clearRow(
int rowIndex);
135 void clearColumns(
int first,
int last);
136 void combineRows(
int toIndex,
int fromIndex, qreal factor);
139 bool simplifyConstraints(QList<QSimplexConstraint *> *constraints);
140 int findPivotColumn();
141 int pivotRowForColumn(
int column);
142 void reducedRowEchelon();
146 void clearDataStructures();
147 void solveMaxHelper();
148 enum SolverFactor { Minimum = -1, Maximum = 1 };
149 qreal solver(SolverFactor factor);
150 void collectResults();
152 QList<QSimplexConstraint *> constraints;
153 QList<QSimplexVariable *> variables;
163inline qreal
QSimplex::valueAt(
int rowIndex,
int columnIndex)
165 return matrix[rowIndex * columns + columnIndex];
168inline void QSimplex::setValueAt(
int rowIndex,
int columnIndex, qreal value)
170 matrix[rowIndex * columns + columnIndex] = value;
The QGraphicsAnchorLayout class provides a layout where one can anchor widgets together in Graphics V...
void setSizePolicy(QSizePolicy::Policy policy)
~QGraphicsAnchorPrivate()
QSizePolicy::Policy sizePolicy
static QGraphicsAnchorPrivate * get(QGraphicsAnchor *q)
QGraphicsAnchorLayoutPrivate * layoutPrivate
void setSpacing(qreal value)
The QGraphicsAnchor class represents an anchor between two items in a QGraphicsAnchorLayout.
The QGraphicsLayout class provides the base class for all layouts in Graphics View.
void setDefaultSpacing(Qt::Orientation o, qreal spacing)
bool operator==(const QLayoutStyleInfo &other) const
bool operator!=(const QLayoutStyleInfo &other) const
qreal perItemSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation) const
qreal defaultSpacing(Qt::Orientation o) const
QLayoutStyleInfo(QStyle *style, QWidget *widget)
bool setConstraints(const QList< QSimplexConstraint * > &constraints)
void setObjective(QSimplexConstraint *objective)
QSet< AnchorData * > negatives
QSet< AnchorData * > positives
QSimplexConstraint * constraint(const GraphPath &path) const
Combined button and popup list for selecting options.
QT_REQUIRE_CONFIG(animation)
Q_DECLARE_TYPEINFO(GraphPath, Q_RELOCATABLE_TYPE)
QT_REQUIRE_CONFIG(graphicsview)
Q_DECLARE_INTERFACE(QNetworkAccessBackendFactory, QNetworkAccessBackendFactory_iid)
QHash< QSimplexVariable *, qreal > variables
QPair< QSimplexVariable *, qreal > helper
QSimplexVariable * artificial
virtual void updateChildrenSizes()
void refreshSizeHints(const QLayoutStyleInfo *styleInfo=nullptr)
QGraphicsLayoutItem * item
QGraphicsAnchor * graphicsAnchor
AnchorVertexPair(AnchorVertex *v1, AnchorVertex *v2, AnchorData *data)
AnchorData * m_removedAnchor
QList< AnchorData * > m_secondAnchors
QList< AnchorData * > m_firstAnchors
AnchorVertex(QGraphicsLayoutItem *item, Qt::AnchorPoint edge)
virtual ~AnchorVertex()=default
QGraphicsLayoutItem * m_item
virtual void updateChildrenSizes() override
ParallelAnchorData(AnchorData *first, AnchorData *second)
QList< QSimplexConstraint * > m_secondConstraints
bool calculateSizeHints()
QList< QSimplexConstraint * > m_firstConstraints
bool secondForward() const
virtual void updateChildrenSizes() override
const QList< AnchorData * > m_edges
SequentialAnchorData(const QList< AnchorVertex * > &vertices, const QList< AnchorData * > &edges)
void calculateSizeHints()