#include <OSRouteSolver.h>
Collaboration diagram for OSRouteSolver:
Public Member Functions | |
OSInstance * | getInitialRestrictedMaster () |
OSInstance * | getSeparationInstance () |
double | qrouteCost (const int &k, const int &l, const double *c, int *kountVar) |
kipp -- document | |
void | getOptL (const double *c) |
void | getCuts (const double *x) |
void | getColumns (const double *y, const int numRows, int &numColumns, int *numNonz, double *cost, double *rcost, int **rowIdx, double **values, double &lowerBound) |
RETURN VALUES: int numColumns -- number of new columns generated int* numNonz -- number of nonzeros in each column double* cost -- the objective function coefficient on each new column double* rcost -- the reduced cost of each new column double** rowIdx -- vectors row indexes of new columns double** values -- vectors of matrix coefficient values of new columns double lowerBound -- the lowerBound. | |
void | getOptions (OSOption *osoption) |
void | calcReducedCost (double **c, double *phi, double *d) |
calculate the reduced costs c -- input of the objective function costs phi -- dual values on node assignment d -- reduced with convexity dual value | |
void | createVariableNames () |
void | createAmatrix () |
void | pauHana (const double *theta) |
OSRouteSolver () | |
Default Constructor. | |
OSRouteSolver (OSOption *osoption) | |
Second Constructor. | |
~OSRouteSolver () | |
Default Destructor. | |
Public Attributes | |
std::string | m_initOSiLFile |
std::map< int, std::map< int, std::vector< int > > > | m_initSolMap |
int | m_numberOfVar |
int | m_numHubs |
int | m_numNodes |
int | m_routeCapacity |
int | m_minDemand |
int * | m_demand |
double ** | m_cost |
the distance/cost vectors | |
double * | m_rc |
the reduced cost vector we asssume order is (k, l, i, j) | |
double * | m_psi |
the dual vector on convexity row see the paper for notation | |
double * | m_phi |
the dual vector on node assignments row see the paper for notation | |
double * | m_optValHub |
double ** | m_u |
double ** | m_v |
int ** | m_px |
int ** | m_tx |
double ** | m_g |
int * | m_varIdx |
int * | m_optL |
int * | m_optD |
double ** | m_vv |
int ** | m_vvpnt |
int | m_totalDemand |
int | m_upperBoundL |
int | m_numberOfSolutions |
std::string * | m_variableNames |
int * | m_pntAmatrix |
int * | m_Amatrix |
int * | m_tmpScatterArray |
double | m_lowerBnd |
int * | m_nonzVec |
double * | m_costVec |
int ** | m_newColumnRowIdx |
double ** | m_newColumnRowValue |
int * | m_thetaPnt |
int * | m_thetaIndex |
int | m_numThetaVar |
int | m_numThetaNonz |
double * | m_thetaCost |
OSInstance * | m_osinstanceMaster |
OSInstance * | m_osinstanceSeparation |
Definition at line 31 of file OSRouteSolver.h.
OSRouteSolver::OSRouteSolver | ( | ) |
OSRouteSolver::OSRouteSolver | ( | OSOption * | osoption | ) |
Second Constructor.
the 1000 is the number of rows -- coupling plus tour breaking
Definition at line 64 of file OSRouteSolver.cpp.
References createAmatrix(), createVariableNames(), ErrorClass::errormsg, getOptions(), getSeparationInstance(), m_Amatrix, m_cost, m_costVec, m_demand, m_g, m_newColumnRowIdx, m_newColumnRowValue, m_nonzVec, m_numHubs, m_numNodes, m_numThetaNonz, m_numThetaVar, m_optD, m_optL, m_optValHub, m_phi, m_pntAmatrix, m_psi, m_px, m_rc, m_routeCapacity, m_thetaCost, m_thetaIndex, m_thetaPnt, m_tmpScatterArray, m_totalDemand, m_tx, m_u, m_upperBoundL, m_v, m_variableNames, m_varIdx, m_vv, m_vvpnt, OSDBL_MAX, and osoption.
OSRouteSolver::~OSRouteSolver | ( | ) |
Default Destructor.
Definition at line 224 of file OSRouteSolver.cpp.
References m_Amatrix, m_cost, m_costVec, m_demand, m_g, m_newColumnRowIdx, m_newColumnRowValue, m_nonzVec, m_numHubs, m_numNodes, m_optD, m_optL, m_optValHub, m_phi, m_pntAmatrix, m_psi, m_px, m_rc, m_thetaCost, m_thetaIndex, m_thetaPnt, m_tmpScatterArray, m_tx, m_u, m_v, m_variableNames, m_varIdx, m_vv, and m_vvpnt.
OSInstance * OSRouteSolver::getInitialRestrictedMaster | ( | ) |
Definition at line 1026 of file OSRouteSolver.cpp.
Referenced by OSColGenApp::getInitialRestrictedMaster().
OSInstance * OSRouteSolver::getSeparationInstance | ( | ) |
Definition at line 1696 of file OSRouteSolver.cpp.
References OSInstance::addConstraint(), OSInstance::addObjective(), OSInstance::addVariable(), OSInstance::getConstraintLowerBounds(), OSInstance::getConstraintNames(), OSInstance::getConstraintNumber(), OSInstance::getConstraintUpperBounds(), OSInstance::getDenseObjectiveCoefficients(), OSInstance::getLinearConstraintCoefficientNumber(), OSInstance::getLinearConstraintCoefficientsInColumnMajor(), OSInstance::getLinearConstraintCoefficientsInRowMajor(), OSInstance::getVariableLowerBounds(), OSInstance::getVariableNames(), OSInstance::getVariableNumber(), OSInstance::getVariableUpperBounds(), SparseMatrix::indexes, SparseVector::indexes, m_osinstanceSeparation, makeStringFromInt(), OSInstance::printModel(), OSInstance::setConstraintNumber(), OSInstance::setInstanceDescription(), OSInstance::setLinearConstraintCoefficients(), OSInstance::setObjectiveNumber(), OSInstance::setVariableNumber(), SparseMatrix::starts, SparseMatrix::values, and SparseVector::values.
Referenced by OSRouteSolver().
double OSRouteSolver::qrouteCost | ( | const int & | k, | |
const int & | l, | |||
const double * | c, | |||
int * | kountVar | |||
) |
kipp -- document
Definition at line 483 of file OSRouteSolver.cpp.
Referenced by getColumns(), and getOptL().
void OSRouteSolver::getOptL | ( | const double * | c | ) |
Definition at line 351 of file OSRouteSolver.cpp.
References d1, m_numHubs, m_optD, m_optL, m_totalDemand, m_upperBoundL, m_vv, m_vvpnt, OSDBL_MAX, and qrouteCost().
Referenced by getColumns().
void OSRouteSolver::getCuts | ( | const double * | x | ) |
Definition at line 1507 of file OSRouteSolver.cpp.
void OSRouteSolver::getColumns | ( | const double * | y, | |
const int | numRows, | |||
int & | numColumns, | |||
int * | numNonz, | |||
double * | cost, | |||
double * | rcost, | |||
int ** | rowIdx, | |||
double ** | values, | |||
double & | lowerBound | |||
) |
RETURN VALUES: int numColumns -- number of new columns generated int* numNonz -- number of nonzeros in each column double* cost -- the objective function coefficient on each new column double* rcost -- the reduced cost of each new column double** rowIdx -- vectors row indexes of new columns double** values -- vectors of matrix coefficient values of new columns double lowerBound -- the lowerBound.
INPUT: double* y -- the vector of dual values int numRows -- size of dual vector
int ivalue; int jvalue; for(j = 0; j < kountVar; j++){
startPntInc = k*m_upperBoundL*(m_numNodes*m_numNodes - m_numNodes) + (m_optL[ k] - 1)*(m_numNodes*m_numNodes - m_numNodes);
std::cout << "Variable Index = " << m_varIdx[ j] - startPntInc ; std::cout << " Variable = " << m_variableNames[ m_varIdx[ j] - startPntInc ] << std::endl ;
tmp -- get the node
tmp = fmod(m_varIdx[ j] - startPntInc, m_numNodes) ;
ivalue = floor( (m_varIdx[ j] - startPntInc)/(m_numNodes - 1) ); jvalue = (m_varIdx[ j] - startPntInc) - ivalue*(m_numNodes - 1); std::cout << " i NODE NUMBER = " << ivalue ;
if( jvalue > ivalue ){
std::cout << " j NODE NUMBER = " << jvalue + 1 << std::endl; }else{
std::cout << " j NODE NUMBER = " << jvalue << std::endl; }
}
std::cout << "Route True Cost = " << m_costVec[ k] << std::endl;
Definition at line 805 of file OSRouteSolver.cpp.
References calcReducedCost(), ErrorClass::errormsg, getOptL(), m_Amatrix, m_cost, m_costVec, m_lowerBnd, m_newColumnRowIdx, m_newColumnRowValue, m_nonzVec, m_numHubs, m_numThetaNonz, m_numThetaVar, m_optL, m_optValHub, m_phi, m_pntAmatrix, m_psi, m_rc, m_thetaCost, m_thetaIndex, m_thetaPnt, m_tmpScatterArray, m_totalDemand, m_upperBoundL, m_varIdx, and qrouteCost().
Referenced by OSColGenApp::getColumns().
void OSRouteSolver::getOptions | ( | OSOption * | osoption | ) |
Definition at line 1313 of file OSRouteSolver.cpp.
References OSOption::getSolverOptions(), m_demand, m_initOSiLFile, m_initSolMap, m_minDemand, m_numberOfSolutions, m_routeCapacity, m_totalDemand, and osoption.
Referenced by OSRouteSolver().
void OSRouteSolver::calcReducedCost | ( | double ** | c, | |
double * | phi, | |||
double * | d | |||
) |
calculate the reduced costs c -- input of the objective function costs phi -- dual values on node assignment d -- reduced with convexity dual value
Definition at line 1512 of file OSRouteSolver.cpp.
References m_rc, and m_upperBoundL.
Referenced by getColumns().
void OSRouteSolver::createVariableNames | ( | ) |
Definition at line 1555 of file OSRouteSolver.cpp.
References m_variableNames, and makeStringFromInt().
Referenced by OSRouteSolver().
void OSRouteSolver::createAmatrix | ( | ) |
Definition at line 1592 of file OSRouteSolver.cpp.
References m_Amatrix, and m_pntAmatrix.
Referenced by OSRouteSolver().
void OSRouteSolver::pauHana | ( | const double * | theta | ) |
Definition at line 1641 of file OSRouteSolver.cpp.
References m_thetaCost.
Referenced by OSColGenApp::solveRestrictedMasterRelaxation().
std::string OSRouteSolver::m_initOSiLFile |
std::map<int, std::map<int, std::vector<int> > > OSRouteSolver::m_initSolMap |
Definition at line 41 of file OSRouteSolver.h.
Definition at line 42 of file OSRouteSolver.h.
Referenced by getColumns(), getOptL(), OSRouteSolver(), and ~OSRouteSolver().
Definition at line 46 of file OSRouteSolver.h.
Referenced by getOptions(), OSRouteSolver(), and ~OSRouteSolver().
double** OSRouteSolver::m_cost |
the distance/cost vectors
Definition at line 51 of file OSRouteSolver.h.
Referenced by getColumns(), OSRouteSolver(), and ~OSRouteSolver().
double* OSRouteSolver::m_rc |
the reduced cost vector we asssume order is (k, l, i, j)
Definition at line 56 of file OSRouteSolver.h.
Referenced by calcReducedCost(), getColumns(), OSRouteSolver(), and ~OSRouteSolver().
double* OSRouteSolver::m_psi |
the dual vector on convexity row see the paper for notation
Definition at line 61 of file OSRouteSolver.h.
Referenced by getColumns(), OSRouteSolver(), and ~OSRouteSolver().
double* OSRouteSolver::m_phi |
the dual vector on node assignments row see the paper for notation
Definition at line 65 of file OSRouteSolver.h.
Referenced by getColumns(), OSRouteSolver(), and ~OSRouteSolver().
double* OSRouteSolver::m_optValHub |
Definition at line 68 of file OSRouteSolver.h.
Referenced by getColumns(), OSRouteSolver(), OSColGenApp::solveRestrictedMasterRelaxation(), and ~OSRouteSolver().
double** OSRouteSolver::m_u |
double** OSRouteSolver::m_v |
int** OSRouteSolver::m_px |
int** OSRouteSolver::m_tx |
double** OSRouteSolver::m_g |
Definition at line 77 of file OSRouteSolver.h.
Referenced by getColumns(), OSRouteSolver(), and ~OSRouteSolver().
Definition at line 82 of file OSRouteSolver.h.
Referenced by getColumns(), getOptL(), OSRouteSolver(), and ~OSRouteSolver().
Definition at line 83 of file OSRouteSolver.h.
Referenced by getOptL(), OSRouteSolver(), and ~OSRouteSolver().
double** OSRouteSolver::m_vv |
Definition at line 84 of file OSRouteSolver.h.
Referenced by getOptL(), OSRouteSolver(), and ~OSRouteSolver().
int** OSRouteSolver::m_vvpnt |
Definition at line 85 of file OSRouteSolver.h.
Referenced by getOptL(), OSRouteSolver(), and ~OSRouteSolver().
Definition at line 89 of file OSRouteSolver.h.
Referenced by getColumns(), getOptions(), getOptL(), and OSRouteSolver().
Definition at line 90 of file OSRouteSolver.h.
Referenced by calcReducedCost(), getColumns(), getOptL(), and OSRouteSolver().
std::string* OSRouteSolver::m_variableNames |
Definition at line 96 of file OSRouteSolver.h.
Referenced by createVariableNames(), OSRouteSolver(), and ~OSRouteSolver().
Definition at line 99 of file OSRouteSolver.h.
Referenced by createAmatrix(), getColumns(), OSRouteSolver(), and ~OSRouteSolver().
Definition at line 100 of file OSRouteSolver.h.
Referenced by createAmatrix(), getColumns(), OSRouteSolver(), and ~OSRouteSolver().
Definition at line 104 of file OSRouteSolver.h.
Referenced by getColumns(), OSRouteSolver(), and ~OSRouteSolver().
double OSRouteSolver::m_lowerBnd |
Definition at line 108 of file OSRouteSolver.h.
Referenced by getColumns(), OSRouteSolver(), OSColGenApp::solveRestrictedMasterRelaxation(), and ~OSRouteSolver().
double* OSRouteSolver::m_costVec |
Definition at line 109 of file OSRouteSolver.h.
Referenced by getColumns(), OSRouteSolver(), OSColGenApp::solveRestrictedMasterRelaxation(), and ~OSRouteSolver().
Definition at line 111 of file OSRouteSolver.h.
Referenced by getColumns(), OSRouteSolver(), OSColGenApp::solveRestrictedMasterRelaxation(), and ~OSRouteSolver().
double** OSRouteSolver::m_newColumnRowValue |
Definition at line 112 of file OSRouteSolver.h.
Referenced by getColumns(), OSRouteSolver(), OSColGenApp::solveRestrictedMasterRelaxation(), and ~OSRouteSolver().
Definition at line 115 of file OSRouteSolver.h.
Referenced by getColumns(), OSRouteSolver(), and ~OSRouteSolver().
Definition at line 116 of file OSRouteSolver.h.
Referenced by getColumns(), OSRouteSolver(), and ~OSRouteSolver().
Definition at line 117 of file OSRouteSolver.h.
Referenced by getColumns(), OSRouteSolver(), and OSColGenApp::solveRestrictedMasterRelaxation().
double* OSRouteSolver::m_thetaCost |
Definition at line 119 of file OSRouteSolver.h.
Referenced by getColumns(), OSRouteSolver(), pauHana(), and ~OSRouteSolver().
Definition at line 124 of file OSRouteSolver.h.