OSBearcatSolverXij Class Reference

#include <OSBearcatSolverXij.h>

Inheritance diagram for OSBearcatSolverXij:
Inheritance graph
[legend]
Collaboration diagram for OSBearcatSolverXij:
Collaboration graph
[legend]

List of all members.

Classes

class  Factory

Public Member Functions

virtual OSInstancegetInitialRestrictedMaster ()
 OSInstance* OSBearcatSolverXij::getInitialRestrictedMaster( ){.
OSInstancegetSeparationInstance ()
double qrouteCost (const int &k, const int &l, const double *c, int *kountVar)
 kipp -- document
void getOptL (double **c)
void getCutsTheta (const double *thetaVar, const int numThetaVar, int &numNewRows, int *&numNonz, int **&colIdx, double **&values, double *&rowLB, double *&rowUB)
 RETURN VALUES: int numNewRows -- number of new rows generated int* numNonz -- number of nonzeros in each row int** colIdx -- vectors column indexes of new rows double** values -- vectors of matrix coefficient values of new rows double* rowLB -- vector of row lower bounds double* rowUB -- vector of row upper bounds.
void getCutsX (const double *xVar, const int numXVar, int &numNewRows, int *&numNonz, int **&colIdx, double **&values, double *&rowLB, double *&rowUB)
 RETURN VALUES: int numNewRows -- number of new rows generated int* numNonz -- number of nonzeros in each row int** colIdx -- vectors column indexes of new rows double** values -- vectors of matrix coefficient values of new rows double* rowLB -- vector of row lower bounds double* rowUB -- vector of row upper bounds.
virtual void getBranchingCut (const double *thetaVar, const int numThetaVar, const std::map< int, int > &varConMap, int &varIdx, int &numNonz, int *&indexes, double *&values)
 RETURN VALUES: varIdx -- the variable number x_{ij} for branching numNonz -- number of theta indexes in the cut indexes -- the indexes of the theta variables values -- the number of times the theta indexed in indexes appears in the cut note -- set numNonz to zero if the generated cut variable already appears in varConMap.
virtual void getBranchingCut (const int *thetaIdx, const double *theta, const int numThetaVar, const std::map< int, int > &varConMap, int &varIdx, int &numNonz, int *&indexes, double *&values)
 Sparse Version.
void getCutsMultiCommod (const double *thetaVar, const int numThetaVar, int &numNewRows, int *&numNonz, int **&colIdx, double **&values, double *&rowLB, double *&rowUB)
 This is the routine that generates the multi-item cuts.
int getBranchingVar (const double *theta, const int numThetaVar)
 RETURN VALUES: return the integer index of a fractional x_{ij} variable.
int getBranchingVar (const int *thetaIdx, const double *theta, const int numThetaVar)
 Sparse Version.
virtual void getColumns (const double *yA, const int numARows, const double *yB, const int numBRows, int &numNewColumns, int *&numNonz, double *&cost, int **&rowIdx, double **&values, double &lowerBound)
 RETURN VALUES: int numNewColumns -- number of new columns generated int* numNonz -- number of nonzeros in each column double* cost -- the objective function coefficient on 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, this is a value on the LP relaxation.
void getOptions (OSOption *osoption)
void getVariableIndexMap ()
 this method will populate: std::map<std::pair<int, int>,int>m_xVarIndexMap this gives us
void permuteHubs ()
 this method will calculate a permuation of the hubs so that they are in ascending order, this will make the dynamic program in the v variables faster
void calcReducedCost (const double *yA, const double *yB)
 calculate the reduced costs c -- input of the objective function costs yA -- dual values on node assignment -- coupling constraints yB -- dual values on tour breaking constraints d -- reduced with convexity dual value
void createVariableNames ()
void createAmatrix ()
virtual void initializeDataStructures ()
 allocate memory and initialize arrays
void getInitialSolution ()
 generate an intitial feasible solution in theta space for the initial master
virtual void resetMaster (std::map< int, int > &inVars, OsiSolverInterface *si)
 INPUT:.
double getRouteDistance (int numNodes, int hubIndex, CoinSolver *solver, std::vector< int > zk, double *xVar)
 call this method to get a minimum TSP tour for a given assignment of nodes to routes INPUT: int numNodes -- number of cities/nodes in tour int hubIndex -- indexes the hub index CoinSolver* solver -- the coin solver numNodes*numNodes - numNodes entries, we are assuming zk -- indexes the non-hub nodes assigned this route asymmetric
CoinSolvergetTSP (int numNodes, double *cost)
 call this method to get a TSP instance
CoinSolvergetMultiCommodInstance (int hubIndex)
 call this method to get an instance that is used to generate a multicommodity cut
void getFeasibleSolution ()
 call this method to get generate an instance of the generalized assignment problem and find a feasible solution to the problem
bool OneOPT ()
 try and find a feasible solution, return false if solution not feasible
virtual void pauHana (std::vector< int > &m_zOptIndexes, std::vector< double > &m_zRootLPx_vals, int numNodes, int numColsGen, std::string message)
double calcNonlinearRelax (std::vector< double > &m_zRootLPx_vals)
 calculate the nonlinear relaxation value for an LP solution
 OSBearcatSolverXij ()
 Default Constructor.
 OSBearcatSolverXij (OSOption *osoption)
 Second Constructor.
 ~OSBearcatSolverXij ()
 Default Destructor.

Public Attributes

std::map< int, std::string > m_tmpVarMap
std::map< std::pair< int, int >
, int > 
m_xVarIndexMap
 m_xVarIndexMap takes a variable indexed by (i,j) and returns the index of the variable in one dimension
int * m_hubPoint
 m_hubPoint[ k] points to the the k'th hub that we use in getOptL
std::string m_initOSiLFile
std::map< int, std::map< int,
std::vector< int > > > 
m_initSolMap
 the index on the outer map is on the solution number, the index on the inner map indexes the route number, the vector is the list of nodes assigned to that route
std::vector< CoinSolver * > m_multCommodCutSolvers
 m_multCommodCutSolvers is a vector of solvers, one solver for each hub, used to find multicommodity flow cuts for the given hub
bool m_use1OPTstart
 if m_use1OPTstart is true we use the option file to fix the nodes to hubs found by SK's 1OPT heuristic
int m_maxThetaNonz
 m_maxMasterNonz is the maximumn number of nonzero elements we allow in the transformation matrix betwee the theta variables and the xij variables
int * m_routeCapacity
 the route capacity -- bus seating limit this can vary with the route/hub
int * m_routeMinPickup
 the minimum number of students that we pickup on a route this can vary with the route/hub
int * m_upperBoundL
 largest possible L-value on a route -- this will be the minimum of m_routeCapacity and total demand
int * m_lowerBoundL
 smallest possible L-value on a route for now this will equal
int m_upperBoundLMax
 largest possible L-value over all routes
int m_minDemand
 m_minDemand is the value of the minimum demand node -- it is not the minimum demand that must be carried on a route
int * m_demand
 m_demand is the vector of node demands
std::string * m_nodeName
 m_nodeName is the vector of node names
double * m_cost
 the distance/cost vectors
bool m_costSetInOption
 m_costSetInOption is true if the costs are set using the OSOption file
double ** m_rc
 the reduced cost vector for each k, we asssume order is (l, i, j)
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_numberOfSolutions
int * m_tmpScatterArray
double m_lowerBnd
int * m_newColumnNonz
double * m_costVec
int ** m_newColumnRowIdx
double ** m_newColumnRowValue
int * m_newRowNonz
int ** m_newRowColumnIdx
double ** m_newRowColumnValue
double * m_newRowUB
double * m_newRowLB
int * branchCutIndexes
double * branchCutValues
double * m_thetaCost
int * m_convexityRowIndex
 m_convexityRowIndex holds the index of the convexity row that the theta columns are in.
int * m_BmatrixRowIndex
 m_BmatrixRowIndex holds the index of the convexity row that the constraint corresponds to, this is for the multicommodity constraints -- if the constraint applies to theta regardless of k, then the value is -1
int * m_separationIndexMap
 m_separationIndexMap maps the variable index into the appropriate row in the separation problem for the tour breaking constraints
OSInstancem_osinstanceSeparation
ClpSimplex * m_separationClpModel

Detailed Description

Definition at line 31 of file OSBearcatSolverXij.h.


Constructor & Destructor Documentation

OSBearcatSolverXij::OSBearcatSolverXij (  ) 

Default Constructor.

Definition at line 68 of file OSBearcatSolverXij.cpp.

OSBearcatSolverXij::OSBearcatSolverXij ( OSOption osoption  ) 

Second Constructor.

Definition at line 72 of file OSBearcatSolverXij.cpp.

OSBearcatSolverXij::~OSBearcatSolverXij (  ) 

Default Destructor.

Definition at line 360 of file OSBearcatSolverXij.cpp.


Member Function Documentation

OSInstance * OSBearcatSolverXij::getInitialRestrictedMaster (  )  [virtual]

OSInstance* OSBearcatSolverXij::getInitialRestrictedMaster( ){.

std::cout << "Executing OSBearcatSolverXij::getInitialRestrictedMaster( )" << std::endl;

define the classes FileUtil *fileUtil = NULL; OSiLReader *osilreader = NULL; DefaultSolver *solver = NULL; OSInstance *osinstance = NULL;

end classes

std::string testFileName; std::string osil;

std::vector< int> indexes; fileUtil = new FileUtil();

std::map<int, std::map<int, std::vector<int> > >iterator mit; std::map<int, std::vector<int> >iterator mit2; std::vector<int>::iterator vit;

m_osinstanceMaster = NULL;

add linear constraint coefficients number of values will nodes.size() the coefficients in the node constraints plus coefficients in convexity constraints which is the number of varaibles int kountNonz; int kount; int numThetaVar = m_numberOfSolutions*m_numHubs; double *values = new double[ m_numberOfSolutions*(m_numNodes-m_numHubs) + numThetaVar]; int *indexes = new int[ m_numberOfSolutions*(m_numNodes-m_numHubs) + numThetaVar]; int *starts = new int[ numThetaVar + 1]; kount = 0;

starts[ 0] = 0;

int startsIdx; startsIdx = 0;

std::vector<IndexValuePair*> primalValPair;

try {

if(m_initOSiLFile.size() == 0) throw ErrorClass("OSiL file to generate restricted master missing"); osil = fileUtil->getFileAsString( m_initOSiLFile.c_str());

osilreader = new OSiLReader(); osinstance = osilreader->readOSiL(osil);

int i; int j; int k; fill in the cost vector first the x vector starts at 2*m_numHubs

int idx1; int idx2;

idx2 = 0; //zRouteDemand have 0 coefficients in obj fill in m_cost from the cost coefficient in osil for(k = 0; k < m_numHubs; k++){

idx1 = 0;

for(i = 0; i < m_numNodes; i++){

for(j = 0; j < i; j++){

m_cost[k][idx1++ ] = osinstance->instanceData->objectives->obj[0]->coef[ idx2++ ]->value; }

for(j = i + 1; j < m_numNodes; j++){

m_cost[k][idx1++ ] = osinstance->instanceData->objectives->obj[0]->coef[ idx2++ ]->value;

} } }

get variable names for checking purposes std::string* varNames; varNames = osinstance->getVariableNames();

start building the restricted master here

m_osinstanceMaster = new OSInstance(); m_osinstanceMaster->setInstanceDescription("The Initial Restricted Master");

first the variables m_osinstanceMaster->setVariableNumber( m_numberOfSolutions*m_numHubs);

now add the objective function m_osinstanceMaster->setObjectiveNumber( 1); SparseVector *objcoeff = new SparseVector( m_numberOfSolutions*m_numHubs);

now the constraints m_osinstanceMaster->setConstraintNumber( m_numNodes);

addVariable(int index, string name, double lowerBound, double upperBound, char type, double init, string initString); we could use setVariables() and add all the variable with one method call -- below is easier

int varNumber; varNumber = 0; std::string masterVarName; kountNonz = 0; now get the primal solution solve the model for solution in the osoption object for ( mit = m_initSolMap.begin() ; mit != m_initSolMap.end(); mit++ ){

kipp change upper and lower bounds here on z variables loop over nodes and routes and set bound set kount to the start of the z variables go past the x variables kount = 2*m_numHubs + m_numHubs*(m_numNodes*m_numNodes - m_numNodes); osinstance->bVariablesModified = true; for ( mit2 = mit->second.begin() ; mit2 != mit->second.end(); mit2++ ){ //we are looping over routes in solution mit

startsIdx++; starts[ startsIdx ] = kountNonz + mit2->second.size() + 1; //the +1 comes from the convexity row

make sure all lower bounds on z variables on this route back to 0.0 for(i = 0; i < m_numNodes; i++){ osinstance->instanceData->variables->var[ kount + mit2->first*m_numNodes + i]->lb = 0.0; }

for ( vit = mit2->second.begin() ; vit != mit2->second.end(); vit++ ){

osinstance->instanceData->variables->var[ kount + mit2->first*m_numNodes + *vit]->lb = 1.0; std::cout << "FIXING LOWER BOUND ON VARIABLE " << osinstance->getVariableNames()[ kount + mit2->first*m_numNodes + *vit ] << std::endl;

values[ kountNonz] = 1.0; indexes[ kountNonz ] = *vit - m_numHubs ; //0 based counting kountNonz++;

}

now for the convexity row coefficient values[ kountNonz] = 1; indexes[ kountNonz ] = m_numNodes - m_numHubs + mit2->first ; kountNonz++;

}

solver = new CoinSolver(); solver->sSolverName ="cbc"; solver->osinstance = osinstance;

solver->buildSolverInstance(); solver->solve();

get the solver solution status

std::cout << "Solution Status = " << solver->osresult->getSolutionStatusType( 0 ) << std::endl;

get the optimal objective function value

primalValPair = solver->osresult->getOptimalPrimalVariableValues( 0);

loop over routes again to create master objective coefficients

for(k = 0; k < m_numHubs; k++){

lets get the x variables the variables for this route should be from 2*numHubs + k*(numNodes - 1*)*(numNodes - 1) idx1 = 2*m_numHubs + k*m_numNodes*(m_numNodes - 1); idx2 = idx1 + m_numNodes*(m_numNodes - 1); end of x variables

std::cout << "HUB " << k << " VARIABLES" << std::endl;

for(i = idx1; i < idx2; i++){ if( primalValPair[ i]->value > .1 ){ std::cout << osinstance->getVariableNames()[ primalValPair[ i]->idx ] << std::endl; std::cout << m_variableNames[ primalValPair[ i]->idx - k*(m_numNodes - 1)*m_numNodes - 2*m_numHubs ] << std::endl; m_thetaIndex[ m_numThetaNonz++ ] = primalValPair[ i]->idx - k*(m_numNodes - 1)*m_numNodes - 2*m_numHubs; }

} m_convexityRowIndex[ m_numThetaVar] = k; m_thetaCost[ m_numThetaVar++ ] = primalValPair[ k]->value*primalValPair[ k + m_numHubs]->value; m_thetaPnt[ m_numThetaVar ] = m_numThetaNonz;

masterVarName = makeStringFromInt("theta(", k); masterVarName += makeStringFromInt(",", mit->first); masterVarName += ")"; intVarSet.insert ( std::pair<int,double>(varNumber, 1.0) ); m_osinstanceMaster->addVariable(varNumber++, masterVarName, 0, 1, 'C');

std::cout << "Optimal Objective Value = " << primalValPair[ k]->value*primalValPair[ k + m_numHubs]->value << std::endl;

objcoeff->indexes[ k + (mit->first)*m_numHubs] = k + (mit->first)*m_numHubs; objcoeff->values[ k + (mit->first)*m_numHubs] = primalValPair[ k]->value*primalValPair[ k + m_numHubs]->value;

std::cout << osinstance->getVariableNames()[ k ] << std::endl; std::cout << osinstance->getVariableNames()[ k + m_numHubs ] << std::endl;

}//end for on k -- hubs

primalValPair.clear(); delete solver; solver = NULL; }//end for on number of solutions

add the constraints add the row saying we must visit each node for( i = 0; i < m_numNodes - m_numHubs ; i++){

m_osinstanceMaster->addConstraint(i, makeStringFromInt("visitNode_", i + m_numHubs) , 1.0, 1.0, 0); }

kount = 0;

add the convexity row for( i = m_numNodes - m_numHubs; i < m_numNodes ; i++){

m_osinstanceMaster->addConstraint(i, makeStringFromInt("convexityRowRoute_", kount++ ) , 1.0, 1.0, 0); }

m_osinstanceMaster->addObjective(-1, "objfunction", "min", 0.0, 1.0, objcoeff);

std::cout << "kountNonz = " << kountNonz << std::endl;

add the linear constraints coefficients m_osinstanceMaster->setLinearConstraintCoefficients(kountNonz , true, values, 0, kountNonz - 1, indexes, 0, kountNonz - 1, starts, 0, startsIdx);

std::cout << m_osinstanceMaster->printModel() << std::endl; delete objcoeff;

delete[] values; delete[] starts; delete[] indexes; delete osilreader; osilreader = NULL;

} catch (const ErrorClass& eclass) { std::cout << std::endl << std::endl << std::endl; if (osilreader != NULL) delete osilreader; if (solver != NULL) delete solver;

Problem with the parser throw ErrorClass(eclass.errormsg); }

delete fileUtil; fileUtil = NULL;

return m_osinstanceMaster; }//end generateInitialRestrictedMaster

