Dip  0.92.4
VRP_DecompApp.h
Go to the documentation of this file.
1 //===========================================================================//
2 // This file is part of the Decomp Solver Framework. //
3 // //
4 // Decomp is distributed under the Common Public License as part of the //
5 // COIN-OR repository (http://www.coin-or.org). //
6 // //
7 // Authors: Matthew Galati, SAS Institute Inc. (matthew.galati@sas.com) //
8 // Ted Ralphs, Lehigh University (ted@lehigh.edu) //
9 // Jiadong Wang, Lehigh University (jiw408@lehigh.edu) //
10 // //
11 // Copyright (C) 2002-2019, Lehigh University, Matthew Galati, and Ted Ralphs//
12 // All Rights Reserved. //
13 //===========================================================================//
14 
15 #ifndef VRP_DECOMPAPP_INCLUDED
16 #define VRP_DECOMPAPP_INCLUDED
17 
18 // --------------------------------------------------------------------- //
19 #include "Decomp.h"
20 #include "DecompApp.h"
21 #include "VRP_Boost.h"
22 #include "VRP_CVRPsep.h"
23 #include "VRP_Instance.h"
24 #include "VRP_Param.h"
25 // --------------------------------------------------------------------- //
26 #define VRP_DECOMPAPP_USECONCORDE
27 #ifdef VRP_DECOMPAPP_USECONCORDE
28 #include "VRP_Concorde.h"
29 #endif
30 // --------------------------------------------------------------------- //
31 
41 // --------------------------------------------------------------------- //
42 class VRP_DecompApp : public DecompApp {
43 private:
45  const string m_classTag;
46 
49 
52 
55 
58 
60 #ifdef VRP_DECOMPAPP_USECONCORDE
62 #endif
63 
65  double * m_objective;
66 
68  vector<DecompConstraintSet*> m_models;
70 
71 public:
72  /* @name Inherited (from virtual) methods. */
73 
75  virtual DecompSolverStatus solveRelaxed(const int whichBlock,
76  const double * redCostX,
77  const double convexDual,
78  DecompVarList & varList);
79 
80 
81  virtual int generateCuts(const double * x,
82  DecompCutList & newCuts);
83 
84  //TODO: change this name...
85  virtual bool APPisUserFeasible(const double * x,
86  const int n_cols,
87  const double tolZero);
88  virtual void printOriginalColumn(const int index,
89  ostream * os) const;
90 
91 
92 
93 public:
96  void initializeApp();
97 
98  /* Create models. */
99  void createModels();
100 
101  /* Create two-degree model. */
103 
104  /* Create ESPPCC model. */
106 
107  const int diGraphIndex(int i, int j, int numVertices){
108  return i*numVertices + j;
109  }
110  const pair<int,int> diGraphBothEnds(int index, int numVertices){
111  int i = index / numVertices;
112  return make_pair(i, index % numVertices);
113  }
114 
115 public:
120  DecompApp(utilParam),
121  m_classTag("VRP-APP"),
122  m_objective(NULL),
123  m_modelESPPRC(NULL)
124  {
125  //---
126  //--- get application parameters
127  //---
128  m_appParam.getSettings(utilParam);
129  if(m_appParam.LogLevel >= 1)
131 
132  initializeApp();
133  }
134 
135  virtual ~VRP_DecompApp() {
138  };
139 };
140 
141 #endif
std::list< DecompCut * > DecompCutList
Definition: Decomp.h:93
void createModelESPPCC(DecompConstraintSet *model)
void UtilDeleteVectorPtr(vector< T * > &vectorPtr, typename vector< T * >::iterator first, typename vector< T * >::iterator last)
Definition: UtilMacros.h:288
virtual int generateCuts(const double *x, DecompCutList &newCuts)
Initialize the dual vector for PhaseII of PC.
void getSettings(UtilParameters &utilParam)
Definition: VRP_Param.h:40
const int diGraphIndex(int i, int j, int numVertices)
DecompConstraintSet * m_modelESPPRC
Definition: VRP_DecompApp.h:69
virtual DecompSolverStatus solveRelaxed(const int whichBlock, const double *redCostX, const double convexDual, DecompVarList &varList)
Solve the relaxed problem.
#define UTIL_DELARR(x)
Definition: UtilMacros.h:29
int LogLevel
Definition: VRP_Param.h:31
void createModelTwoDegree(DecompConstraintSet *model)
virtual void printOriginalColumn(const int index, ostream *os) const
VRP_Param m_appParam
Application specific parameters.
Definition: VRP_DecompApp.h:48
VRP_Instance m_vrp
Storage of TSP instance.
Definition: VRP_DecompApp.h:51
const pair< int, int > diGraphBothEnds(int index, int numVertices)
virtual bool APPisUserFeasible(const double *x, const int n_cols, const double tolZero)
Method to determine if the solution (x) is feasible to the original model.
std::ostream * m_osLog
Log file.
Definition: DecompApp.h:60
const string m_classTag
Class id tag (for log / debugging).
Definition: VRP_DecompApp.h:45
void initializeApp()
Initialize applications.
vector< DecompConstraintSet * > m_models
The various model constraint systems used for different algos.
Definition: VRP_DecompApp.h:68
virtual ~VRP_DecompApp()
Default constructor.
void createModels()
VRP_Concorde m_concorde
Interface class for Concorde methods.
Definition: VRP_DecompApp.h:61
VRP_DecompApp(UtilParameters &utilParam)
Default constructor.
void dumpSettings(ostream *os=&cout)
Definition: VRP_Param.h:54
DecompSolverStatus
Definition: Decomp.h:208
std::list< DecompVar * > DecompVarList
Definition: Decomp.h:91
double * m_objective
The model objective coefficients (original space).
Definition: VRP_DecompApp.h:65
The main application class.
Definition: DecompApp.h:48
VRP_CVRPsep m_cvrpSep
Interface class for CVRPSEP methods.
Definition: VRP_DecompApp.h:54
VRP_Boost m_boost
Interface class for Boost methods.
Definition: VRP_DecompApp.h:57