Some clean up (not complete).

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38736 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler
2010-09-20 04:23:27 +00:00
parent 416aca7ac9
commit 4403274117
2 changed files with 104 additions and 88 deletions
+24 -20
View File
@@ -1,28 +1,29 @@
/* /*
* Copyright 2007-2008, Christof Lutteroth, [email protected] * Copyright 2007-2008, Christof Lutteroth, [email protected]
* Copyright 2007-2008, James Kim, [email protected] * Copyright 2007-2008, James Kim, [email protected]
* Copyright 2010, Clemens Zeidler, [email protected]
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef LINEAR_SPEC_H #ifndef LINEAR_SPEC_H
#define LINEAR_SPEC_H #define LINEAR_SPEC_H
#include "Variable.h"
#include "Constraint.h"
#include "Summand.h"
#include "PenaltyFunction.h"
#include "OperatorType.h"
#include "ResultType.h"
#include "OptimizationType.h"
#include "lp_lib.h"
#include <List.h>
#include <String.h>
#include <OS.h>
#include <SupportDefs.h>
#include <math.h> #include <math.h>
#include <List.h>
#include <OS.h>
#include <String.h>
#include <SupportDefs.h>
#include "Constraint.h"
#include "OperatorType.h"
#include "OptimizationType.h"
#include "PenaltyFunction.h"
#include "ResultType.h"
#include "Summand.h"
#include "Variable.h"
#include "lp_lib.h"
namespace LinearProgramming { namespace LinearProgramming {
@@ -31,11 +32,11 @@ class ObjFunctionSummand;
class PenaltyFunction; class PenaltyFunction;
class Variable; class Variable;
/**
/*!
* Specification of a linear programming problem. * Specification of a linear programming problem.
*/ */
class LinearSpec { class LinearSpec {
public: public:
LinearSpec(); LinearSpec();
virtual ~LinearSpec(); virtual ~LinearSpec();
@@ -81,7 +82,8 @@ public:
OperatorType op, double rightSide, OperatorType op, double rightSide,
double penaltyNeg, double penaltyPos); double penaltyNeg, double penaltyPos);
PenaltyFunction* AddPenaltyFunction(Variable* var, BList* xs, BList* gs); PenaltyFunction* AddPenaltyFunction(Variable* var, BList* xs,
BList* gs);
BList* ObjFunction(); BList* ObjFunction();
void SetObjFunction(BList* summands); void SetObjFunction(BList* summands);
@@ -95,8 +97,7 @@ public:
int32 CountColumns() const; int32 CountColumns() const;
OptimizationType Optimization() const; OptimizationType Optimization() const;
void SetOptimization(OptimizationType value); void SetOptimization(OptimizationType value);
BList* Variables() const;
BList* Constraints() const;
ResultType Result() const; ResultType Result() const;
double ObjectiveValue() const; double ObjectiveValue() const;
double SolvingTime() const; double SolvingTime() const;
@@ -105,6 +106,9 @@ public:
void GetString(BString& string) const; void GetString(BString& string) const;
protected: protected:
BList* Variables() const;
BList* Constraints() const;
int32 fCountColumns; int32 fCountColumns;
private: private:
+15 -3
View File
@@ -14,9 +14,21 @@ namespace LinearProgramming {
* The possible results of a solving attempt. * The possible results of a solving attempt.
*/ */
enum ResultType { enum ResultType {
NOMEMORY = -2, ERROR = -1, OPTIMAL = 0, SUBOPTIMAL = 1, INFEASIBLE = 2, UNBOUNDED = 3, NOMEMORY = -2,
DEGENERATE = 4, NUMFAILURE = 5, USERABORT = 6, TIMEOUT = 7, PRESOLVED = 9, PROCFAIL = 10, ERROR = -1,
PROCBREAK = 11, FEASFOUND = 12, NOFEASFOUND = 13 OPTIMAL = 0,
SUBOPTIMAL = 1,
INFEASIBLE = 2,
UNBOUNDED = 3,
DEGENERATE = 4,
NUMFAILURE = 5,
USERABORT = 6,
TIMEOUT = 7,
PRESOLVED = 9,
PROCFAIL = 10,
PROCBREAK = 11,
FEASFOUND = 12,
NOFEASFOUND = 13
}; };
} // namespace LinearProgramming } // namespace LinearProgramming