Implements OSDecompSolver.

Definition at line 1632 of file OSBearcatSolverXij.cpp.

OSInstance * OSBearcatSolverXij::getSeparationInstance (  ) 

Definition at line 3775 of file OSBearcatSolverXij.cpp.

double OSBearcatSolverXij::qrouteCost ( const int &  k,
const int &  l,
const double *  c,
int *  kountVar 
)

kipp -- document

Definition at line 727 of file OSBearcatSolverXij.cpp.

void OSBearcatSolverXij::getOptL ( double **  c  ) 

Definition at line 570 of file OSBearcatSolverXij.cpp.

void OSBearcatSolverXij::getCutsTheta ( const double *  thetaVar,
const int  numThetaVar,
int &  numNewRows,
int *&  numNonz,
int **&  colIdx,
double **&  values,
double *&  rowLB,
double *&  rowUB 
) [virtual]

RETURN VALUES: int numNewRows -- number of new rows generated int* numNonz -- number of nonzeros in each row int** colIdx -- vectors column indexes of new rows double** values -- vectors of matrix coefficient values of new rows double* rowLB -- vector of row lower bounds double* rowUB -- vector of row upper bounds.

INPUT: double* thetaVar -- the vector of primal master values int numThetaVar -- size of master primal vector

Implements OSDecompSolver.

