- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# /home/coin/SVN-release/Blis-0.92.0/Alps/examples/Abc/AbcSolution.h

Go to the documentation of this file.

    00001 /*===========================================================================*
    00002  * This file is part of the Abstract Library for Parallel Search (ALPS).     *
    00003  *                                                                           *
    00004  * ALPS is distributed under the Eclipse Public License as part of the       *
    00005  * COIN-OR repository (http://www.coin-or.org).                              *
    00006  *                                                                           *
    00007  * Authors:                                                                  *
    00008  *                                                                           *
    00009  *          Yan Xu, Lehigh University                                        *
    00010  *          Ted Ralphs, Lehigh University                                    *
    00011  *                                                                           *
    00012  * Conceptual Design:                                                        *
    00013  *                                                                           *
    00014  *          Yan Xu, Lehigh University                                        *
    00015  *          Ted Ralphs, Lehigh University                                    *
    00016  *          Laszlo Ladanyi, IBM T.J. Watson Research Center                  *
    00017  *          Matthew Saltzman, Clemson University                             *
    00018  *                                                                           *
    00019  *                                                                           *
    00020  * Copyright (C) 2001-2011, Lehigh University, Yan Xu, and Ted Ralphs.       *
    00021  *===========================================================================*/
    00022
    00023 #ifndef AbcSolution_h
    00024 #define AbcSolution_h
    00025
    00026 #include "AlpsSolution.h"
    00027
    00028 #include "AbcModel.h"
    00029
    00031 class AbcSolution : public AlpsSolution {
    00032  private:
    00033     int size_;
    00034     double* value_;
    00035     double objective_;
    00036
    00037  public:
    00038     AbcSolution()
    00039         :
    00040         size_(0),
    00041         value_(0),
    00042         objective_()
    00043         {}
    00044     AbcSolution(const int s, const double* val, const double obj)
    00045         :
    00046         size_(s)
    00047         {
    00048             if (size_ >= 0) {
    00049                 value_ = new double [size_];
    00050                 memcpy(value_, val, sizeof(double) * size_);
    00051             }
    00052         }
    00053
    00054     ~AbcSolution() {
    00055         if (value_ != 0) {
    00056             delete [] value_;
    00057             value_ = 0;
    00058         }
    00059     }
    00060
    00062     double getObjValue() const { return objective_; }
    00063
    00064     virtual double getQuality() const { return getObjValue(); }
    00065
    00067     int getSize() const { return size_; }
    00068
    00070     const double* getColSolution() const
    00071         { return value_; }
    00072
    00074     double getColSolution(int i) const { return value_[i]; }
    00075
    00077     virtual void print(std::ostream& os) const;
    00078
    00080     virtual AlpsEncoded* encode() const;
    00081
    00083     virtual AlpsKnowledge* decode(AlpsEncoded&) const;
    00084 };
    00085
    00086 #endif