13 #ifndef OSBEARCATSOLVERXIJ_H
14 #define OSBEARCATSOLVERXIJ_H
18 #include "OSInstance.h"
20 #include "ClpSimplex.hpp"
229 double qrouteCost(
const int&
k,
const int& l,
const double*
c,
int* kountVar) ;
248 void getCutsTheta(
const double* thetaVar,
const int numThetaVar,
249 int &numNewRows,
int* &numNonz,
int** &colIdx,
250 double** &
values,
double* &rowLB,
double* &rowUB) ;
266 void getCutsX(
const double* xVar,
const int numXVar,
267 int &numNewRows,
int* &numNonz,
int** &colIdx,
268 double** &
values,
double* &rowLB,
double* &rowUB) ;
289 virtual void getBranchingCut(
const double* thetaVar,
const int numThetaVar,
290 const std::map<int, int> &varConMap,
int &varIdx,
int &numNonz,
291 int* &indexes,
double* &
values) ;
317 const int numThetaVar,
const std::map<int, int> &varConMap,
318 int &varIdx,
int &numNonz,
int* &indexes,
double* &
values) ;
338 int &numNewRows,
int* &numNonz,
int** &colIdx,
339 double** &
values,
double* &rowLB,
double* &rowUB) ;
367 int getBranchingVar(
const int* thetaIdx,
const double* theta,
const int numThetaVar ) ;
383 virtual void getColumns(
const double* yA,
const int numARows,
384 const double* yB,
const int numBRows,
385 int &numNewColumns,
int* &numNonz,
double* &cost,
386 int** &rowIdx,
double** &
values,
double &lowerBound) ;
435 virtual void resetMaster( std::map<int, int> &inVars,
436 OsiSolverInterface *si );
507 virtual void pauHana(std::vector<int> &m_zOptIndexes,
508 std::vector<double> &m_zRootLPx_vals,
509 int numNodes,
int numColsGen, std::string message);
CoinSolver * getTSP(int numNodes, double *cost)
call this method to get a TSP instance
OSBearcatSolverXij()
Default Constructor.
virtual void initializeDataStructures()
allocate memory and initialize arrays
double ** m_rc
the reduced cost vector for each k, we asssume order is (l, i, j)
int * m_demand
m_demand is the vector of node demands
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 eac...
std::string m_initOSiLFile
int m_maxThetaNonz
m_maxMasterNonz is the maximumn number of nonzero elements we allow in the transformation matrix betw...
int m_minDemand
m_minDemand is the value of the minimum demand node – it is not the minimum demand that must be carri...
virtual void pauHana(std::vector< int > &m_zOptIndexes, std::vector< double > &m_zRootLPx_vals, int numNodes, int numColsGen, std::string message)
virtual OSInstance * getInitialRestrictedMaster()
OSInstance* OSBearcatSolverXij::getInitialRestrictedMaster( ){.
int * m_routeCapacity
the route capacity – bus seating limit this can vary with the route/hub
void getVariableIndexMap()
this method will populate: std::map<std::pair<int, int>,int>m_xVarIndexMap this gives us ...
void getFeasibleSolution()
call this method to get generate an instance of the generalized assignment problem and find a feasibl...
int * m_convexityRowIndex
m_convexityRowIndex holds the index of the convexity row that the theta columns are in...
CoinSolver * getMultiCommodInstance(int hubIndex)
call this method to get an instance that is used to generate a multicommodity cut ...
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 * m_hubPoint
m_hubPoint[ k] points to the the k'th hub that we use in getOptL
int * m_upperBoundL
largest possible L-value on a route – this will be the minimum of m_routeCapacity and total demand ...
ClpSimplex * m_separationClpModel
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...
int * m_routeMinPickup
the minimum number of students that we pickup on a route this can vary with the route/hub ...
int * m_separationIndexMap
m_separationIndexMap maps the variable index into the appropriate row in the separation problem for t...
OSInstance * getSeparationInstance()
double calcNonlinearRelax(std::vector< double > &m_zRootLPx_vals)
calculate the nonlinear relaxation value for an LP solution
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 dimensi...
double ** m_newRowColumnValue
virtual void resetMaster(std::map< int, int > &inVars, OsiSolverInterface *si)
INPUT:
int * m_BmatrixRowIndex
m_BmatrixRowIndex holds the index of the convexity row that the constraint corresponds to...
int getBranchingVar(const double *theta, const int numThetaVar)
RETURN VALUES: return the integer index of a fractional x_{ij} variable.
void getOptions(OSOption *osoption)
double * m_cost
the distance/cost vectors
bool OneOPT()
try and find a feasible solution, return false if solution not feasible
std::vector< CoinSolver * > m_multCommodCutSolvers
m_multCommodCutSolvers is a vector of solvers, one solver for each hub, used to find multicommodity f...
void createVariableNames()
void permuteHubs()
this method will calculate a permuation of the hubs so that they are in ascending order...
void calcReducedCost(const double *yA, const double *yB)
calculate the reduced costs c – input of the objective function costs yA – dual values on node assign...
~OSBearcatSolverXij()
Default Destructor.
int m_upperBoundLMax
largest possible L-value over all routes
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 numNo...
double qrouteCost(const int &k, const int &l, const double *c, int *kountVar)
kipp – document
Implements a solve method for the Coin solvers.
OSInstance * m_osinstanceSeparation
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 ...
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 nu...
OSDecompSolver * create()
bool m_use1OPTstart
if m_use1OPTstart is true we use the option file to fix the nodes to hubs found by SK's 1OPT heuristi...
std::map< int, std::string > m_tmpVarMap
The in-memory representation of an OSiL instance..
void getInitialSolution()
generate an intitial feasible solution in theta space for the initial master
std::string * m_nodeName
m_nodeName is the vector of node names
double ** m_newColumnRowValue
bool m_costSetInOption
m_costSetInOption is true if the costs are set using the OSOption file
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 eac...
int * m_lowerBoundL
smallest possible L-value on a route for now this will equal