Definition at line 2175 of file OSBearcatSolverXij.cpp.

void OSBearcatSolverXij::getCutsX ( const double *  xVar,
const int  numXVar,
int &  numNewRows,
int *&  numNonz,
int **&  colIdx,
double **&  values,
double *&  rowLB,
double *&  rowUB 
)

RETURN VALUES: int numNewRows -- number of new rows generated int* numNonz -- number of nonzeros in each row int** colIdx -- vectors column indexes of new rows double** values -- vectors of matrix coefficient values of new rows double* rowLB -- vector of row lower bounds double* rowUB -- vector of row upper bounds.

INPUT: double* xVar -- the vector of primal values int numXVar -- size of master primal vector

Definition at line 3123 of file OSBearcatSolverXij.cpp.

void OSBearcatSolverXij::getBranchingCut ( const double *  thetaVar,
const int  numThetaVar,
const std::map< int, int > &  varConMap,
int &  varIdx,
int &  numNonz,
int *&  indexes,
double *&  values 
) [virtual]

RETURN VALUES: varIdx -- the variable number x_{ij} for branching numNonz -- number of theta indexes in the cut indexes -- the indexes of the theta variables values -- the number of times the theta indexed in indexes appears in the cut note -- set numNonz to zero if the generated cut variable already appears in varConMap.

