00001
00013 #ifndef OSCOLGENAPP_H
00014 #define OSCOLGENAPP_H
00015
00016
00017 #include "OSDataStructures.h"
00018 #include "OSDefaultSolver.h"
00019 #include "OSrLReader.h"
00020 #include "OSOption.h"
00021 #include "OSInstance.h"
00022 #include "OSoLReader.h"
00023 #include "OSCoinSolver.h"
00024 #include "OSBearcatSolverXij.h"
00025 #include "OSDecompParam.h"
00026 #include "OSDecompFactoryInitializer.h"
00027
00028 #include "OSNode.h"
00029
00030 #include<vector>
00031
00032
00039
00040 class OSColGenApp {
00041 public:
00042
00043 OSDecompFactoryInitializer *m_factoryInit;
00044
00045
00046 OSDecompSolver *m_osrouteSolver;
00047
00048
00049
00050
00051 std::ostringstream outStr;
00052
00053 OSInstance *m_osinstanceMaster;
00054 OSOption *m_osoption;
00055 OSResult *m_osresult;
00056
00060 std::vector<double> m_zRootLPx_vals;
00061
00062
00066 std::vector<int> m_zRootLPx_idx;
00067
00068
00069
00073 bool m_calledBranchAndBound;
00074
00078 std::map<int, int> m_rowIdxVarMap;
00079
00080
00081
00082 CoinSolver *m_solver;
00083
00084 OsiSolverInterface *m_si;
00085
00086
00088 OSDecompParam m_osDecompParam;
00089
00091 int m_numNodesGenerated;
00092
00094 int m_numColumnsGenerated;
00095
00102 int m_numColumnsOld;
00103
00105 std::string m_message;
00106
00108 double m_zUB;
00109
00111 double m_zLB;
00112
00114 double m_zRootLP;
00115
00119 std::map<int, OSNode*> m_nodeMap;
00120
00125 std::vector<int> m_zOptIndexes;
00126
00132 std::vector<int> m_zOptRootLP;
00133
00134
00135 std::map<int, int> inVars;
00136
00137
00138
00139
00141 double *m_yA;
00142
00144 double *m_yB;
00145
00147 double* m_theta;
00148
00150 int m_maxCols;
00151
00153 int m_maxRows;
00154
00156 void solveRestrictedMasterRelaxation( );
00157
00158
00159 void getOptions( OSOption *osoption);
00160
00167 bool branchAndBound();
00168
00169 void solve();
00170
00171
00172
00173
00174 void printTreeInfo();
00175
00176
00177 void getInitialRestrictedMaster( );
00178
00188 bool isInteger( const double *thetaVar, const int numThetaVar,
00189 const double tol);
00190
00191
00192 void printDebugInfo( );
00193
00194
00195 void checkNodeConsistency( const int rowIdx, const OSNode *osnode);
00196
00210 void getCuts(const double* thetaVar, const int numThetaVar,
00211 int &numNewRows, int* &numNonz, int** &colIdx,
00212 double** &values, double* &rowLB, double* &rowUB) ;
00213
00229 void getColumns(const double* yA, const int numARows,
00230 const double* yB, const int numBRows,
00231 int &numNewColumns, int* &numNonz, double* &cost,
00232 int** &rowIdx, double** &values, double &lowerBound) ;
00233
00234
00248 OSNode* createChild(const OSNode *osnode, std::map<int, int> &varConMap,
00249 const int rowIdx, const double rowLB, const double rowUB);
00250
00251
00252
00266 void createBranchingCut(const int* thetaIdx, const double* theta,
00267 const int numThetaVar, std::map<int, int> &varConMap, int &rowIdx);
00268
00269
00282 void createBranchingCut(const double* theta, const int numThetaVar,
00283 std::map<int, int> &varConMap, int &rowIdx);
00284
00285
00286 void resetMaster( );
00287
00292 OSColGenApp();
00293
00298 OSColGenApp( OSOption *osption);
00299
00300
00305 ~OSColGenApp();
00306
00307
00308 };
00309
00310 #endif
00311