- 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:
@@ -8,12 +8,12 @@
|
||||
|
||||
#include "Constraint.h"
|
||||
#include "LinearSpec.h"
|
||||
#include "Tab.h"
|
||||
|
||||
|
||||
namespace BALM {
|
||||
|
||||
class BALMLayout;
|
||||
class XTab;
|
||||
|
||||
/**
|
||||
* Represents a column defined by two x-tabs.
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
ConstraintList* Constraints() const;
|
||||
|
||||
protected:
|
||||
Column(LinearSpec* ls);
|
||||
Column(BALMLayout* layout);
|
||||
|
||||
protected:
|
||||
LinearSpec* fLS;
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
|
||||
#include "Constraint.h"
|
||||
#include "LinearSpec.h"
|
||||
#include "Tab.h"
|
||||
|
||||
|
||||
namespace BALM {
|
||||
|
||||
class BALMLayout;
|
||||
class YTab;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a row defined by two y-tabs.
|
||||
*/
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
ConstraintList* Constraints() const;
|
||||
|
||||
protected:
|
||||
Row(LinearSpec* ls);
|
||||
Row(BALMLayout* layout);
|
||||
|
||||
protected:
|
||||
LinearSpec* fLS;
|
||||
|
||||
@@ -27,7 +27,6 @@ protected:
|
||||
|
||||
public:
|
||||
friend class BALMLayout;
|
||||
friend class Column;
|
||||
};
|
||||
|
||||
|
||||
@@ -42,7 +41,6 @@ protected:
|
||||
|
||||
public:
|
||||
friend class BALMLayout;
|
||||
friend class Row;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user