VariableList.h
00001 #ifndef VARIABLELIST_H
00002 #define VARIABLELIST_H
00003
00004 #ifdef HAVE_CONFIG_H
00005 #include "OPT++_config.h"
00006 #endif
00007
00008 #include <iostream>
00009 #include <string>
00010 #include <vector>
00011 #ifdef HAVE_STD
00012 #include <cstdlib>
00013 #else
00014 #include <stdlib.h>
00015 #endif
00016
00017 #include "xercesc/dom/DOM.hpp"
00018 #include "xercesc/util/PlatformUtils.hpp"
00019
00020 #include "newmat.h"
00021
00022 #include "Opt.h"
00023 #include "BoundConstraint.h"
00024 #include "NonLinearEquation.h"
00025 #include "NonLinearInequality.h"
00026 #include "CompoundConstraint.h"
00027 #include "LinearInequality.h"
00028 #include "LinearEquation.h"
00029
00030 using std::string;
00031
00032 XERCES_CPP_NAMESPACE_USE
00033
00034 namespace OPTPP {
00035
00036 typedef struct{
00037 string varName;
00038 double initialValue;
00039 bool hasUpperBound;
00040 double upperBound;
00041 bool hasLowerBound;
00042 double lowerBound;
00043 }inputVariable;
00044
00045 class AppLauncher;
00046
00047 class VariableList
00048 {
00049 private:
00050
00051 vector<inputVariable> variables_;
00052 DOMElement* variableListXML_;
00053 DOMElement* nlConstraintListXML_;
00054 DOMElement* linConstraintListXML_;
00055 int numVars_;
00056 vector<void *> loadedLibs_;
00057 vector<NLP *> constraintFunctions_;
00058 vector<NLPBase *> constraintBase_;
00059 vector<NonLinearEquation *> nlEquations_;
00060 vector<NonLinearInequality *> nlInequalities_;
00061 vector<AppLauncher *> launchers_;
00062 CompoundConstraint * compound_;
00063 BoundConstraint * bound_;
00064 LinearEquation * linEquality_;
00065 LinearInequality * linInEquality_;
00066 bool lboundsExist_, uboundsExist_;
00067 bool lconstraintsExist_, nlconstraintsExist_;
00068
00069
00070 public:
00072 VariableList(){ compound_ = NULL;
00073 bound_ = NULL;
00074 linEquality_ = NULL;
00075 linInEquality_ = NULL;
00076 lboundsExist_ = false;
00077 uboundsExist_ = false;
00078 lconstraintsExist_ = false;
00079 nlconstraintsExist_ = false;
00080 }
00082 VariableList(DOMElement* problemXML);
00083
00085 ~VariableList();
00086
00088 NEWMAT::ColumnVector GetInitialValues();
00089
00091 NEWMAT::ColumnVector GetUpperBounds();
00092
00094 NEWMAT::ColumnVector GetLowerBounds();
00095
00097 string GetVariableName(int i);
00098
00100 int size(){return numVars_;}
00101
00103 BoundConstraint * GetBoundConstraints();
00104
00106 CompoundConstraint * GetGeneralConstraints();
00107
00109 USERNLNCON0 GetConstraintFunction(DOMElement* constraintXML);
00110
00112 USERNLNCON1 GetConstraintFunction1(DOMElement* constraintXML);
00113
00115 USERNLNCON2 GetConstraintFunction2(DOMElement* constraintXML);
00116
00118 INITFCN GetConstraintInitFunction(DOMElement* constraintXML);
00119
00121 void * GetFunction(string libName, string funcName);
00122
00124 int GetDerivOrder(DOMElement* subroutineXML);
00125
00126 bool lowerExists();
00127 bool upperExists();
00128 bool linearExists();
00129 bool nonlinearExists();
00130 };
00131
00132 }
00133 #endif