- Remove lp_solve dependencies form Variable class and put everything into LinearSpec. As a side effect Variable management is a bit more consistence now. We want to replace lp_solve soon so it will be easier to replace it just in LinearSpec.

- Update copyrights.
- Lot of small things related to the Variable refactoring.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38892 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler
2010-10-05 20:15:55 +00:00
parent 64141b1b74
commit fc691d7de2
12 changed files with 168 additions and 120 deletions
+10 -8
View File
@@ -36,6 +36,12 @@ public:
virtual ~LinearSpec();
Variable* AddVariable();
bool AddVariable(Variable* variable);
bool RemoveVariable(Variable* variable,
bool deleteVariable = true);
int32 IndexOf(const Variable* variable) const;
bool SetRange(Variable* variable, double min,
double max);
Constraint* AddConstraint(SummandList* summands,
OperatorType op, double rightSide);
@@ -86,8 +92,6 @@ public:
void SetObjectiveFunction(SummandList* objFunction);
void UpdateObjectiveFunction();
ResultType Presolve();
void RemovePresolved();
ResultType Solve();
void Save(const char* fileName);
@@ -102,13 +106,12 @@ public:
operator BString() const;
void GetString(BString& string) const;
protected:
VariableList* Variables() const;
ConstraintList* Constraints() const;
int32 fCountColumns;
const ConstraintList& Constraints() const;
private:
ResultType Presolve();
void RemovePresolved();
lprec* fLpPresolved;
OptimizationType fOptimization;
lprec* fLP;
@@ -121,7 +124,6 @@ private:
public:
friend class Constraint;
friend class Variable;
};
+5 -6
View File
@@ -6,11 +6,9 @@
#ifndef VARIABLE_H
#define VARIABLE_H
#include <File.h>
#include <ObjectList.h>
#include <String.h>
#include <SupportDefs.h>
namespace LinearProgramming {
@@ -51,15 +49,18 @@ public:
double penaltyNeg, double penaltyPos);
bool IsValid();
//! Dangerous the variable don't belong to the LinearSpec anymore,
//! delete it yourself!
void Invalidate();
virtual ~Variable();
~Variable();
protected:
Variable(LinearSpec* ls);
private:
LinearSpec* fLS;
BObjectList<Summand> fUsingSummands;
// All Summands that link to this Variable
double fValue;
@@ -71,9 +72,7 @@ private:
public:
friend class LinearSpec;
friend class Constraint;
friend class Summand;
};