INPUT: double* thetaVar -- the vector of primal master values int numThetaVar -- size of master primal vector varConMap -- the map of variables in x_{ij} space to a consraint number

Implements OSDecompSolver.

Definition at line 4305 of file OSBearcatSolverXij.cpp.

void OSBearcatSolverXij::getBranchingCut ( const int *  thetaIdx,
const double *  theta,
const int  numThetaVar,
const std::map< int, int > &  varConMap,
int &  varIdx,
int &  numNonz,
int *&  indexes,
double *&  values 
) [virtual]

Sparse Version.

RETURN VALUES: varIdx -- the variable number x_{ij} for branching numNonz -- number of theta indexes in the cut indexes -- the indexes of the theta variables values -- the number of times the theta indexed in indexes appears in the cut note -- set numNonz to zero if the generated cut variable already appears in varConMap

INPUT: double* theta -- the vector of primal master values int numThetaVar -- size of master primal vector varConMap -- the map of variables in x_{ij} space to a consraint number

Implements OSDecompSolver.

Definition at line 4387 of file OSBearcatSolverXij.cpp.

void OSBearcatSolverXij::getCutsMultiCommod ( const double *  thetaVar,
const int  numThetaVar,
int &  numNewRows,
int *&  numNonz,
int **&  colIdx,
double **&  values,
double *&  rowLB,
double *&  rowUB 
) [virtual]

