00001
00016 #ifndef OSNL2OS_H
00017 #define OSNL2OS_H
00018
00019
00020 #include "OSoLReader.h"
00021 #include "OSOption.h"
00022 #include "OSInstance.h"
00023 #include "OSnLNode.h"
00024 #include "OSMathUtil.h"
00025 #include <string>
00026 #include <vector>
00027
00028
00043 struct ograd;
00044 struct cgrad;
00045 struct ASL;
00046 struct expr;
00047
00048 enum OS_AMPL_SUFFIX_TYPE
00049 {
00050 OS_AMPL_SUFFIX_TYPE_integer,
00051 OS_AMPL_SUFFIX_TYPE_double
00052 };
00053
00054 enum OS_AMPL_SUFFIX_SCOPE
00055 {
00056 OS_AMPL_SUFFIX_SCOPE_variables,
00057 OS_AMPL_SUFFIX_SCOPE_constraints,
00058 OS_AMPL_SUFFIX_SCOPE_objectives,
00059 OS_AMPL_SUFFIX_SCOPE_problems
00060 };
00061
00062 enum OS_AMPL_SUFFIX_DIRECTION
00063 {
00064 OS_AMPL_SUFFIX_DIRECTION_toSolver,
00065 OS_AMPL_SUFFIX_DIRECTION_toAMPL,
00066 OS_AMPL_SUFFIX_DIRECTION_both,
00067 OS_AMPL_SUFFIX_DIRECTION_local
00068 };
00069
00070 struct OS_AMPL_SUFFIX
00071 {
00072 std::string name;
00073 OS_AMPL_SUFFIX_TYPE type;
00074 OS_AMPL_SUFFIX_SCOPE scope;
00075 OS_AMPL_SUFFIX_DIRECTION direction;
00076 };
00077
00078 class OSnl2OS
00079 {
00080 public:
00082
00083 OSnl2OS();
00084
00091 OSnl2OS(ASL *cw, ASL *rw, ASL *asl);
00092
00094 ~OSnl2OS();
00095
00102 ASL* getASL(std::string name);
00103
00109 bool readNl(std::string stub);
00110
00112 void setOsol(std::string osol);
00113
00115 void setJobID(std::string jobID);
00116
00125 bool setASL(ASL *asl, ASL *rw, ASL *cw);
00126
00135 bool createOSObjects();
00136
00144 void setVar(OSInstance *osinstance, int lower, int upper, char vartype);
00145
00154 void setIBVar(OSInstance *osinstance, int lower, int upper);
00155
00160 OSoLReader *osolreader;
00161
00167 OSnLNode* walkTree(expr *e);
00168
00172 OSInstance *osinstance;
00173
00177 OSOption *osoption;
00178
00183 std::string osol;
00184
00189 std::string jobID;
00190
00191 std::vector<std::string> op_type;
00192 std::vector<double> operand;
00193 int numkount;
00194
00195 private:
00196
00200 ograd *og;
00201
00207 ASL *cw, *rw, *asl;
00208
00211 std::string stub;
00212
00213 };
00214
00215 #endif