Move lp_solve dependency completely into LinearSpec. Clean up and some more memory allocation checks.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39681 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -33,7 +33,7 @@ public:
|
||||
|
||||
SummandList* LeftSide();
|
||||
void SetLeftSide(SummandList* summands);
|
||||
void UpdateLeftSide();
|
||||
|
||||
void SetLeftSide(double coeff1, Variable* var1);
|
||||
void SetLeftSide(double coeff1, Variable* var1,
|
||||
double coeff2, Variable* var2);
|
||||
@@ -73,14 +73,18 @@ public:
|
||||
protected:
|
||||
Constraint(LinearSpec* ls,
|
||||
SummandList* summands, OperatorType op,
|
||||
double rightSide, double penaltyNeg,
|
||||
double penaltyPos);
|
||||
double rightSide,
|
||||
double penaltyNeg = INFINITY,
|
||||
double penaltyPos = INFINITY);
|
||||
|
||||
private:
|
||||
LinearSpec* fLS;
|
||||
SummandList* fLeftSide;
|
||||
OperatorType fOp;
|
||||
double fRightSide;
|
||||
|
||||
double fPenaltyNeg;
|
||||
double fPenaltyPos;
|
||||
Summand* fDNegObjSummand;
|
||||
Summand* fDPosObjSummand;
|
||||
BString fLabel;
|
||||
|
||||
@@ -43,6 +43,10 @@ public:
|
||||
bool SetRange(Variable* variable, double min,
|
||||
double max);
|
||||
|
||||
bool AddConstraint(Constraint* constraint);
|
||||
bool RemoveConstraint(Constraint* constraint,
|
||||
bool deleteConstraint = true);
|
||||
|
||||
Constraint* AddConstraint(SummandList* summands,
|
||||
OperatorType op, double rightSide);
|
||||
Constraint* AddConstraint(double coeff1, Variable* var1,
|
||||
@@ -108,9 +112,21 @@ public:
|
||||
|
||||
const ConstraintList& Constraints() const;
|
||||
|
||||
protected:
|
||||
friend class Constraint;
|
||||
bool UpdateLeftSide(Constraint* constraint);
|
||||
bool UpdateRightSide(Constraint* constraint);
|
||||
bool UpdateOperator(Constraint* constraint);
|
||||
private:
|
||||
ResultType Presolve();
|
||||
void RemovePresolved();
|
||||
/*! Check if all entries != NULL otherwise delete the list and its
|
||||
entries. */
|
||||
bool _CheckSummandList(SummandList* list);
|
||||
Constraint* _AddConstraint(SummandList* leftSide,
|
||||
OperatorType op, double rightSide,
|
||||
double penaltyNeg, double penaltyPos);
|
||||
|
||||
ResultType _Presolve();
|
||||
void _RemovePresolved();
|
||||
|
||||
lprec* fLpPresolved;
|
||||
OptimizationType fOptimization;
|
||||
@@ -122,9 +138,6 @@ private:
|
||||
double fObjectiveValue;
|
||||
double fSolvingTime;
|
||||
|
||||
public:
|
||||
friend class Constraint;
|
||||
|
||||
};
|
||||
|
||||
} // namespace LinearProgramming
|
||||
|
||||
Reference in New Issue
Block a user