2008-02-25 04:54:05 +03:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2008-02-06 13:51:44 +03:00
|
|
|
#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;
|
2008-02-25 04:54:05 +03:00
|
|
|
void SetLS(LinearSpec* value);
|
2008-02-06 13:51:44 +03:00
|
|
|
double Value() const;
|
2008-02-25 04:54:05 +03:00
|
|
|
void SetValue(double value);
|
2008-02-06 13:51:44 +03:00
|
|
|
double Min() const;
|
2008-02-25 04:54:05 +03:00
|
|
|
void SetMin(double min);
|
2008-02-06 13:51:44 +03:00
|
|
|
double Max() const;
|
2008-02-25 04:54:05 +03:00
|
|
|
void SetMax(double max);
|
|
|
|
void SetRange(double min, double max);
|
|
|
|
//~ string ToString();
|
2008-02-06 13:51:44 +03:00
|
|
|
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;
|
2008-02-25 04:54:05 +03:00
|
|
|
friend class Constraint;
|
2008-02-06 13:51:44 +03:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace LinearProgramming
|
|
|
|
|
|
|
|
using LinearProgramming::Variable;
|
|
|
|
|
|
|
|
#endif // VARIABLE_H
|