Dip-All  0.91.0
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 // 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 TSP_DECOMPAPP_INCLUDED
14 #define TSP_DECOMPAPP_INCLUDED
15 
16 //===========================================================================//
17 #include "Decomp.h"
18 #include "DecompApp.h"
19 #include "TSP_Instance.h"
20 #include "TSP_Param.h"
21 //===========================================================================//
22 
32 // --------------------------------------------------------------------- //
33 class TSP_DecompApp : public DecompApp {
34 private:
36  const string m_classTag;
37 
40 
43 
45  double * m_objective;
46 
48  vector<DecompConstraintSet*> m_models;
49 
50 public:
51  /* @name Inherited (from virtual) methods. */
52 
54  virtual DecompSolverStatus solveRelaxed(const int whichBlock,
55  const double * redCostX,
56  const double convexDual,
57  DecompVarList & varList);
58 
59  virtual int generateCuts(const double * x,
60  DecompCutList & newCuts);
61 
62  virtual bool APPisUserFeasible(const double * x,
63  const int n_cols,
64  const double tolZero);
65  virtual void printOriginalColumn(const int index,
66  ostream * os) const;
67 
68 
69 private:
73  void initializeApp(UtilParameters & utilParam);
74 
76  void createModels();
77 
79  void createModel2Match(DecompConstraintSet * modelCS);
80 
83 
84  int generateCutsSubtour(DecompCutList & newCuts);
85 
86  void solveOneTree(const double * cost,
87  const double alpha,
88  vector< pair<int,double> > & edge_cost,
89  DecompVarList & vars,
90  Graph & g);
91 
92 public:
96  TSP_DecompApp(UtilParameters & utilParam) :
97  DecompApp(utilParam),
98  m_classTag("TSP-APP"),
99  m_objective(NULL)
100  {
101  initializeApp(utilParam);
102  }
103 
104  virtual ~TSP_DecompApp() {
107  };
108 };
109 
110 #endif
111 
112 
113 
std::list< DecompCut * > DecompCutList
Definition: Decomp.h:55
void createModel2Match(DecompConstraintSet *modelCS)
Create the two-matching constraints.
void initializeApp(UtilParameters &utilParam)
Guts of constructor.
void UtilDeleteVectorPtr(vector< T * > &vectorPtr, typename vector< T * >::iterator first, typename vector< T * >::iterator last)
Definition: UtilMacros.h:288
int generateCutsSubtour(DecompCutList &newCuts)
Guts of constructor.
adjacency_list< vecS, vecS, undirectedS, no_property, edge_prop > Graph
Definition: TSP_Boost.h:34
#define UTIL_DELARR(x)
Definition: UtilMacros.h:29
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:48
void createModelTrivialSEC(DecompConstraintSet *modelCS)
Create trivial subtour elimination constraints.
const string m_classTag
Class id tag (for log / debugging).
Definition: TSP_DecompApp.h:36
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:96
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:42
double * m_objective
The model objective coefficients (original space).
Definition: TSP_DecompApp.h:45
TSP_Param m_appParam
Application specific parameters.
Definition: TSP_DecompApp.h:39
DecompSolverStatus
Definition: Decomp.h:170
virtual ~TSP_DecompApp()
Default constructor.
std::list< DecompVar * > DecompVarList
Definition: Decomp.h:53
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:50