* Simplified and optimized a lot the "ToString()" debugging facilities.

* *::Index() is now const, thanks to the BList improvements.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34521 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2009-12-06 13:14:45 +00:00
parent b0850e9ba1
commit b8ec67f491
9 changed files with 404 additions and 423 deletions
+9 -9
View File
@@ -19,28 +19,28 @@
namespace LinearProgramming {
class LinearSpec;
/**
* Hard linear constraint, i.e. one that must be satisfied.
* Hard linear constraint, i.e. one that must be satisfied.
* May render a specification infeasible.
*/
class Constraint {
public:
int32 Index();
int32 Index() const;
BList* LeftSide();
void SetLeftSide(BList* summands);
void UpdateLeftSide();
void SetLeftSide(double coeff1, Variable* var1);
void SetLeftSide(double coeff1, Variable* var1,
void SetLeftSide(double coeff1, Variable* var1,
double coeff2, Variable* var2);
void SetLeftSide(double coeff1, Variable* var1,
void SetLeftSide(double coeff1, Variable* var1,
double coeff2, Variable* var2,
double coeff3, Variable* var3);
void SetLeftSide(double coeff1, Variable* var1,
void SetLeftSide(double coeff1, Variable* var1,
double coeff2, Variable* var2,
double coeff3, Variable* var3,
double coeff4, Variable* var4);
@@ -68,8 +68,8 @@ public:
bool IsValid();
void Invalidate();
BString* ToBString();
const char* ToString();
operator BString() const;
void GetString(BString& string) const;
~Constraint();
+29 -29
View File
@@ -25,7 +25,7 @@
namespace LinearProgramming {
class Constraint;
class ObjFunctionSummand;
class PenaltyFunction;
@@ -35,52 +35,52 @@ class Variable;
* Specification of a linear programming problem.
*/
class LinearSpec {
public:
LinearSpec();
virtual ~LinearSpec();
Variable* AddVariable();
Constraint* AddConstraint(BList* summands,
OperatorType op, double rightSide);
Constraint* AddConstraint(double coeff1, Variable* var1,
OperatorType op, double rightSide);
Constraint* AddConstraint(double coeff1, Variable* var1,
double coeff2, Variable* var2,
Constraint* AddConstraint(BList* summands,
OperatorType op, double rightSide);
Constraint* AddConstraint(double coeff1, Variable* var1,
double coeff2, Variable* var2,
double coeff3, Variable* var3,
OperatorType op, double rightSide);
Constraint* AddConstraint(double coeff1, Variable* var1,
double coeff2, Variable* var2,
double coeff3, Variable* var3,
double coeff4, Variable* var4,
double coeff2, Variable* var2,
OperatorType op, double rightSide);
Constraint* AddConstraint(double coeff1, Variable* var1,
double coeff2, Variable* var2,
double coeff3, Variable* var3,
OperatorType op, double rightSide);
Constraint* AddConstraint(double coeff1, Variable* var1,
double coeff2, Variable* var2,
double coeff3, Variable* var3,
double coeff4, Variable* var4,
OperatorType op, double rightSide);
Constraint* AddConstraint(BList* summands,
OperatorType op, double rightSide,
Constraint* AddConstraint(BList* summands,
OperatorType op, double rightSide,
double penaltyNeg, double penaltyPos);
Constraint* AddConstraint(double coeff1, Variable* var1,
OperatorType op, double rightSide,
OperatorType op, double rightSide,
double penaltyNeg, double penaltyPos);
Constraint* AddConstraint(double coeff1, Variable* var1,
double coeff2, Variable* var2,
OperatorType op, double rightSide,
double coeff2, Variable* var2,
OperatorType op, double rightSide,
double penaltyNeg, double penaltyPos);
Constraint* AddConstraint(double coeff1, Variable* var1,
double coeff2, Variable* var2,
double coeff3, Variable* var3,
OperatorType op, double rightSide,
double coeff2, Variable* var2,
double coeff3, Variable* var3,
OperatorType op, double rightSide,
double penaltyNeg, double penaltyPos);
Constraint* AddConstraint(double coeff1, Variable* var1,
double coeff2, Variable* var2,
double coeff3, Variable* var3,
double coeff4, Variable* var4,
OperatorType op, double rightSide,
double coeff2, Variable* var2,
double coeff3, Variable* var3,
double coeff4, Variable* var4,
OperatorType op, double rightSide,
double penaltyNeg, double penaltyPos);
PenaltyFunction* AddPenaltyFunction(Variable* var, BList* xs, BList* gs);
BList* ObjFunction();
@@ -90,7 +90,7 @@ public:
ResultType Presolve();
void RemovePresolved();
ResultType Solve();
void Save(char* fname);
void Save(const char* fileName);
int32 CountColumns() const;
OptimizationType Optimization() const;
@@ -101,8 +101,8 @@ public:
double ObjectiveValue() const;
double SolvingTime() const;
BString* ToBString();
const char* ToString();
operator BString() const;
void GetString(BString& string) const;
protected:
int32 fCountColumns;
+4 -4
View File
@@ -24,7 +24,7 @@ class Summand;
class Variable {
public:
int32 Index();
int32 Index() const;
LinearSpec* LS() const;
double Value() const;
void SetValue(double value);
@@ -36,9 +36,9 @@ public:
const char* Label();
void SetLabel(const char* label);
BString* ToBString();
const char* ToString();
operator BString() const;
void GetString(BString& string) const;
Constraint* IsEqual(Variable* var);
Constraint* IsSmallerOrEqual(Variable* var);