1 /* 2 * Copyright 2007-2008, Christof Lutteroth, lutteroth@cs.auckland.ac.nz 3 * Copyright 2007-2008, James Kim, jkim202@ec.auckland.ac.nz 4 * Distributed under the terms of the MIT License. 5 */ 6 7 #ifndef VARIABLE_H 8 #define VARIABLE_H 9 10 #include <SupportDefs.h> 11 12 13 namespace LinearProgramming { 14 15 class Constraint; 16 class LinearSpec; 17 18 /** 19 * Contains minimum and maximum values. 20 */ 21 class Variable { 22 23 public: 24 int32 Index(); 25 LinearSpec* LS() const; 26 void SetLS(LinearSpec* value); 27 double Value() const; 28 void SetValue(double value); 29 double Min() const; 30 void SetMin(double min); 31 double Max() const; 32 void SetMax(double max); 33 void SetRange(double min, double max); 34 //~ string ToString(); 35 Constraint* IsEqual(Variable* var); 36 Constraint* IsSmallerOrEqual(Variable* var); 37 Constraint* IsGreaterorEqual(Variable* var); 38 39 protected: 40 Variable(LinearSpec* ls); 41 ~Variable(); 42 43 private: 44 LinearSpec* fLS; 45 double fValue; 46 double fMin; 47 double fMax; 48 49 public: 50 friend class LinearSpec; 51 friend class Constraint; 52 53 }; 54 55 } // namespace LinearProgramming 56 57 using LinearProgramming::Variable; 58 59 #endif // VARIABLE_H 60