This is the routine that generates the multi-item cuts.

RETURN VALUES: int numNewRows -- number of new rows generated int* numNonz -- number of nonzeros in each row int** colIdx -- vectors column indexes of new rows double** values -- vectors of matrix coefficient values of new rows double* rowLB -- vector of row lower bounds double* rowUB -- vector of row upper bounds

INPUT: double* thetaVar -- the vector of primal master values int numThetaVar -- size of master primal vector

kount = 0; for(i = 0; i < m_numNodes; i++){

for(j = 0; j < i; j++){ //j < i

indexPair.first = i; indexPair.second = j; xVarIndexMap[ indexPair] = kount; kount++; }

for(j = i+1; j < m_numNodes; j++){ // i < j

indexPair.first = i; indexPair.second = j; xVarIndexMap[ indexPair] = kount; kount++; } } end construct map

Implements OSDecompSolver.

Definition at line 2557 of file OSBearcatSolverXij.cpp.

int OSBearcatSolverXij::getBranchingVar ( const double *  theta,
const int  numThetaVar 
)

RETURN VALUES: return the integer index of a fractional x_{ij} variable.

INPUT: double* theta -- the vector of primal master values int numThetaVar -- size of master primal vector

Definition at line 4019 of file OSBearcatSolverXij.cpp.

