9 |
|
|
10 |
|
using namespace std; |
11 |
|
|
12 |
< |
enum ConsType {simpleBound = 1, linearEqu = 2, linearInequ = 4, |
12 |
> |
typedef enum ConsType {simpleBound = 1, linearEqu = 2, linearInequ = 4, |
13 |
|
nonlinearEqu = 8, nonlinearInequ =16}; |
14 |
|
|
15 |
< |
enum BoundType{upper, lower, equ}; |
15 |
> |
typedef enum BoundType{upper, lower, equ}; |
16 |
|
|
17 |
+ |
/** |
18 |
+ |
* Abstract class of constraint for nonlinear optimization problem |
19 |
+ |
*/ |
20 |
|
class ConstraintBase{ |
21 |
|
public: |
22 |
|
ConstraintBase(); |
41 |
|
|
42 |
|
}; |
43 |
|
|
44 |
+ |
/** |
45 |
+ |
* Simple Bound Constraint for nonlinear optimization problem |
46 |
+ |
* boundType is used to identify whether it is upper bound or lower bound |
47 |
+ |
*/ |
48 |
|
class SimpleBoundCons : public ConstraintBase{ |
49 |
|
public: |
50 |
|
|
60 |
|
int index; |
61 |
|
}; |
62 |
|
|
63 |
+ |
/** |
64 |
+ |
* Linear Constraint for nonlinear optimization problem |
65 |
+ |
* boundType is used to identify whether it is linear equation constraint or linear inequality |
66 |
+ |
* constraint. If it is inear inequality constraint |
67 |
+ |
*/ |
68 |
+ |
|
69 |
|
class LinearCons : public ConstraintBase{ |
70 |
|
|
71 |
|
public: |
82 |
|
vector<double> coeff; |
83 |
|
}; |
84 |
|
|
85 |
+ |
/** |
86 |
+ |
* Linear Constraint for nonlinear optimization problem |
87 |
+ |
* boundType is used to identify whether it is linear equality constraint or linear inequality |
88 |
+ |
* constraint |
89 |
+ |
*/ |
90 |
+ |
|
91 |
+ |
|
92 |
|
class NonlinearCons : public ConstraintBase{ |
93 |
|
|
94 |
|
public: |