Dip  0.92.4
MAD_DecompSolution.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 MAD_DECOMP_SOLUTION_INCLUDED
16 #define MAD_DECOMP_SOLUTION_INCLUDED
17 
18 // --------------------------------------------------------------------- //
19 #include "MAD_DecompApp.h"
20 #include "DecompSolution.h"
21 
22 // --------------------------------------------------------------------- //
24 private:
26 
27 public:
28  void print(ostream & os = cout) const {
29  int i, b, border_size;
30  double xj;
31 
32  const int nOrigRows = m_app->getNOrigRows();
33  const int beta = m_app->getBeta();
34 
35  os << "\nBlock Decomposition:";
36  vector<unsigned int> border(nOrigRows, 1);
37  for(b = 0; b < beta; b++){
38  os << "\nBLOCK " << b << ":\t";
39  for(i = 0; i < nOrigRows; i++){
40  xj = m_values[m_app->xIndex(i,b)];
42  CoinAssertDebug(xj < (1.0 + DecompEpsilon));
43  CoinAssertDebug(xj > ( - DecompEpsilon));
44  if(xj > 0.5){
45  os << i << " ";
46  border[i] = 0;
47  }
48  }
49  }
50  border_size = count(border.begin(), border.end(), 1);
51 
52  os << "\nBORDER :\t";
53  for(i = 0; i < nOrigRows; i++){
54  if(!border[i])
55  continue;
56  os << i << " ";
57  }
58  os << "\nBORDER Size = " << border_size << "\n";
59  }
60 
61 private:
67  /*
68  MAD_DecompSolution(const MAD_DecompSolution &);
69  MAD_DecompSolution & operator=(const MAD_DecompSolution &);
70  */
71  public:
77  {
78  }
79 
82  const int size,
83  const double * values,
84  const double quality) :
85  DecompSolution(size, values, quality),
86  m_app(app)
87  {
88  }
89 
90  virtual ~MAD_DecompSolution() {
91  };
92 };
93 
94 #endif
const int getNOrigRows() const
Access method for member data.
double * m_values
Solution values.
const int xIndex(const int i, const int b) const
Global index for column x[i,b].
MAD_DecompSolution(const MAD_DecompApp *app, const int size, const double *values, const double quality)
Constructor.
void print(ostream &os=cout) const
Get length of solution.
MAD_DecompSolution()
Default constructor.
const int getBeta() const
Global index for column x[i,b].
const double DecompEpsilon
Definition: Decomp.h:100
#define CoinAssertDebug(expression)
Definition: CoinError.hpp:181
virtual ~MAD_DecompSolution()
Default constructor.
bool UtilIsIntegral(const double x, const double etol=1.0e-10)
Definition: UtilMacros.h:328
const MAD_DecompApp * m_app