int OSBearcatSolverXij::getBranchingVar ( const int *  thetaIdx,
const double *  theta,
const int  numThetaVar 
)

Sparse Version.

RETURN VALUES: return the integer index of a fractional x_{ij} variable

INPUT: int* thetaIdx -- index vector of nonzero theta variables double* theta -- the sparse vector of primal master values int numThetaVar -- size of master primal vector

Definition at line 4160 of file OSBearcatSolverXij.cpp.

void OSBearcatSolverXij::getColumns ( const double *  yA,
const int  numARows,
const double *  yB,
const int  numBRows,
int &  numNewColumns,
int *&  numNonz,
double *&  cost,
int **&  rowIdx,
double **&  values,
double &  lowerBound 
) [virtual]

RETURN VALUES: int numNewColumns -- number of new columns generated int* numNonz -- number of nonzeros in each column double* cost -- the objective function coefficient on 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, this is a value on the LP relaxation.

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;

Implements OSDecompSolver.

Definition at line 1074 of file OSBearcatSolverXij.cpp.

void OSBearcatSolverXij::getOptions ( OSOption osoption  ) 

Definition at line 1849 of file OSBearcatSolverXij.cpp.

void OSBearcatSolverXij::getVariableIndexMap (  ) 

this method will populate: std::map<std::pair<int, int>,int>m_xVarIndexMap this gives us

Definition at line 6104 of file OSBearcatSolverXij.cpp.

void OSBearcatSolverXij::permuteHubs (  ) 

this method will calculate a permuation of the hubs so that they are in ascending order, this will make the dynamic program in the v variables faster

Definition at line 6135 of file OSBearcatSolverXij.cpp.

void OSBearcatSolverXij::calcReducedCost ( const double *  yA,
const double *  yB 
)

calculate the reduced costs c -- input of the objective function costs yA -- dual values on node assignment -- coupling constraints yB -- dual values on tour breaking constraints d -- reduced with convexity dual value

Definition at line 3341 of file OSBearcatSolverXij.cpp.

void OSBearcatSolverXij::createVariableNames (  ) 

Definition at line 3438 of file OSBearcatSolverXij.cpp.

void OSBearcatSolverXij::createAmatrix (  ) 

Definition at line 3479 of file OSBearcatSolverXij.cpp.

void OSBearcatSolverXij::initializeDataStructures (  )  [virtual]

allocate memory and initialize arrays

