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

- File List
- File Members

# /home/coin/svn-release/Alps-1.4.6/Alps/src/AlpsModel.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-2013, Lehigh University, Yan Xu, and Ted Ralphs.       *
    00021  *===========================================================================*/
    00022
    00023 #ifndef AlpsModel_h
    00024 #define AlpsModel_h
    00025
    00026 #include <string>
    00027
    00028 #include "CoinError.hpp"
    00029
    00030 #include "AlpsKnowledge.h"
    00031 #include "AlpsTreeNode.h"
    00032 #include "AlpsParams.h"
    00033
    00034 class AlpsKnowledgeBroker;
    00035
    00036 class AlpsModel : public AlpsKnowledge {
    00037
    00038  private:
    00039
    00040     AlpsModel(const AlpsModel&);
    00041     AlpsModel& operator=(const AlpsModel&);
    00042
    00043  protected:
    00044
    00046     AlpsKnowledgeBroker *broker_;
    00047
    00049     std::string dataFile_;
    00050
    00052     AlpsParams * AlpsPar_;
    00053
    00054  public:
    00055
    00057     AlpsModel() :
    00058         broker_(NULL),
    00059         AlpsPar_(new AlpsParams) { setType(AlpsKnowledgeTypeModel); }
    00060
    00062     virtual ~AlpsModel() { delete AlpsPar_; }
    00063
    00065     AlpsKnowledgeBroker *getKnowledgeBroker() { return broker_; }
    00066
    00068     void setKnowledgeBroker(AlpsKnowledgeBroker *b) { broker_ = b; }
    00069
    00071     inline std::string getDataFile() const { return dataFile_; }
    00072
    00074     inline void setDataFile(std::string infile) { dataFile_ = infile; }
    00075
    00077     AlpsParams * AlpsPar() { return AlpsPar_; }
    00078
    00080     virtual void readInstance(const char* dateFile) {
    00081         throw CoinError("readInstance() is not defined.", "readData",
    00082                         "AlpsModel");
    00083     }
    00084
    00086     virtual void readParameters(const int argnum, const char * const * arglist);
    00087
    00089     void writeParameters(std::ostream& outstream) const;
    00090
    00093     virtual bool setupSelf() { return true; }
    00094
    00096     virtual void preprocess() {}
    00097
    00099     virtual void postprocess() {}
    00100
    00102     virtual AlpsTreeNode * createRoot() {
    00103         throw CoinError("createRoot is not defined.", "createRoot",
    00104                         "AlpsModel");
    00105     }
    00106
    00108     virtual void modelLog() {}
    00109
    00111     virtual void nodeLog(AlpsTreeNode *node, bool force);
    00112
    00114     virtual bool fathomAllNodes() { return false; }
    00115
    00116     //------------------------------------------------------
    00117     // For parallel.
    00118     //------------------------------------------------------
    00119
    00121     AlpsReturnStatus encodeAlps(AlpsEncoded *encoded) const;
    00122
    00124     AlpsReturnStatus decodeAlps(AlpsEncoded &encoded);
    00125
    00127     virtual void decodeToSelf(AlpsEncoded& encoded) {}
    00128
    00130     virtual void registerKnowledge() { /* Default does nothing */ }
    00131
    00133     virtual void sendGeneratedKnowledge() { /* Default does nothing */ }
    00134
    00136     virtual void receiveGeneratedKnowledge() { /* Default does nothing */ }
    00137
    00140     virtual AlpsEncoded* packSharedKnowlege() {
    00141         /* Default does nothing */
    00142         AlpsEncoded* encoded = NULL;
    00143         return encoded;
    00144     }
    00145
    00147     virtual void unpackSharedKnowledge(AlpsEncoded&)
    00148     { /* Default does nothing */ }
    00149 };
    00150 #endif