Dip  0.92.4
TSP_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 TSP_DECOMPAPP_INCLUDED
16 #define TSP_DECOMPAPP_INCLUDED
17 
18 //===========================================================================//
19 #include "Decomp.h"
20 #include "DecompApp.h"
21 #include "TSP_Instance.h"
22 #include "TSP_Param.h"
23 //===========================================================================//
24 
34 // --------------------------------------------------------------------- //
35 class TSP_DecompApp : public DecompApp {
36 private:
38  const string m_classTag;
39 
42 
45 
47  double * m_objective;
48 
50  vector<DecompConstraintSet*> m_models;
51 
52 public:
53  /* @name Inherited (from virtual) methods. */
54 
56  virtual DecompSolverStatus solveRelaxed(const int whichBlock,
57  const double * redCostX,
58  const double convexDual,
59  DecompVarList & varList);
60 
61  virtual int generateCuts(const double * x,
62  DecompCutList & newCuts);
63 
64  virtual bool APPisUserFeasible(const double * x,
65  const int n_cols,
66  const double tolZero);
67  virtual void printOriginalColumn(const int index,
68  ostream * os) const;
69 
70 
71 private:
75  void initializeApp();
76 
78  void createModels();
79 
81  void createModel2Match(DecompConstraintSet * modelCS);
82 
85 
86  int generateCutsSubtour(DecompCutList & newCuts);
87 
88  void solveOneTree(const double * cost,
89  const double alpha,
90  vector< pair<int,double> > & edge_cost,
91  DecompVarList & vars,
92  Graph & g);
93 
94 public:
98  TSP_DecompApp(UtilParameters & utilParam) :
99  DecompApp(utilParam),
100  m_classTag("TSP-APP"),
101  m_objective(NULL)
102  {
103  //---
104  //--- get application parameters
105  //---
106  m_appParam.getSettings(utilParam);
107  if(m_appParam.LogLevel >= 1)
109 
110  initializeApp();
111  }
112 
113  virtual ~TSP_DecompApp() {
116  };
117 };
118 
119 #endif
120 
121 
122 
void initializeApp()
Guts of constructor.
std::list< DecompCut * > DecompCutList
Definition: Decomp.h:93
void createModel2Match(DecompConstraintSet *modelCS)
Create the two-matching constraints.
void UtilDeleteVectorPtr(vector< T * > &vectorPtr, typename vector< T * >::iterator first, typename vector< T * >::iterator last)
Definition: UtilMacros.h:288
void getSettings(UtilParameters &utilParam)
Definition: TSP_Param.h:45
int LogLevel
Definition: TSP_Param.h:34
int generateCutsSubtour(DecompCutList &newCuts)
Guts of constructor.
adjacency_list< vecS, vecS, undirectedS, no_property, edge_prop > Graph
Definition: TSP_Boost.h:36
#define UTIL_DELARR(x)
Definition: UtilMacros.h:29
void dumpSettings(ostream *os=&cout)
Definition: TSP_Param.h:59
virtual int generateCuts(const double *x, DecompCutList &newCuts)
Initialize the dual vector for PhaseII of PC.
vector< DecompConstraintSet * > m_models
The various model constraint systems used for different algos.
Definition: TSP_DecompApp.h:50
void createModelTrivialSEC(DecompConstraintSet *modelCS)
Create trivial subtour elimination constraints.
const string m_classTag
Class id tag (for log / debugging).
Definition: TSP_DecompApp.h:38
void solveOneTree(const double *cost, const double alpha, vector< pair< int, double > > &edge_cost, DecompVarList &vars, Graph &g)
Guts of constructor.
TSP_DecompApp(UtilParameters &utilParam)
Default constructor.
Definition: TSP_DecompApp.h:98
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.
void createModels()
Create models.
virtual void printOriginalColumn(const int index, ostream *os) const
TSP_Instance m_tsp
Storage of TSP instance.
Definition: TSP_DecompApp.h:44
double * m_objective
The model objective coefficients (original space).
Definition: TSP_DecompApp.h:47
TSP_Param m_appParam
Application specific parameters.
Definition: TSP_DecompApp.h:41
DecompSolverStatus
Definition: Decomp.h:208
virtual ~TSP_DecompApp()
Default constructor.
std::list< DecompVar * > DecompVarList
Definition: Decomp.h:91
virtual DecompSolverStatus solveRelaxed(const int whichBlock, const double *redCostX, const double convexDual, DecompVarList &varList)
Solve the relaxed problem.
The main application class.
Definition: DecompApp.h:48