0306945545
* copyright headers for the files of the libraries linprog and alm * new class Summand for representing summands in a linear constraint * merged class SoftConstraint into class Constraint; Constraint now supports both soft and hard constraint functionality * new AddConstraint methods in class LinearSpec for directly setting constraints with 1 to 4 summands * code cleanups by using aforementioned AddConstraint methods * a new very simple test application for alm * some style corrections git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24108 a95241bf-73f2-0310-859d-f6bbb57e9c96
60 lines
1.1 KiB
C++
60 lines
1.1 KiB
C++
/*
|
|
* Copyright 2007-2008, Christof Lutteroth, lutteroth@cs.auckland.ac.nz
|
|
* Copyright 2007-2008, James Kim, jkim202@ec.auckland.ac.nz
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
|
|
#ifndef VARIABLE_H
|
|
#define VARIABLE_H
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
|
namespace LinearProgramming {
|
|
|
|
class Constraint;
|
|
class LinearSpec;
|
|
|
|
/**
|
|
* Contains minimum and maximum values.
|
|
*/
|
|
class Variable {
|
|
|
|
public:
|
|
int32 Index();
|
|
LinearSpec* LS() const;
|
|
void SetLS(LinearSpec* value);
|
|
double Value() const;
|
|
void SetValue(double value);
|
|
double Min() const;
|
|
void SetMin(double min);
|
|
double Max() const;
|
|
void SetMax(double max);
|
|
void SetRange(double min, double max);
|
|
//~ string ToString();
|
|
Constraint* IsEqual(Variable* var);
|
|
Constraint* IsSmallerOrEqual(Variable* var);
|
|
Constraint* IsGreaterorEqual(Variable* var);
|
|
|
|
protected:
|
|
Variable(LinearSpec* ls);
|
|
~Variable();
|
|
|
|
private:
|
|
LinearSpec* fLS;
|
|
double fValue;
|
|
double fMin;
|
|
double fMax;
|
|
|
|
public:
|
|
friend class LinearSpec;
|
|
friend class Constraint;
|
|
|
|
};
|
|
|
|
} // namespace LinearProgramming
|
|
|
|
using LinearProgramming::Variable;
|
|
|
|
#endif // VARIABLE_H
|