m_u[i, l] -- this will be the minimum cost of reaching node i on a q-route with demand l, note that m_u[ i] has dimension m_upperBoundL + 1 so the possible values for l are l = 0, 1, , m_upperBoundL -- l is the actual value of demand

Implements OSDecompSolver.

Definition at line 112 of file OSBearcatSolverXij.cpp.

void OSBearcatSolverXij::getInitialSolution (  ) 

generate an intitial feasible solution in theta space for the initial master

Definition at line 4473 of file OSBearcatSolverXij.cpp.

void OSBearcatSolverXij::resetMaster ( std::map< int, int > &  inVars,
OsiSolverInterface *  si 
) [virtual]

INPUT:.

Parameters:
dstd::map<int,int> &inVars -- the mapping of variables, the first index is the variable number before resetting, the second index is the variable number after the reset
OsiSolverInterface *si -- the solver interface that corresponds to the master this is what gets rebuilt

Implements OSDecompSolver.

Definition at line 4530 of file OSBearcatSolverXij.cpp.

double OSBearcatSolverXij::getRouteDistance ( int  numNodes,
int  hubIndex,
CoinSolver solver,
std::vector< int >  zk,
double *  xVar 
)

call this method to get a minimum TSP tour for a given assignment of nodes to routes INPUT: int numNodes -- number of cities/nodes in tour int hubIndex -- indexes the hub index CoinSolver* solver -- the coin solver numNodes*numNodes - numNodes entries, we are assuming zk -- indexes the non-hub nodes assigned this route asymmetric

OUTPUT: xVar the optimal solution

Definition at line 4909 of file OSBearcatSolverXij.cpp.

CoinSolver * OSBearcatSolverXij::getTSP ( int  numNodes,
double *  cost 
)

call this method to get a TSP instance

INPUT: int numNodes -- number of cities/nodes in tour double* cost -- the cost vector, this should have

RETURN: pointer to a CoinSolver with a TSP instance

Definition at line 5108 of file OSBearcatSolverXij.cpp.

CoinSolver * OSBearcatSolverXij::getMultiCommodInstance ( int  hubIndex  ) 

call this method to get an instance that is used to generate a multicommodity cut

INPUT: hubIndex is the index associated with the hub for which we are looking for a cut RETURN: pointer to a CoinSolver with a cut generator instance

Definition at line 5610 of file OSBearcatSolverXij.cpp.

void OSBearcatSolverXij::getFeasibleSolution (  ) 

call this method to get generate an instance of the generalized assignment problem and find a feasible solution to the problem

INPUT:

RETURN: void

Definition at line 5891 of file OSBearcatSolverXij.cpp.

bool OSBearcatSolverXij::OneOPT (  ) 

try and find a feasible solution, return false if solution not feasible

Definition at line 5315 of file OSBearcatSolverXij.cpp.

void OSBearcatSolverXij::pauHana ( std::vector< int > &  m_zOptIndexes,
std::vector< double > &  m_zRootLPx_vals,
int  numNodes,
int  numColsGen,
std::string  message 
) [virtual]

Implements OSDecompSolver.

Definition at line 3528 of file OSBearcatSolverXij.cpp.

double OSBearcatSolverXij::calcNonlinearRelax ( std::vector< double > &  m_zRootLPx_vals  ) 

calculate the nonlinear relaxation value for an LP solution

Definition at line 3629 of file OSBearcatSolverXij.cpp.


Member Data Documentation

std::map<int, std::string> OSBearcatSolverXij::m_tmpVarMap

Definition at line 39 of file OSBearcatSolverXij.h.

std::map<std::pair<int, int>,int> OSBearcatSolverXij::m_xVarIndexMap

m_xVarIndexMap takes a variable indexed by (i,j) and returns the index of the variable in one dimension

Definition at line 44 of file OSBearcatSolverXij.h.

m_hubPoint[ k] points to the the k'th hub that we use in getOptL

Definition at line 50 of file OSBearcatSolverXij.h.

Definition at line 53 of file OSBearcatSolverXij.h.

std::map<int, std::map<int, std::vector<int> > > OSBearcatSolverXij::m_initSolMap

the index on the outer map is on the solution number, the index on the inner map indexes the route number, the vector is the list of nodes assigned to that route

Definition at line 59 of file OSBearcatSolverXij.h.

