ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/NLOPConstraint.hpp
Revision: 975
Committed: Wed Jan 21 22:16:00 2004 UTC (21 years, 3 months ago) by tim
File size: 2029 byte(s)
Log Message:
constraint class in energy minimization

File Contents

# Content
1 #ifdef _NLOPCONSTRAINT_H_
2 #define _NLOPCONSTRAINT_H_
3
4 #include <vector>
5
6 using namespace std;
7
8 enum NLOPConsType {unconstraint = 1, simpleBound = 2, linearEqu = 4, linearInequ = 8,
9 nonlinearEqu = 16, nonlinearInequ =32};
10
11 enum ConstraintBoundType{none, lt,le, eq, ge, gt};
12
13
14 class ConstraintBound{
15 public:
16 bool hasLowerBound() {return ConstraintBoundType::none & lowerBoundType;}
17 bool hasUpperBound() {return ConstraintBoundType::none & upperBoundType;}
18
19 ConstraintBoundType getLowerBoundType() {return lowerBoundType;}
20 ConstraintBoundType getUpperBoundType() {return upperBoundType;}
21
22 double getLowerBound() {return lowerBound;}
23 double getUpperBound() {return upperBound;}
24
25 vector<int>& getIndexOfConsVar() {return indexOfConsVar;}
26
27 void setLowerBound(double rhs) {lowerBound = rhs;}
28 void setUpperBound(double rhs) {upperBound = rhs;}
29
30 void setLowerBoundType(ConstraintBoundType type) {lowerBoundType = type;}
31 void setUpperBoundType(ConstraintBoundType type) {upperBoundType = type;}
32
33 protected:
34 vector<int> indexOfConsVar;
35 double lowerBound;
36 double upperBound;
37 ConstraintBoundType lowerBoundType;
38 ConstraintBoundType upperBoundType;
39 };
40
41
42 class NLOPConstraint{
43 public:
44 int getConsType() { return consType;}
45 protected:
46 int consType;
47 };
48
49 class SimpleBoundConstraint : public NLOPConstraint{
50 public:
51 SimpleBoundConstraint() {consType = NLOPConsType::simpleBound;}
52 ~SimpleBoundConstraint();
53 private:
54
55 };
56
57 class LinearConstraint : public NLOPConstraint{
58
59
60 };
61
62 class NonLinearConstraint : public NLOPConstraint{
63 public:
64
65 private:
66
67 };
68
69
70 class ComplexConstraint : NLOPConstraint{
71 public:
72 void addConstraint(NLOPConstraint* constraint);
73
74 vector<NLOPConstraint*>& getConstraint() {return constraintList;}
75
76 private:
77 vector<NLOPConstraint*> constraintList;
78
79
80 };
81
82
83 #endif