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, 4 months ago) by tim
File size: 2029 byte(s)
Log Message:
constraint class in energy minimization

File Contents

# User Rev Content
1 tim 969 #ifdef _NLOPCONSTRAINT_H_
2     #define _NLOPCONSTRAINT_H_
3    
4 tim 975 #include <vector>
5 tim 969
6 tim 975 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 tim 969 };
40    
41    
42 tim 975 class NLOPConstraint{
43     public:
44     int getConsType() { return consType;}
45     protected:
46     int consType;
47 tim 969 };
48    
49 tim 975 class SimpleBoundConstraint : public NLOPConstraint{
50     public:
51     SimpleBoundConstraint() {consType = NLOPConsType::simpleBound;}
52     ~SimpleBoundConstraint();
53     private:
54    
55     };
56 tim 969
57 tim 975 class LinearConstraint : public NLOPConstraint{
58 tim 969
59 tim 975
60 tim 969 };
61    
62 tim 975 class NonLinearConstraint : public NLOPConstraint{
63     public:
64 tim 969
65 tim 975 private:
66    
67 tim 969 };
68    
69 tim 975
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 tim 969 #endif