00001
00013 #ifndef OSBEARCATSOLVERXKIJ_H
00014 #define OSBEARCATSOLVERXKIJ_H
00015
00016 #include "OSDecompSolver.h"
00017 #include "OSDecompSolverFactory.h"
00018 #include "OSInstance.h"
00019 #include "OSOption.h"
00020 #include "ClpSimplex.hpp"
00021 #include "OSCoinSolver.h"
00022 #include<map>
00023
00030
00031 class OSBearcatSolverXkij : public OSDecompSolver {
00032 public:
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 std::string m_initOSiLFile;
00044
00049 std::map<int, std::map<int, std::vector<int> > > m_initSolMap;
00050
00051
00052
00053
00054
00058 bool m_use1OPTstart;
00059
00064 int m_maxThetaNonz;
00065
00066
00067
00068
00072 int* m_routeCapacity;
00073
00078 int* m_routeMinPickup;
00079
00080
00081
00086 int* m_upperBoundL;
00087
00088
00092 int* m_lowerBoundL;
00093
00095 int m_upperBoundLMax;
00096
00101 int m_minDemand;
00102
00104 int* m_demand;
00105
00107 double** m_cost;
00108
00112 double** m_rc;
00113
00114
00115
00116 double* m_optValHub;
00117
00118
00119
00120 double** m_u;
00121 double** m_v;
00122 int** m_px;
00123 int** m_tx;
00124 double** m_g;
00125 int* m_varIdx;
00126
00127
00128
00129
00130 int* m_optL;
00131 int* m_optD;
00132 double** m_vv;
00133 int** m_vvpnt;
00134
00135
00136
00137 int m_totalDemand;
00138 int m_numberOfSolutions;
00139
00140
00141
00142
00143 int* m_tmpScatterArray;
00144
00145
00146 double m_lowerBnd;
00147 int* m_newColumnNonz;
00148 double* m_costVec;
00149 int** m_newColumnRowIdx;
00150 double** m_newColumnRowValue;
00151
00152
00153 int* m_newRowNonz;
00154 int** m_newRowColumnIdx;
00155 double** m_newRowColumnValue;
00156 double* m_newRowUB;
00157 double* m_newRowLB;
00158
00159
00160 int* branchCutIndexes;
00161 double* branchCutValues;
00162
00163
00164
00165
00166
00167
00168
00169
00170 double* m_thetaCost;
00171
00176 int* convexityRowIndex;
00177
00178
00183 int* m_separationIndexMap;
00184
00185
00186 OSInstance *m_osinstanceSeparation;
00187
00188
00189 ClpSimplex* m_separationClpModel;
00190
00191
00192 virtual OSInstance* getInitialRestrictedMaster( );
00193
00194
00195
00196
00197 OSInstance* getSeparationInstance();
00198
00200
00201 double qrouteCost(const int& k, const int& l, const double* c, int* kountVar) ;
00202
00203
00204 void getOptL( double** c) ;
00205
00206
00220 void getCutsTheta(const double* thetaVar, const int numThetaVar,
00221 int &numNewRows, int* &numNonz, int** &colIdx,
00222 double** &values, double* &rowLB, double* &rowUB) ;
00223
00224
00238 void getCutsX(const double* xVar, const int numXVar,
00239 int &numNewRows, int* &numNonz, int** &colIdx,
00240 double** &values, double* &rowLB, double* &rowUB) ;
00241
00242
00261 virtual void getBranchingCut(const double* thetaVar, const int numThetaVar,
00262 const std::map<int, int> &varConMap, int &varIdx, int &numNonz,
00263 int* &indexes, double* &values) ;
00264
00265
00266
00288 virtual void getBranchingCut(const int* thetaIdx, const double* theta,
00289 const int numThetaVar, const std::map<int, int> &varConMap,
00290 int &varIdx, int &numNonz, int* &indexes, double* &values) ;
00291
00292
00302 int getBranchingVar(const double* theta, const int numThetaVar ) ;
00303
00304
00317 int getBranchingVar(const int* thetaIdx, const double* theta, const int numThetaVar ) ;
00318
00319
00333 virtual void getColumns(const double* yA, const int numARows,
00334 const double* yB, const int numBRows,
00335 int &numNewColumns, int* &numNonz, double* &cost,
00336 int** &rowIdx, double** &values, double &lowerBound) ;
00337
00338
00339
00340
00341
00342 void getOptions( OSOption *osoption);
00343
00344
00345
00346
00353 void calcReducedCost(const double* yA, const double* yB );
00354
00355
00356 void createVariableNames( );
00357
00358
00359
00360 void createAmatrix();
00361
00365 virtual void initializeDataStructures();
00366
00370 void getInitialSolution();
00371
00372 virtual void resetMaster( std::map<int, int> &inVars,
00373 OsiSolverInterface *si );
00374
00375
00376 virtual void pauHana(std::vector<int> &m_zOptIndexes , int numNodes,
00377 int numColsGen);
00378
00379
00395 void getCutsMultiCommod(const double* thetaVar, const int numThetaVar,
00396 int &numNewRows, int* &numNonz, int** &colIdx,
00397 double** &values, double* &rowLB, double* &rowUB) ;
00398
00399
00400
00405 OSBearcatSolverXkij();
00406
00411 OSBearcatSolverXkij(OSOption* osoption);
00412
00413
00418 ~OSBearcatSolverXkij();
00419
00420
00421 class Factory;
00422 class Factory : public OSDecompSolverFactory{
00423
00424 public:
00425
00426 Factory(){
00427
00428 }
00429
00430 ~Factory(){
00431
00432 }
00433
00434 OSDecompSolver* create() { return new OSBearcatSolverXkij( osoption); };
00435
00436 };
00437
00438
00439 };
00440
00441 #endif
00442