Remove unused fOwner variable. Cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38740 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -62,9 +62,6 @@ public:
|
|||||||
Variable* DNeg() const;
|
Variable* DNeg() const;
|
||||||
Variable* DPos() const;
|
Variable* DPos() const;
|
||||||
|
|
||||||
void SetOwner(void* owner);
|
|
||||||
void* Owner() const;
|
|
||||||
|
|
||||||
bool IsValid();
|
bool IsValid();
|
||||||
void Invalidate();
|
void Invalidate();
|
||||||
|
|
||||||
@@ -85,7 +82,6 @@ private:
|
|||||||
double fRightSide;
|
double fRightSide;
|
||||||
Summand* fDNegObjSummand;
|
Summand* fDNegObjSummand;
|
||||||
Summand* fDPosObjSummand;
|
Summand* fDPosObjSummand;
|
||||||
void* fOwner;
|
|
||||||
BString fLabel;
|
BString fLabel;
|
||||||
|
|
||||||
bool fIsValid;
|
bool fIsValid;
|
||||||
|
|||||||
@@ -339,40 +339,41 @@ Constraint::SetLabel(const char* label)
|
|||||||
void
|
void
|
||||||
Constraint::WriteXML(BFile* file)
|
Constraint::WriteXML(BFile* file)
|
||||||
{
|
{
|
||||||
if (file->IsWritable() && fOwner == NULL) {
|
if (!file->IsWritable())
|
||||||
char buffer[200];
|
return;
|
||||||
|
|
||||||
file->Write(buffer, sprintf(buffer, "\t<constraint>\n"));
|
char buffer[200];
|
||||||
file->Write(buffer, sprintf(buffer, "\t\t<leftside>\n"));
|
|
||||||
|
|
||||||
Summand* summand;
|
file->Write(buffer, sprintf(buffer, "\t<constraint>\n"));
|
||||||
for (int32 i = 0; i < fLeftSide->CountItems(); i++) {
|
file->Write(buffer, sprintf(buffer, "\t\t<leftside>\n"));
|
||||||
summand = (Summand*)fLeftSide->ItemAt(i);
|
|
||||||
file->Write(buffer, sprintf(buffer, "\t\t\t<summand>\n"));
|
|
||||||
file->Write(buffer, sprintf(buffer, "\t\t\t\t<coeff>%f</coeff>\n",
|
|
||||||
summand->Coeff()));
|
|
||||||
BString varStr = *(summand->Var());
|
|
||||||
file->Write(buffer, sprintf(buffer, "\t\t\t\t<var>%s</var>\n",
|
|
||||||
varStr.String()));
|
|
||||||
file->Write(buffer, sprintf(buffer, "\t\t\t</summand>\n"));
|
|
||||||
}
|
|
||||||
|
|
||||||
file->Write(buffer, sprintf(buffer, "\t\t</leftside>\n"));
|
Summand* summand;
|
||||||
|
for (int32 i = 0; i < fLeftSide->CountItems(); i++) {
|
||||||
const char* op = "??";
|
summand = (Summand*)fLeftSide->ItemAt(i);
|
||||||
if (fOp == OperatorType(EQ))
|
file->Write(buffer, sprintf(buffer, "\t\t\t<summand>\n"));
|
||||||
op = "EQ";
|
file->Write(buffer, sprintf(buffer, "\t\t\t\t<coeff>%f</coeff>\n",
|
||||||
else if (fOp == OperatorType(LE))
|
summand->Coeff()));
|
||||||
op = "LE";
|
BString varStr = *(summand->Var());
|
||||||
else if (fOp == OperatorType(GE))
|
file->Write(buffer, sprintf(buffer, "\t\t\t\t<var>%s</var>\n",
|
||||||
op = "GE";
|
varStr.String()));
|
||||||
|
file->Write(buffer, sprintf(buffer, "\t\t\t</summand>\n"));
|
||||||
file->Write(buffer, sprintf(buffer, "\t\t<op>%s</op>\n", op));
|
|
||||||
file->Write(buffer, sprintf(buffer, "\t\t<rightside>%f</rightside>\n", fRightSide));
|
|
||||||
//~ file->Write(buffer, sprintf(buffer, "\t\t<penaltyneg>%s</penaltyneg>\n", PenaltyNeg()));
|
|
||||||
//~ file->Write(buffer, sprintf(buffer, "\t\t<penaltypos>%s</penaltypos>\n", PenaltyPos()));
|
|
||||||
file->Write(buffer, sprintf(buffer, "\t</constraint>\n"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file->Write(buffer, sprintf(buffer, "\t\t</leftside>\n"));
|
||||||
|
|
||||||
|
const char* op = "??";
|
||||||
|
if (fOp == OperatorType(EQ))
|
||||||
|
op = "EQ";
|
||||||
|
else if (fOp == OperatorType(LE))
|
||||||
|
op = "LE";
|
||||||
|
else if (fOp == OperatorType(GE))
|
||||||
|
op = "GE";
|
||||||
|
|
||||||
|
file->Write(buffer, sprintf(buffer, "\t\t<op>%s</op>\n", op));
|
||||||
|
file->Write(buffer, sprintf(buffer, "\t\t<rightside>%f</rightside>\n", fRightSide));
|
||||||
|
//~ file->Write(buffer, sprintf(buffer, "\t\t<penaltyneg>%s</penaltyneg>\n", PenaltyNeg()));
|
||||||
|
//~ file->Write(buffer, sprintf(buffer, "\t\t<penaltypos>%s</penaltypos>\n", PenaltyPos()));
|
||||||
|
file->Write(buffer, sprintf(buffer, "\t</constraint>\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -404,20 +405,6 @@ Constraint::DPos() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
Constraint::SetOwner(void* owner)
|
|
||||||
{
|
|
||||||
fOwner = owner;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void*
|
|
||||||
Constraint::Owner() const
|
|
||||||
{
|
|
||||||
return fOwner;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Constraint::IsValid()
|
Constraint::IsValid()
|
||||||
{
|
{
|
||||||
@@ -497,11 +484,11 @@ Constraint::GetString(BString& string) const
|
|||||||
*/
|
*/
|
||||||
Constraint::Constraint(LinearSpec* ls, BList* summands, OperatorType op,
|
Constraint::Constraint(LinearSpec* ls, BList* summands, OperatorType op,
|
||||||
double rightSide, double penaltyNeg, double penaltyPos)
|
double rightSide, double penaltyNeg, double penaltyPos)
|
||||||
: fLS(ls),
|
:
|
||||||
|
fLS(ls),
|
||||||
fLeftSide(summands),
|
fLeftSide(summands),
|
||||||
fOp(op),
|
fOp(op),
|
||||||
fRightSide(rightSide),
|
fRightSide(rightSide),
|
||||||
fOwner(NULL),
|
|
||||||
fIsValid(true)
|
fIsValid(true)
|
||||||
{
|
{
|
||||||
double coeffs[summands->CountItems() + 2];
|
double coeffs[summands->CountItems() + 2];
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
* Creates a new specification for a linear programming problem.
|
* Creates a new specification for a linear programming problem.
|
||||||
*/
|
*/
|
||||||
LinearSpec::LinearSpec()
|
LinearSpec::LinearSpec()
|
||||||
: fCountColumns(0),
|
:
|
||||||
|
fCountColumns(0),
|
||||||
fLpPresolved(NULL),
|
fLpPresolved(NULL),
|
||||||
fOptimization(MINIMIZE),
|
fOptimization(MINIMIZE),
|
||||||
fObjFunction(new BList()),
|
fObjFunction(new BList()),
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "LinearSpec.h"
|
||||||
#include "Summand.h"
|
#include "Summand.h"
|
||||||
#include "Variable.h"
|
#include "Variable.h"
|
||||||
#include "LinearSpec.h"
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,4 +76,3 @@ Summand::Summand(double coeff, Variable* var)
|
|||||||
fUsedInPenaltyFunction = false;
|
fUsedInPenaltyFunction = false;
|
||||||
fVar->fUsingSummands.AddItem(this);
|
fVar->fUsingSummands.AddItem(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -319,7 +319,6 @@ Variable::Invalidate()
|
|||||||
Variable::Variable(LinearSpec* ls)
|
Variable::Variable(LinearSpec* ls)
|
||||||
:
|
:
|
||||||
fLS(ls),
|
fLS(ls),
|
||||||
|
|
||||||
fValue(NAN),
|
fValue(NAN),
|
||||||
fMin(0),
|
fMin(0),
|
||||||
fMax(DBL_MAX),
|
fMax(DBL_MAX),
|
||||||
|
|||||||
Reference in New Issue
Block a user