Crevice  0.1
 All Classes Functions Variables Pages
TermVariable.h
1 /*
2  * File: TermVariable.h
3  *
4  * Copyright 2012 Heinrich Schuchardt <xypron.glpk@gmx.de>
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #ifndef TERMVARIABLE_H
20 #define TERMVARIABLE_H
21 
22 #include "Term.h"
23 #include <string>
24 #include <vector>
25 
26 class Problem;
27 
32 class TermVariable : public Term {
33  friend class Problem;
34 public:
35  static TermVariable* create(Problem* problem, const std::string &name);
36  Term* differentiate(TermVariable* variable) throw
38  bool less(const Term* term) const;
39  const double getLowerBound();
40  void setLowerBound(const double lowerBound);
41  const int getVariableIndex();
42  const std::string getName();
43  const double getUpperBound();
44  void setUpperBound(const double upperBound);
45  std::string toString() const;
46 protected:
47  double eval(
48  const DoubleVector* variableValues,
49  TermValueSet* termValues);
50  void setVariableIndex(const int variableIndex);
51  TermVariable(Problem* problem, const std::string &name);
52  virtual ~TermVariable();
53 private:
54  int variableIndex_;
55  double lowerBound_;
56  std::string name_;
57  double upperBound_;
58 };
59 
60 #endif /* TERMVARIABLE_H */
61