BcpsDecompSolution.h

Go to the documentation of this file.
00001 //===========================================================================//
00002 // This file is part of the Decomp Solver Framework.                         //
00003 //                                                                           //
00004 // Decomp is distributed under the Common Public License as part of the      //
00005 // COIN-OR repository (http://www.coin-or.org).                              //
00006 //                                                                           //
00007 // Author: Matthew Galati, SAS Institute Inc. (matthew.galati@sas.com)       //
00008 //                                                                           //
00009 // Copyright (C) 2002-2007, Lehigh University, Matthew Galati, and Ted Ralphs//
00010 // All Rights Reserved.                                                      //
00011 //===========================================================================//
00012 
00013 /*===========================================================================*
00014  * This file is part of the Abstract Library for Parallel Search (ALPS).     *
00015  *                                                                           *
00016  * ALPS is distributed under the Common Public License as part of the        *
00017  * COIN-OR repository (http://www.coin-or.org).                              *
00018  *                                                                           *
00019  * Authors: Yan Xu, SAS Institute Inc.                                       *
00020  *          Ted Ralphs, Lehigh University                                    *
00021  *          Laszlo Ladanyi, IBM T.J. Watson Research Center                  *
00022  *          Matthew Saltzman, Clemson University                             *
00023  *                                                                           * 
00024  *                                                                           *
00025  * Copyright (C) 2001-2006, Lehigh University, Yan Xu, and Ted Ralphs.       *
00026  *===========================================================================*/
00027 
00028 #ifndef BcpsDecompSolution_h
00029 #define BcpsDecompSolution_h
00030 
00031 #include "AlpsSolution.h"
00032 #include "BcpsDecompModel.h"
00033 
00035 class BcpsDecompSolution : public AlpsSolution {
00036  private:
00037     int size_;
00038     double* value_;
00039     double objective_;
00040     
00041  public:
00042     BcpsDecompSolution() 
00043     : 
00044     size_(0), 
00045     value_(0), 
00046     objective_() 
00047     {}
00048     BcpsDecompSolution(const int s, const double* val, const double obj) 
00049     : 
00050     size_(s)
00051     { 
00052         if (size_ >= 0) {
00053         value_ = new double [size_];
00054         memcpy(value_, val, sizeof(double) * size_);
00055         }
00056     }
00057 
00058     ~BcpsDecompSolution() { 
00059     if (value_ != 0) {
00060         delete [] value_; 
00061         value_ = 0;
00062     }
00063     }
00064   
00066     double getObjValue() const { return objective_; }
00067 
00068     virtual double getQuality() const { return getObjValue(); }
00069   
00071     int getSize() const { return size_; }
00072     
00074     const double* getColSolution() const 
00075     { return value_; }
00076     
00078     double getColSolution(int i) const { return value_[i]; }
00079     
00081     virtual void print(std::ostream& os) const;
00082   
00083 #if 0
00084 
00085     virtual AlpsEncoded* encode() const;
00086   
00088     virtual AlpsKnowledge* decode(AlpsEncoded&) const;
00089 #endif
00090 };
00091 
00092 #endif

Generated on 12 Feb 2015 for Dip-All by  doxygen 1.6.1