/home/coin/SVN-release/OS-2.4.2/OS/applications/columnGen/code/OSBearcatSolverXkij.h

Go to the documentation of this file.
00001 /* $Id: OSBearcatSolverXkij.h 3038 2009-11-07 11:43:44Z kmartin $ */
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 /***************** Bearcat Specific Solver Parameters ***********************/
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         //will be the optimal reduced cost for each hub
00116         double* m_optValHub;
00117         
00118         
00119         //start variables for the q-route dynamic program
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         //end variables for the q-route  dynamic programming solution
00127         
00128         //variables for the outer dynamic program 
00129         //get the optimal l value for each route
00130         int* m_optL; //size is number of routes
00131         int* m_optD; //size is number of routes
00132         double** m_vv;
00133         int** m_vvpnt;
00134         //end of variable on the outer dynamic program
00135         
00136         
00137         int m_totalDemand;
00138         int m_numberOfSolutions;
00139         
00140         
00141         //below  is a scatter array we scatter into in order
00142         //to multiply the transformation matrix times the A matrix
00143         int* m_tmpScatterArray;
00144         
00145         //arguments for getColumns
00146         double m_lowerBnd;
00147         int* m_newColumnNonz;
00148         double* m_costVec;
00149         int** m_newColumnRowIdx;
00150         double** m_newColumnRowValue;
00151                 
00152         //arguments for getRows
00153         int* m_newRowNonz;
00154         int** m_newRowColumnIdx;
00155         double** m_newRowColumnValue;
00156         double* m_newRowUB;
00157         double* m_newRowLB;
00158         
00159         //arguments for the getBranchingCut
00160         int* branchCutIndexes;
00161         double* branchCutValues;
00162         //end arguments for the getBranchingCut
00163                 
00164 
00165         
00166 
00167         
00168         //kipp -- be carefull does m_thetaCost have
00169         // artificial variables -- it is 
00170         double* m_thetaCost;
00171         
00176         int* convexityRowIndex;
00177         
00178 
00183         int* m_separationIndexMap;
00184         
00185         //
00186         OSInstance *m_osinstanceSeparation;
00187         
00188         //the Clp model 
00189         ClpSimplex*  m_separationClpModel;
00190 
00191         //create the initial restricted master
00192         virtual OSInstance* getInitialRestrictedMaster( );
00193 
00194         
00195         //this method generates the instance for 
00196         //separating the tour breaking constraints
00197         OSInstance* getSeparationInstance();
00198 
00200         // note -- this c vector is only for hub k
00201         double qrouteCost(const int& k, const int& l, const double* c, int* kountVar) ;
00202         
00203         //this c vector is for the entire cost vector
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         //some utility methods are below
00346         
00353         void calcReducedCost(const double* yA,  const double* yB );
00354         
00355         //these are the variable in x(i, j) space
00356         void createVariableNames( );
00357         
00358         //this is the matrix that says we must visit each node
00359         //this A matrix defines the "coupling constraints"
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         //this method gets called when we are done
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         };// end class OSDipBlockSolverFactory
00437         
00438 
00439 };//end class OSBearcatSolverXkij
00440 
00441 #endif
00442 

Generated on Wed Nov 30 03:04:14 2011 by  doxygen 1.4.7