00001 /* (c) 2008,2009 Jonathan Hogg and Andreas Grothey, University of Edinburgh 00002 * 00003 * This file is part of SML. 00004 * 00005 * SML is free software: you can redistribute it and/or modify it under the 00006 * terms of the GNU Lesser General Public License as published by the Free 00007 * Software Foundation, using version 3 of the License. 00008 * 00009 * SML is distributed in the hope that it will be useful, but WITHOUT ANY 00010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00011 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00012 * details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public License 00015 * along with this program. If not, see http://www.gnu.org/licenses/. 00016 */ 00017 00018 #ifndef STOCHMODEL_H 00019 #define STOCHMODEL_H 00020 00021 #include "AmplModel.h" 00022 #include <string> 00023 #include <vector> 00024 00025 class ModelComp; 00026 class SyntaxNode; 00027 class SyntaxNodeIDREF; 00028 00029 /* ------------------------------------------------------------------------ */ 00048 class StochModel: public AmplModel{ 00049 00050 private: 00051 00052 // FIXME: stage should be replaced by a Set (decribing the elements) 00053 00055 SyntaxNode *stageset; 00056 00058 IDNode *stagedummy; 00059 00061 std::vector <std::string> stagenames; 00062 00064 bool is_symbolic_stages; 00065 00067 SyntaxNode *nodeset; 00068 00070 IDNode *nodedummy; 00071 00073 SyntaxNode *anc; 00074 00076 SyntaxNode *prob; 00077 00078 public: 00079 // -------------------------- methods ---------------------------------- 00081 StochModel(SyntaxNode *onStages, SyntaxNode *onNodes, SyntaxNode *onAncs, 00082 SyntaxNode *onProb, AmplModel *parent); 00083 00085 AmplModel *expandToFlatModel(); 00086 00088 void expandStages(); 00089 00091 void expandStagesOfComp(); 00092 00094 void addComp(ModelComp *comp); 00095 00097 SyntaxNode* getProbs() const { return prob; } 00098 00099 SyntaxNodeIDREF* find_var_ref_in_context(IDNode *ref); 00100 00101 private: 00102 00104 void _transcribeComponents(AmplModel *current, int level); 00105 }; 00106 00107 #endif