00001
00002
00003
00004
00005 #ifndef __rdFSQP_h__
00006 #define __rdFSQP_h__
00007
00008
00009
00010
00011
00012
00013 #include "rdSQPDLL.h"
00014 #include "rdOptimizationTarget.h"
00015
00016
00017
00018
00024 class RDSQP_API rdFSQP
00025 {
00026
00027
00028
00029 private:
00030
00031
00032 rdOptimizationTarget *_target;
00033
00034
00036 int _mode;
00038 int _printLevel;
00040 int _maxIter;
00043 int _inform;
00045 double _infinity;
00047 double _eps;
00049 double _epseqn;
00051 double _udelta;
00052
00053
00054 int _ncsrl;
00055 int _ncsrn;
00056 int _nfsr;
00057 int *_mesh;
00058
00059
00061 double *_bl;
00063 double *_bu;
00065 double *_x;
00067 double *_p;
00069 double *_c;
00071 double *_lambda;
00072
00073
00074
00075
00076 public:
00077
00078
00079
00080 virtual ~rdFSQP();
00081
00082 rdFSQP(rdOptimizationTarget *aTarget);
00083 private:
00084 void setNull();
00085
00086
00087
00088
00089 public:
00090 rdOptimizationTarget* setTarget(rdOptimizationTarget *aTarget);
00091 rdOptimizationTarget* getTarget();
00092 void setMode(int aMode);
00093 int getMode();
00094 void setPrintLevel(int aLevel);
00095 int getPrintLevel();
00096 void setMaxIterations(int aMaxIter);
00097 int getMaxIterations();
00098 void setInfinity(double aInfinity);
00099 double getInfinity();
00100 void setConvergenceCriterion(double aEPS);
00101 double getConvergenceCriterion();
00102 void setNonlinearEqualityConstraintTolerance(double aEPSEQN);
00103 double getNonlinearEqualityConstraintTolerance();
00104 void setLowerBound(double aLower);
00105 void setLowerBound(int aIndex,double aLower);
00106 void setLowerBound(double aLower[]);
00107 double* getLowerBound();
00108 void setUpperBound(double aUpper);
00109 void setUpperBound(int aIndex,double aUpper);
00110 void setUpperBound(double aUpper[]);
00111 double* getUpperBound();
00112
00113
00114
00115
00116 int computeOptimalControls(const double *xstart,double *x);
00117
00118
00119
00120
00121 static int
00122 CentralDifferences(rdOptimizationTarget *aTarget,
00123 double *dx,double *x,double *dpdx,double *dcdx);
00124 static int
00125 CentralDifferences(rdOptimizationTarget *aTarget,
00126 double *dx,double *x,double *dpdx);
00127 static int
00128 CentralDifferencesConstraint(rdOptimizationTarget *aTarget,
00129 double *dx,double *x,int ic,double *dcdx);
00130
00131
00132
00133
00134 static void
00135 pFunc(int nparam,int j,double *x,double *pj,void *cd);
00136 static void
00137 cFunc(int nparam,int j,double *x,double *cj,void *cd);
00138 static void
00139 dpdxFunc(int nparam,int j,double *x,double *dpdx,
00140 void (*dummy)(int,int,double *,double *,void *),void *cd);
00141 static void
00142 dcdxFunc(int nparam,int j,double *x,double *dcdx,
00143 void (*dummy)(int,int,double *,double *,void *),void *cd);
00144
00145
00146 };
00147
00148
00149
00150 #endif // __rdFSQP_h__