m_multCommodCutSolvers is a vector of solvers, one solver for each hub, used to find multicommodity flow cuts for the given hub

Definition at line 65 of file OSBearcatSolverXij.h.

if m_use1OPTstart is true we use the option file to fix the nodes to hubs found by SK's 1OPT heuristic

Definition at line 70 of file OSBearcatSolverXij.h.

m_maxMasterNonz is the maximumn number of nonzero elements we allow in the transformation matrix betwee the theta variables and the xij variables

Definition at line 76 of file OSBearcatSolverXij.h.

the route capacity -- bus seating limit this can vary with the route/hub

Definition at line 84 of file OSBearcatSolverXij.h.

the minimum number of students that we pickup on a route this can vary with the route/hub

Definition at line 90 of file OSBearcatSolverXij.h.

largest possible L-value on a route -- this will be the minimum of m_routeCapacity and total demand

Definition at line 98 of file OSBearcatSolverXij.h.

smallest possible L-value on a route for now this will equal

Definition at line 104 of file OSBearcatSolverXij.h.

largest possible L-value over all routes

Definition at line 107 of file OSBearcatSolverXij.h.

m_minDemand is the value of the minimum demand node -- it is not the minimum demand that must be carried on a route

Definition at line 113 of file OSBearcatSolverXij.h.

m_demand is the vector of node demands

Definition at line 116 of file OSBearcatSolverXij.h.

m_nodeName is the vector of node names

Definition at line 119 of file OSBearcatSolverXij.h.

the distance/cost vectors

Definition at line 122 of file OSBearcatSolverXij.h.

m_costSetInOption is true if the costs are set using the OSOption file

Definition at line 127 of file OSBearcatSolverXij.h.

the reduced cost vector for each k, we asssume order is (l, i, j)

Definition at line 132 of file OSBearcatSolverXij.h.

Definition at line 136 of file OSBearcatSolverXij.h.

Definition at line 140 of file OSBearcatSolverXij.h.

Definition at line 141 of file OSBearcatSolverXij.h.

Definition at line 142 of file OSBearcatSolverXij.h.

Definition at line 143 of file OSBearcatSolverXij.h.

Definition at line 144 of file OSBearcatSolverXij.h.

Definition at line 145 of file OSBearcatSolverXij.h.

Definition at line 150 of file OSBearcatSolverXij.h.

Definition at line 151 of file OSBearcatSolverXij.h.

Definition at line 152 of file OSBearcatSolverXij.h.

Definition at line 153 of file OSBearcatSolverXij.h.

Definition at line 157 of file OSBearcatSolverXij.h.

Definition at line 158 of file OSBearcatSolverXij.h.

Definition at line 163 of file OSBearcatSolverXij.h.

Definition at line 166 of file OSBearcatSolverXij.h.

Definition at line 167 of file OSBearcatSolverXij.h.

Definition at line 168 of file OSBearcatSolverXij.h.

Definition at line 169 of file OSBearcatSolverXij.h.

Definition at line 170 of file OSBearcatSolverXij.h.

Definition at line 173 of file OSBearcatSolverXij.h.

Definition at line 174 of file OSBearcatSolverXij.h.

Definition at line 175 of file OSBearcatSolverXij.h.

Definition at line 176 of file OSBearcatSolverXij.h.

Definition at line 177 of file OSBearcatSolverXij.h.

Definition at line 180 of file OSBearcatSolverXij.h.

Definition at line 181 of file OSBearcatSolverXij.h.

Definition at line 190 of file OSBearcatSolverXij.h.

m_convexityRowIndex holds the index of the convexity row that the theta columns are in.

If the theta is an artificial variable this value is -1

Definition at line 196 of file OSBearcatSolverXij.h.

m_BmatrixRowIndex holds the index of the convexity row that the constraint corresponds to, this is for the multicommodity constraints -- if the constraint applies to theta regardless of k, then the value is -1

Definition at line 204 of file OSBearcatSolverXij.h.

m_separationIndexMap maps the variable index into the appropriate row in the separation problem for the tour breaking constraints

Definition at line 211 of file OSBearcatSolverXij.h.

Definition at line 214 of file OSBearcatSolverXij.h.

Definition at line 217 of file OSBearcatSolverXij.h.


The documentation for this class was generated from the following files:

Generated on 22 May 2012 by  doxygen 1.6.1