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

- File List
- File Members

# /home/coin/SVN-release/Blis-0.91.0/Bcps/src/BcpsModel.h

Go to the documentation of this file.

    00001 /*===========================================================================*
    00002  * This file is part of the Branch, Constrain and Price Software (BiCePS)    *
    00003  *                                                                           *
    00004  * BiCePS is distributed under the Common 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  * Copyright (C) 2001-2009, Lehigh University, Yan Xu, and Ted Ralphs.       *
    00020  * All Rights Reserved.                                                      *
    00021  *===========================================================================*/
    00022
    00023 #ifndef BcpsModel_h_
    00024 #define BcpsModel_h_
    00025
    00026 //#############################################################################
    00027
    00028 #include <vector>
    00029
    00030 #include "CoinMessageHandler.hpp"
    00031
    00032 #include "AlpsModel.h"
    00033 #include "AlpsKnowledgeBroker.h"
    00034
    00035 #include "BcpsMessage.h"
    00036 #include "BcpsObject.h"
    00037
    00038 //#############################################################################
    00039
    00040 class BcpsModel : public AlpsModel {
    00041
    00042  protected:
    00043
    00045     std::vector<BcpsConstraint *> constraints_;
    00046
    00048     std::vector<BcpsVariable *> variables_;
    00049
    00050
    00054     int numCoreConstraints_;
    00055
    00057     int numCoreVariables_;
    00058
    00060     CoinMessageHandler * bcpsMessageHandler_;
    00061
    00063     CoinMessages bcpsMessages_;
    00064
    00065  public:
    00066
    00067     BcpsModel()
    00068         :
    00069         numCoreConstraints_(0),
    00070         numCoreVariables_(0)
    00071         {
    00072             bcpsMessageHandler_ = new CoinMessageHandler();
    00073             bcpsMessageHandler_->setLogLevel(2);
    00074             bcpsMessages_ = BcpsMessage();
    00075         }
    00076
    00077     virtual ~BcpsModel() {
    00078         int i = 0;
    00079         int size = static_cast<int> (constraints_.size());
    00080         for (i = 0; i < size; ++i) {
    00081             delete constraints_[i];
    00082         }
    00083         size =  static_cast<int> (variables_.size());
    00084         for (i = 0; i < size; ++i) {
    00085             delete variables_[i];
    00086         }
    00087         delete bcpsMessageHandler_;
    00088     }
    00089
    00092     std::vector<BcpsConstraint *> & getConstraints() { return constraints_; }
    00093     std::vector<BcpsVariable *> & getVariables() { return variables_; }
    00094
    00095     int getNumCoreConstraints() const { return numCoreConstraints_; }
    00096     int getNumCoreVariables() const { return numCoreVariables_; }
    00101     void setConstraints(BcpsConstraint **con, int size) {
    00102         for (int j = 0; j < size; ++j) {
    00103             constraints_.push_back(con[j]);
    00104         }
    00105     }
    00106     void setNumCoreConstraints(int num) { numCoreConstraints_ = num; }
    00107
    00108     void setVariables(BcpsVariable **var, int size) {
    00109         for (int j = 0; j < size; ++j) {
    00110             variables_.push_back(var[j]);
    00111         }
    00112     }
    00113     void setNumCoreVariables(int num) { numCoreVariables_ = num; }
    00117     CoinMessageHandler * bcpsMessageHandler() const
    00118     { return bcpsMessageHandler_; }
    00119
    00121     CoinMessages bcpsMessages() { return bcpsMessages_; }
    00122
    00123
    00125     AlpsReturnStatus encodeBcps(AlpsEncoded *encoded) const;
    00126
    00128     AlpsReturnStatus decodeBcps(AlpsEncoded &encoded);
    00129
    00130 };
    00131
    00132
    00133 #endif