Dip-All  0.91.0
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 // Author: Matthew Galati, Lehigh University //
8 // //
9 // Copyright (C) 2002-2015, Lehigh University, Matthew Galati, and Ted Ralphs//
10 // All Rights Reserved. //
11 //===========================================================================//
12 
13 #ifndef VRP_DECOMPAPP_INCLUDED
14 #define VRP_DECOMPAPP_INCLUDED
15 
16 // --------------------------------------------------------------------- //
17 #include "Decomp.h"
18 #include "DecompApp.h"
19 #include "VRP_Boost.h"
20 #include "VRP_CVRPsep.h"
21 #include "VRP_Instance.h"
22 #include "VRP_Param.h"
23 // --------------------------------------------------------------------- //
24 #define VRP_DECOMPAPP_USECONCORDE
25 #ifdef VRP_DECOMPAPP_USECONCORDE
26 #include "VRP_Concorde.h"
27 #endif
28 // --------------------------------------------------------------------- //
29 
39 // --------------------------------------------------------------------- //
40 class VRP_DecompApp : public DecompApp {
41 private:
43  const string m_classTag;
44 
47 
50 
53 
56 
58 #ifdef VRP_DECOMPAPP_USECONCORDE
60 #endif
61 
63  double * m_objective;
64 
66  vector<DecompConstraintSet*> m_models;
68 
69 public:
70  /* @name Inherited (from virtual) methods. */
71 
73  virtual DecompSolverStatus solveRelaxed(const int whichBlock,
74  const double * redCostX,
75  const double convexDual,
76  DecompVarList & varList);
77 
78 
79  virtual int generateCuts(const double * x,
80  DecompCutList & newCuts);
81 
82  //TODO: change this name...
83  virtual bool APPisUserFeasible(const double * x,
84  const int n_cols,
85  const double tolZero);
86  virtual void printOriginalColumn(const int index,
87  ostream * os) const;
88 
89 
90 
91 public:
94  void initializeApp(UtilParameters & utilParam);
95 
96  /* Create models. */
97  void createModels();
98 
99  /* Create two-degree model. */
101 
102  /* Create ESPPCC model. */
104 
105  const int diGraphIndex(int i, int j, int numVertices){
106  return i*numVertices + j;
107  }
108  const pair<int,int> diGraphBothEnds(int index, int numVertices){
109  int i = index / numVertices;
110  return make_pair(i, index % numVertices);
111  }
112 
113 public:
118  DecompApp(utilParam),
119  m_classTag("VRP-APP"),
120  m_objective(NULL),
121  m_modelESPPRC(NULL)
122  {
123  initializeApp(utilParam);
124  }
125 
126  virtual ~VRP_DecompApp() {
129  };
130 };
131 
132 #endif
std::list< DecompCut * > DecompCutList
Definition: Decomp.h:55
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.
const int diGraphIndex(int i, int j, int numVertices)
DecompConstraintSet * m_modelESPPRC
Definition: VRP_DecompApp.h:67
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
void createModelTwoDegree(DecompConstraintSet *model)
virtual void printOriginalColumn(const int index, ostream *os) const
VRP_Param m_appParam
Application specific parameters.
Definition: VRP_DecompApp.h:46
VRP_Instance m_vrp
Storage of TSP instance.
Definition: VRP_DecompApp.h:49
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.
const string m_classTag
Class id tag (for log / debugging).
Definition: VRP_DecompApp.h:43
void initializeApp(UtilParameters &utilParam)
Initialize applications.
vector< DecompConstraintSet * > m_models
The various model constraint systems used for different algos.
Definition: VRP_DecompApp.h:66
virtual ~VRP_DecompApp()
Default constructor.
void createModels()
VRP_Concorde m_concorde
Interface class for Concorde methods.
Definition: VRP_DecompApp.h:59
VRP_DecompApp(UtilParameters &utilParam)
Default constructor.
DecompSolverStatus
Definition: Decomp.h:170
std::list< DecompVar * > DecompVarList
Definition: Decomp.h:53
double * m_objective
The model objective coefficients (original space).
Definition: VRP_DecompApp.h:63
The main application class.
Definition: DecompApp.h:50
VRP_CVRPsep m_cvrpSep
Interface class for CVRPSEP methods.
Definition: VRP_DecompApp.h:52
VRP_Boost m_boost
Interface class for Boost methods.
Definition: VRP_DecompApp.h:55