AlpsDecompSolution.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef AlpsDecompSolution_h
00017 #define AlpsDecompSolution_h
00018
00019
00020 #include "AlpsSolution.h"
00021 #include "AlpsDecompModel.h"
00022
00023
00024 class AlpsDecompSolution : public AlpsSolution {
00025 protected:
00027 int m_size;
00028
00030 double* m_values;
00031
00033 double m_quality;
00034
00036 const DecompApp* m_app;
00037
00038 public:
00042 inline const int getSize() const {
00043 return m_size;
00044 }
00045
00047 inline const double* getValues() const {
00048 return m_values;
00049 }
00050
00052 inline const double getQuality() const {
00053 return m_quality;
00054 }
00055
00056 public:
00057 AlpsDecompSolution() :
00058 AlpsSolution(),
00059 m_size (0),
00060 m_values (0),
00061 m_quality (1e75),
00062 m_app (0) {}
00063
00064 AlpsDecompSolution(const int size,
00065 const double* values,
00066 const double quality,
00067 const DecompApp* app = NULL,
00068 const int depth = -1,
00069 const AlpsNodeIndex_t index = -1) :
00070 AlpsSolution(index, depth),
00071 m_size (size),
00072 m_values (0),
00073 m_quality (quality),
00074 m_app (app) {
00075 CoinAssert(m_size > 0);
00076 m_values = new double[m_size];
00077 CoinAssertHint(m_values, "Error: Out of Memory");
00078 memcpy(m_values, values, sizeof(double) * m_size);
00079 }
00080
00081 virtual ~AlpsDecompSolution() {
00082 UTIL_DELARR(m_values);
00083 };
00084
00086 virtual void print(std::ostream& os) const {
00087 if (m_app) {
00088 DecompAlgo* decompAlgo = m_app->getDecompAlgo();
00089 DecompConstraintSet* modelCore
00090 = decompAlgo->getModelCore().getModel();
00091 m_app->printOriginalSolution(m_size,
00092 modelCore->getColNames(),
00093 m_values);
00094 }
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109 }
00110 };
00111
00112 #endif